What does the error mean when logging in through the JAAS role:!?

I have the following Jetty setup:

<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
    <Set name="Name">FOO JAAS Realm</Set>
    <Set name="LoginModuleName">foo</Set>
    <Set name="roleClassNames">
        <Array type="java.lang.String">


I am using inline Jetty 7.6.1.v20120215 via Maven Jetty plugin.

When I try to login through the form I have, the login fields are correctly submitted to / j _security_check. I wrote my own LoginModule that gets called and validates users correctly. I can see that their principles are correctly loaded from the database.

Instead of showing a secure page, Jetty shows me:


Problem accessing /foo/auth.html. Reason:



I'm not really sure what this actually means.

I have the following in my web.xml:





I register as an administrator.

Any help on the cryptic JAAS post displayed by Jetty would be much appreciated.


source to share

2 answers

The user logged in does not have the ADMINISTRATOR role that you run at /auth.html.

During the commit phase, your JAAS login module should add user roles to project contributors. Roles are performed in the Principal extending class that you specify to Jetty in the jetty.xml file.

Login module should have something like this in commit()

    Set<Principal> subjectPrincipals = subject.getPrincipals();

    //add the roles
    for (String role : userRolesList) {

         subjectPrincipals.add(new RolePrincipal(role));



- your role class



I had the same error and the above code was already there ... but after reading: http://wiki.eclipse.org/Jetty/Tutorial/JAAS I also had to update web-jetty.xml and add

<Set name="roleClassNames">
   <Array type="java.lang.String">


in this section:

<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">


because I used a specially crafted director for the roles "login.RolePrincipal" (actually I inherited the code and moved the application from tomcat to the jetty :))


All Articles