3 Replies Latest reply on Jun 24, 2003 5:58 PM by java_architect

    Problem with autentication

    tscondor Newbie

      Hi,
      I have a problem for autenticate the user:
      I have create a db with user name, pwd and role and I configured my jboss (2.4.10 with tomcat 4.0.6) in this mode:

      /conf/catalina/login-config.xml:

      <application-policy name = "es">

      <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
      <module-option name="dsJndiName">java:/defaultDS</module-option>
      <module-option name="pricipalsQuery">select passwd from jboss_users where name=?</module-option>
      <module-option name="rolesQuery">select therole, 'Roles' from jboss_users where name=?</module-option>
      </login-module>

      </application-policy>

      and

      jboss-web.xml

      <security-domain>java:/jaas/es</security-domain>.

      I have attached my login page. When submit user and pwd I receive the error shown in error.txt file.

      What's error? I'm very confused

      Thanks!




        • 1. Re: Problem with autentication
          Harald Gliebe Novice

          Hi,

          JBoss 2.4.10 doesn't support Jaas-Configuration with XML, this was introduced in JBoss 3.0. You have to use the /conf/catalina/auth.conf file to define the desired LoginModule.
          If my Italian is correct, there is an error in line 11 of this file, the controlFlag (Required,Requisite,Sufficient or Optional) for your configuration is missing.

          Could you post the auth.conf file.

          Ciao,
          Harald

          • 2. Re: Problem with autentication
            tscondor Newbie

            Hi Harald,
            this is my auth.conf.

            Thanks!

            • 3. Re: Problem with autentication
              java_architect Newbie

              Not sure if there are other errors, but your SQL is not right.

              > <module-option name="pricipalsQuery">select
              > passwd
              > from jboss_users where name=?</module-option>

              The principalsQuery requires a two column result. The first column is the username, the second is the password. How about:

              SELECT name, passwd FROM jboss_users WHERE name=?

              > <module-option name="rolesQuery">select therole,
              > 'Roles' from jboss_users where
              > name=?</module-option>

              The rolesQuery requires 3 columns: username, role name, role group (should be the value 'Roles')

              I don't have an easy fix for you here. Your table structure needs a bit of help. I use three tables, a username, password mapping table (Auth), a role table (Role) and a join table (Auth_Role). Then, my SQL looks something like:

              SELECT a.username, r.name, r.rolegroup
              FROM Auth a
              inner join Auth_Role ar on a.authId=ar.authId
              inner join Role r on r.roleId=ar.roleId
              WHERE a.username=?

              Hope this helps,
              Dan Cramer
              Dynamic Resolve, LLC

              > Hi,
              > I have a problem for autenticate the user:
              > I have create a db with user name, pwd and role and I
              > configured my jboss (2.4.10 with tomcat 4.0.6) in
              > this mode:
              >
              > /conf/catalina/login-config.xml:
              >
              > <application-policy name = "es">
              >
              > <login-module code =
              > "org.jboss.security.auth.spi.DatabaseServerLoginModule
              > flag = "required">
              > <module-option
              > name="dsJndiName">java:/defaultDS</module-option>
              > <module-option name="pricipalsQuery">select passwd
              > from jboss_users where name=?</module-option>
              > <module-option name="rolesQuery">select therole,
              > 'Roles' from jboss_users where
              > name=?</module-option>
              > </login-module>
              >
              > </application-policy>
              >
              > and
              >
              > jboss-web.xml
              >
              > <security-domain>java:/jaas/es</security-domain>.
              >
              > I have attached my login page. When submit user and
              > pwd I receive the error shown in error.txt file.
              >
              > What's error? I'm very confused
              >
              > Thanks!
              >
              >
              >
              >