2 Replies Latest reply on Oct 6, 2001 7:39 AM by Scy

    DatabaseServerLoginModule problem

    Scy Newbie

      I have a problem with the DatabaseServerLoginModule, where it called twice on a form-based security login, the second time with a null username and password.
      Since this always causes an exception, the login always fails. The first login suceeds with "User 'me' authenicated".

      My settings are fairly standard. No beans are used in the protected page, the login page or the login error page. My web.xml has the following:

      Restricted Area
      no description

      <realm-name>Restricted Area</realm-name>

      Restricted Area User

      I have jboss/conf/tomcat/auth.conf with:

      // Database login module
      affiliate {
      org.jboss.security.auth.spi.DatabaseServerLoginModule sufficient
      principalsQuery="select password from principals where emailAddress=?"
      rolesQuery="select role, role from principals where emailAddress=?"

      The jboss/client/auth.conf uses the ClientLoginModule.

        • 1. Re: DatabaseServerLoginModule problem
          BlogEasy Support Newbie

          Found a small error in your jaas deployment setting in your auth.conf file. You had specified the following:

          rolesQuery="select role, role from principals where emailAddress=?"

          This will write in the role twice and hence overwrite the second parameter which should be the roleGroup called "Roles" which is currently the only one JBoss recognizes. I noticed this while browsing the code for the DatabaseServerLoginModule. The code that causes this is:

          protected Group[] getRoleSets() throws LoginException
          String name = rs.getString(1);
          String groupName = rs.getString(2);
          if( groupName == null || groupName.length() == 0 )
          groupName = "Roles";
          Group group = (Group) setsMap.get(groupName);
          if( group == null )
          group = new SimpleGroup(groupName);
          setsMap.put(groupName, group);
          group.addMember(new SimplePrincipal(name));
          } while( rs.next() );

          Hope this helps.

          • 2. Re: DatabaseServerLoginModule problem
            Scy Newbie

            Hit the nail on the head, thanks!