0 Replies Latest reply on May 22, 2007 11:04 AM by Tibor Gal

    DatabaseServerLoginModule

    Tibor Gal Newbie

      I wanted to use a Database for authentication in Jboss Portal. I modified
      the login-config.xml file in the jboss-portal.sar/conf directory in the
      following way:

      <policy>
       <!-- For the JCR CMS -->
       <application-policy name="cms">
       <authentication>
       <login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
       </authentication>
       </application-policy>
      
       <application-policy name="portal">
       <authentication>
      <!--
       <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">
       <module-option name="unauthenticatedIdentity">guest</module-option>
       <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
       <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
       <module-option name="additionalRole">Authenticated</module-option>
       <module-option name="password-stacking">useFirstPass</module-option>
       </login-module>
      -->
       <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
       <module-option name="dsJndiName">java:/PortalDS</module-option>
       <module-option name="principalsQuery">SELECT passwd FROM users WHERE username=?</module-option>
       <module-option name="rolesQuery">SELECT role, 'Roles' FROM roles WHERE username=?</module-option>
       <module-option name="additionalRole">Authenticated</module-option>
      <!--
       <module-option name="hashAlgorithm">MD5</module-option>
       <module-option name="hashEncoding">HEX</module-option>
      -->
       </login-module>
       </authentication>
      
       </application-policy>
      </policy>

      Additionally I created two tables in the default database (PortalDS):
       users roles
      ------------------------ ------------------------
      username | passwd | | username | role |
      ------------------------ ------------------------
      admin | admin | | admin | Admin |
      ------------------------ -------------------------
      user | user | | user | User |
      ------------------------ -------------------------
      student1 | tomcat | |student1 | student |
      ----------------------- ------------------------

      The problem: Nobody of the users can login. Help me please!