1 Reply Latest reply on Feb 24, 2004 7:50 PM by jpmorales

    userRoles is null in DatabaseServerLoginModule

    jpmorales

      Hi
      I am using a DatabaseServerLoginModule, configured as follows:

       <login-module code= "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="optional">
      
       <module-option name="principalsQuery">select login,passwd from contractors where login=?</module-option>
       <module-option name="rolesQuery">select login,role,'Roles' from roles where login=?</module-option>
       <module-option name="dsJndiName">java:/MYDS</module-option>
       </login-module>
      

      As stated in http://www.jboss.org/index.html?module=bb&op=viewtopic&t=20402 I have used the same expected strutures for the table. (I have also tried using only two fields for rolesQuery and only one field for principalsQuery). Authentication works like a charm, but JBoss is not retrieving the users. The log output, on TRACE mode says
      2004-02-24 20:17:48,280 TRACE [org.jboss.web.catalina.security.JBossSecurityMgrRealm] User: moralito is NOT authorized, requiredRoles=[project_2_create], userRoles=null
      

      However, if I run the principals Query it returns results. The user does belong to this role

        • 1. Re: userRoles is null in DatabaseServerLoginModule
          jpmorales

          OOPS. As was stated in several posts, the right way to query the database would be
          <module-option name="principalsQuery">select passwd from maintenance_users where login=?</module-option>
          <module-option name="rolesQuery">select role,'Roles' from maintenance_users_roles where login=?</module-option>


          Problem solved. Sorry for the mispost