I got authentication working fine in my web application using JSecurity and the 
JdbcRealm.

When I added roles everything is OK until I check in a servlet to see if the 
subject has a role by calling the hasRole method.  At that point a 
NoSuchElementException is thrown.

All code is available in a zip file at:  
http://www.brucephillips.name/jsecurity_examples/rolesecurity.zip

My web.xml has this configuration:

<filter>
        <filter-name>JSecurityFilter</filter-name>
        <filter-class>org.jsecurity.web.servlet.JSecurityFilter</filter-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>
                #See JSecurity API http://jsecurity.org/api/index.html
                # and 
http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
                
                #this application will use all the default
                #filters (see link above)
                #for example the default login page is /login.jsp
                #users who try to access a page protected by JSecurity
                #will be sent to /login.jsp
                [filters]


                #only let authenticated users
                #with the appropriate role
                #view the web pages in the secure
                #and admin areas
                [urls]
                /secure/** = authc
                /admin/** = authc

            </param-value>
        </init-param>
    </filter>


-- 
View this message in context: 
http://n2.nabble.com/Call-to-Subject-class-hasRoles-method-causes-NoSuchElementException-tp2578639p2578639.html
Sent from the JSecurity User mailing list archive at Nabble.com.

Reply via email to