6 Replies Latest reply on Oct 20, 2005 5:01 AM by jeff_porter

    Help please - Simple example of JASS/JBoss DatabaseServerLog

    jeff_porter


      I'm going around in circles at the moment and am in need on someone to point me in the right direction.

      I've read the DVD TrailBlazer.
      I've read the Forum "Read this first"
      I've searched google, forums and other sites.

      I'm trying to setup a DatabaseServerLoginModule with users/roles for the webpages of my app.

      I'm using Hibernate & myFaces. (Not EJB3.0)

      Can some give me an example of what I need todo or point me in the direction of a good tutorial. All I can get is a login page that doesnt accept my user/pass. (no debug statements)

      Thank you
      Jeff - in need of help - porter

        • 1. Re: Help please - Simple example of JASS/JBoss DatabaseServe
          jeff_porter

          ok this is what I have - which results in login-failed.jsp being displayed.
          I've insert the debug level xml into conf/log4j.xml No loggin information is displayed on the console though.

          Does anyone have any ideas? please. I'm starting to get desprate.

          Jboss 4.0.2
          MySQL 4.1
          Firefox 1.07
          myFaces 1.01


          Tables....

          principals
          id principalID password
          1 csr csr
          
          roles
          id principalID roleGroup role
          1 csr users user
          



          login-config.xml
          <application-policy name = "dvd">
           <authentication>
           <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
           <module-option name = "unauthenticatedIdentity">guest</module-option>
           <module-option name = "dsJndiName">java:/MyDatabaseDS</module-option>
           <module-option name = "principalsQuery">select Password from Principals where PrincipalID=?</module-option>
           <module-option name = "rolesQuery">select role, 'Roles' from Roles where principalID=?</module-option>
           </login-module>
           </authentication>
          </application-policy>
          



          jboss-web.xml
          <security-domain>java:/jaas/dvd</security-domain>
          


          web-security.xml
          <security-constraint>
           <web-resource-collection>
           <web-resource-name>internal application</web-resource-name>
           <url-pattern>/taskList.jsf</url-pattern>
           </web-resource-collection>
           <auth-constraint>
           <role-name>user</role-name>
           </auth-constraint>
          </security-constraint>
          
          <security-role>
           <description>The role required to access restricted content</description>
           <role-name>user</role-name>
          </security-role>
          
          <login-config>
           <auth-method>FORM</auth-method>
           <realm-name>DVD Store</realm-name>
           <form-login-config>
           <form-login-page>/login.jsf</form-login-page>
           <form-error-page>/loginfailed.html</form-error-page>
           </form-login-config>
          </login-config>
          



          login.jsp
          <form action="j_security_check" method="post">
           <h:outputText value="loginUser" />
           <input type="text" name="j_username" value="<h:outputText value="randomUser" />" size="16" maxlength="24" />
           <h:outputText value="loginPass}" />
           <input type="password" name="j_password" value="<h:outputText value="#password" />" size="16" maxlength="24" />
           <input type="submit" value="<h:outputText value="loginPrompt" />"/>
          </form>


          • 2. Re: Help please - Simple example of JASS/JBoss DatabaseServe
            jeff_porter

            Extra logging obtained...

            15:51:41,577 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
            15:51:41,592 DEBUG [Log4jService] Installed System.out adapter
            15:51:41,592 DEBUG [Log4jService] Installed System.err adapter
            15:51:41,592 DEBUG [ManagerBase] Start expire sessions StandardManager at 1129733501592 sessioncount 0
            15:51:41,592 DEBUG [ManagerBase] End expire sessions StandardManager processingTime 0 expired sessions: 0
            15:51:41,592 DEBUG [ManagerBase] Start expire sessions StandardManager at 1129733501592 sessioncount 0
            15:51:41,592 DEBUG [ManagerBase] End expire sessions StandardManager processingTime 0 expired sessions: 0
            15:51:50,545 DEBUG [CoyoteAdapter] Requested cookie session id is FE22B499705485ADE6644A1CE4982B86
            15:51:50,545 DEBUG [AuthenticatorBase] Security checking request POST /ebusiness/j_security_check
            15:51:50,561 DEBUG [FormAuthenticator] Authenticating username 'csr'
            15:51:50,577 DEBUG [ApplicationDispatcher] servletPath=/loginfailed.html, pathInfo=null, queryString=null, name=null
            15:51:50,577 DEBUG [ApplicationDispatcher] Path Based Forward
            15:51:50,577 DEBUG [StandardWrapper] Returning non-STM instance
            15:51:50,577 DEBUG [ApplicationDispatcher] Disabling the response for futher output
            15:51:50,577 DEBUG [AuthenticatorBase] Failed authenticate() test ??/ebusiness/j_security_check
            15:51:50,655 DEBUG [CoyoteAdapter] Requested cookie session id is FE22B499705485ADE6644A1CE4982B86
            15:51:50,655 DEBUG [StandardWrapper] Returning non-STM instance


            The interesting bit is...

            Failed authenticate() test ??/ebusiness/j_security_check


            I logged in with "csr" & "csr", so what is "test" ???


            • 3. Re: Help please - Simple example of JASS/JBoss DatabaseServe
              elkner

              perhaps log4j.xml:

              <category name="org.jboss.security">
               <!-- priority value="TRACE" class="org.jboss.logging.XLevel"/-->
               <priority value="DEBUG"/>
               </category>


              gives you a little bit more information ...

              • 4. Re: Help please - Simple example of JASS/JBoss DatabaseServe
                jeff_porter

                Hi Elkner,

                I've increased the logging, and this is what I get...



                17:06:26,286 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
                17:06:26,286 DEBUG [RealmBase] User data constraint has no restrictions
                17:06:26,286 DEBUG [AuthenticatorBase] Calling authenticate()
                17:06:26,286 DEBUG [FormAuthenticator] Save request in session '79AB6CF3BE361B73E42788DAD07094E8'
                17:06:26,302 DEBUG [ApplicationDispatcher] servletPath=/login.jsf, pathInfo=null, queryString=null, name=null
                17:06:26,302 DEBUG [ApplicationDispatcher] Path Based Forward
                17:06:26,302 DEBUG [StandardWrapper] Returning non-STM instance
                17:06:26,302 DEBUG [ApplicationDispatcher] servletPath=/login.jsp, pathInfo=null, queryString=null, name=null
                17:06:26,302 DEBUG [ApplicationDispatcher] Path Based Forward
                17:06:26,302 DEBUG [StandardWrapper] Returning non-STM instance
                17:06:26,317 DEBUG [ApplicationDispatcher] Disabling the response for futher output
                17:06:26,317 DEBUG [ApplicationDispatcher] Disabling the response for futher output
                17:06:26,317 DEBUG [AuthenticatorBase] Failed authenticate() test
                17:06:31,692 DEBUG [CoyoteAdapter] Requested cookie session id is 79AB6CF3BE361B73E42788DAD07094E8
                17:06:31,692 DEBUG [AuthenticatorBase] Security checking request POST /ebusiness/j_security_check
                17:06:31,708 DEBUG [FormAuthenticator] Authenticating username 'csr'
                17:06:31,708 DEBUG [ApplicationDispatcher] servletPath=/loginfailed.html, pathInfo=null, queryString=null, name=null
                17:06:31,708 DEBUG [ApplicationDispatcher] Path Based Forward
                17:06:31,723 DEBUG [StandardWrapper] Returning non-STM instance
                17:06:31,723 DEBUG [ApplicationDispatcher] Disabling the response for futher output
                17:06:31,723 DEBUG [AuthenticatorBase] Failed authenticate() test ??/ebusiness/j_security_check
                17:06:31,786 DEBUG [CoyoteAdapter] Requested cookie session id is 79AB6CF3BE361B73E42788DAD07094E8
                17:06:31,786 DEBUG [StandardWrapper] Returning non-STM instance



                Again, I see references to "test", I'm still not sure what it is.

                I really am desperate, any help at all would be great.

                Thanks
                Jeff

                • 5. Re: Help please - Simple example of JASS/JBoss DatabaseServe
                  jeff_porter

                  full log stack...

                  17:18:52,531 DEBUG [ManagerBase] Start expire sessions StandardManager at 1129738732531 sessioncount 0
                  17:18:52,531 DEBUG [ManagerBase] End expire sessions StandardManager processingTime 0 expired sessions: 0
                  17:18:55,141 DEBUG [CoyoteAdapter] Requested cookie session id is 79AB6CF3BE361B73E42788DAD07094E8
                  17:18:55,141 DEBUG [AuthenticatorBase] Security checking request POST /ebusiness/j_security_check
                  17:18:55,156 DEBUG [FormAuthenticator] Authenticating username 'csr'
                  17:18:55,156 DEBUG [WebappClassLoader] loadClass(org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFactory
                  , false)
                  17:18:55,156 DEBUG [WebappClassLoader] Searching local repositories
                  17:18:55,156 DEBUG [WebappClassLoader] findClass(org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomainObjectFac
                  tory)
                  17:18:55,156 DEBUG [WebappClassLoader] findClassInternal(org.jboss.security.plugins.JaasSecurityManagerService$SecurityDomai
                  nObjectFactory)
                  17:18:55,156 DEBUG [WebappClassLoader] --> Passing on ClassNotFoundException
                  17:18:55,156 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@f91c8f
                  17:18:55,156 DEBUG [WebappClassLoader] Loading class from parent
                  17:18:55,156 DEBUG [WebappClassLoader] loadClass(javax.naming.Context, false)
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(java.lang.reflect.Proxy, false)
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(javax.naming.NamingException, false)
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(java.lang.reflect.UndeclaredThrowableException, false)
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(java.lang.NoSuchMethodError, false)
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(java.lang.reflect.InvocationHandler, false)
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(javax.naming.Name, false)
                  17:18:55,203 DEBUG [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@36ef21
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(org.jboss.security.plugins.JaasSecurityManagerService$DefaultCacheObjectFactory,
                  false)
                  17:18:55,203 DEBUG [WebappClassLoader] Searching local repositories
                  17:18:55,203 DEBUG [WebappClassLoader] findClass(org.jboss.security.plugins.JaasSecurityManagerService$DefaultCacheObjectFacto
                  ry)
                  17:18:55,203 DEBUG [WebappClassLoader] findClassInternal(org.jboss.security.plugins.JaasSecurityManagerService$DefaultCacheO
                  bjectFactory)
                  17:18:55,203 DEBUG [WebappClassLoader] --> Passing on ClassNotFoundException
                  17:18:55,203 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@f91c8f
                  17:18:55,203 DEBUG [WebappClassLoader] Loading class from parent
                  17:18:55,203 DEBUG [dvd] CachePolicy set to: org.jboss.util.TimedCachePolicy@8d9b22
                  17:18:55,203 DEBUG [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@8d9b22
                  17:18:55,203 DEBUG [JaasSecurityManagerService] Added dvd, org.jboss.security.plugins.SecurityDomainContext@c3f750 to map
                  17:18:55,203 DEBUG [WebappClassLoader] loadClass(org.jboss.security.auth.spi.DatabaseServerLoginModule, false)
                  17:18:55,203 DEBUG [WebappClassLoader] Searching local repositories
                  17:18:55,203 DEBUG [WebappClassLoader] findClass(org.jboss.security.auth.spi.DatabaseServerLoginModule)
                  17:18:55,203 DEBUG [WebappClassLoader] findClassInternal(org.jboss.security.auth.spi.DatabaseServerLoginModule)
                  17:18:55,203 DEBUG [WebappClassLoader] --> Passing on ClassNotFoundException
                  17:18:55,203 DEBUG [WebappClassLoader] Delegating to parent classloader at end: java.net.FactoryURLClassLoader@f91c8f
                  17:18:55,219 DEBUG [WebappClassLoader] Loading class from parent
                  17:18:55,219 DEBUG [ApplicationDispatcher] servletPath=/loginfailed.html, pathInfo=null, queryString=null, name=null
                  17:18:55,219 DEBUG [ApplicationDispatcher] Path Based Forward
                  17:18:55,219 DEBUG [StandardWrapper] Returning non-STM instance
                  17:18:55,219 DEBUG [ApplicationDispatcher] Disabling the response for futher output
                  17:18:55,219 DEBUG [AuthenticatorBase] Failed authenticate() test ??/ebusiness/j_security_check
                  17:18:55,281 DEBUG [CoyoteAdapter] Requested cookie session id is 79AB6CF3BE361B73E42788DAD07094E8
                  17:18:55,281 DEBUG [StandardWrapper] Returning non-STM instance
                  17:19:02,531 DEBUG [ManagerBase] Start expire sessions StandardManager at 1129738742531 sessioncount 0
                  


                  • 6. Re: Help please - Simple example of JASS/JBoss DatabaseServe
                    jeff_porter


                    SOLVED!!


                    The issue was that the login.conf had the line...


                    <module-option name = "dsJndiName">java:/MyDatabaseDS</module-option>


                    It should of been

                    <module-option name = "dsJndiName">java:/MySQLProject1DS</module-option>



                    Yep, I'd copied and pasted the code in, and at some point not changed the Jndi name to match the contents of mysql.ds.

                    Feel a much happier man now!