5 Replies Latest reply on Jan 29, 2007 10:10 AM by Torsten Fink

    Propagating Roles from Servlet Security Context to EJB3

    Torsten Fink Newbie

      Hi,

      this is probably a stupid poblem, but I dare to ask...

      I have a web application (JSF using Seam) that access an EJB-3 bean. For testing I use the UsersRolesLoginModule and put the configuration files in my JBOSS/server/default/conf directory.

      I have no problems to access the authenticated user in my bean, doing this:

      Principal callerPrincipal = _sessionContext.getCallerPrincipal();
      


      But I cannot check my roles programmatically. If I try to execute this
       _sessionContext.isCallerInRole(anwendungsRolle)
      

      I get this error:
      12:36:38,938 ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files
      java.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found
       at org.jboss.security.auth.spi.Util.loadProperties(Util.java:315)
       at org.jboss.security.auth.spi.UsersRolesLoginModule.loadUsers(UsersRolesLoginModule.java:186)
      


      This is my login configuration:

      <application-policy name = "reisekosten">
       <authentication>
       <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
       flag = "required">
       <module-option name="usersProperties">props/reisekosten-users.properties</module-option>
       <module-option name="rolesProperties">props/reisekosten-roles.properties</module-option>
       <module-option name="password-stacking">useFirstPass</module-option>
       </login-module>
       <login-module code = "org.jboss.security.ClientLoginModule" flag = "required">
       <module-option name="password-stacking">useFirstPass</module-option>
       </login-module>
       </authentication>
       </application-policy>
      


      This my jboss-web.xml:
      <jboss-web>
       <security-domain>java:/jaas/reisekosten</security-domain>
      </jboss-web>
      


      And this my jboss.xml:
      <jboss>
       <security-domain>java:/jaas/reisekosten</security-domain>
      </jboss>
      


      Anyone any ideas?

      Thanks in advance,

      Torsten