2 Replies Latest reply on May 5, 2004 11:12 AM by Scott Stark

    jBoss 3.2.3+DatabaseServerLoginModule+Struts confusion

    Jason Pratt Newbie

      I am having some trouble getting DatabaseServerLoginModule to find my tables. I have read the latest JAAS howto (twice) and believe that I have everything setup correctly. I have the following defined in the login-config.xml

      <application-policy name="foo">
       <module-option name="dsJndiName">java:/fooDS</module-options>
       <module-option name="principalsQuery">select password from users where email=?</module-options>
       <module-option name="rolesQuery">select role, 'Roles' from userRoles where email=?</module-options>
       <module-option name="unauthenticatedIdentity">guest</module-options>

      I have the MySQL database define as follows:


      I am using this Action class for the Login in check, which I found out on the web:

      try {
       String email = dynaLoginForm.get("email").toString();
       String password = dynaLoginForm.get("password").toString();
       SimplePrincipal principal = new SimplePrincipal(email);
       SecurityAssociationHandler handler =
       new SecurityAssociationHandler();
       handler.setSecurityInfo(principal, password.toCharArray());
       LoginContext lc =
       new LoginContext("foo", handler);
       log.debug("trying to login");
       log.debug("login successful");
       Subject subject = lc.getSubject();
       log.debug("subject: " + subject.toString());
       Set principals = subject.getPrincipals();
       catch (Exception e) {
       log.error("caught: " + e);
       errors.add("header", new ActionError("error.password.mismatch"));
       log.error("password does not match setting user to null");
       user = null;

      My understanding is that the security policy "foo" will find the fooDS and have the correct tables to lookup the principal from. However, I get this error:

      caught: javax.security.auth.login.LoginException: No LoginModules configured for foo

      What am I doing wrong? Any help would be great!!


        • 1. Re: jBoss 3.2.3+DatabaseServerLoginModule+Struts confusion
          Jason Pratt Newbie

          I forgot to add that I have the following Relam defined in login-config.xml

          <application-policy name="fooDBRealm">
           <module-option name="principal">sa</module-option>
           <module-option name="userName">sa</module-option>
           <module-option name="password"></module-option>
           <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=fooDS</module-option>

          Need a little help here...


          • 2. Re: jBoss 3.2.3+DatabaseServerLoginModule+Struts confusion
            Scott Stark Master

            Then either get in the debugger or add some logging and look at what the password is coming back from the db. Break or add logging to the UsernamePasswordLoginModule.validatePassword(String inputPassword, String expectedPassword) method.