Hi, I was able to login with UsersRolesLoginModule using properties files. However, when trying to use DatabaseServerLoginModule, the login fail with:
| javax.security.auth.login.LoginException: java.lang.NullPointerException | at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword here is the server.log: 13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] REQUEST URI =/ENETEmployer/j_security_check | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] authType=null | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] characterEncoding=null | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentLength=55 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentType=application/x-www-form-urlencoded | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contextPath=/ENETEmployer | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] cookie=JSESSIONID=F649DD73DB967F2CDFAFC86E5A67A7BC | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=referer=https://localhost:8447/ENETEmployer/ | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept-language=en-ca,fr-ca;q=0.8,fr;q=0.6,en-us;q=0.4,he;q=0.2 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=content-type=application/x-www-form-urlencoded | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=accept-encoding=gzip, deflate | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=user-agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=host=localhost:8447 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=content-length=55 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=connection=Keep-Alive | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=cache-control=no-cache | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=cookie=JSESSIONID=F649DD73DB967F2CDFAFC86E5A67A7BC | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] locale=en_CA | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] method=POST | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] parameter=j_username=user1 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] parameter=j_password=1 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] parameter=form1:logonButton=Login | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] pathInfo=null | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] protocol=HTTP/1.1 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] queryString=null | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteAddr=127.0.0.1 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteHost=127.0.0.1 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteUser=null | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] requestedSessionId=F649DD73DB967F2CDFAFC86E5A67A7BC | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] scheme=https | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] serverName=localhost | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] serverPort=8447 | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] servletPath=/j_security_check | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] isSecure=true | 2006-06-13 08:55:15,427 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] --------------------------------------------------------------- | 2006-06-13 08:55:15,427 DEBUG [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] Process request for '/ENETEmployer/j_security_check' | 2006-06-13 08:55:15,427 DEBUG [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] Checking for SSO cookie | 2006-06-13 08:55:15,427 DEBUG [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] SSO cookie is not present | 2006-06-13 08:55:15,427 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] Security checking request POST /ENETEmployer/j_security_check | 2006-06-13 08:55:15,427 DEBUG [org.apache.catalina.authenticator.FormAuthenticator] Authenticating username 'user1' | 2006-06-13 08:55:15,427 TRACE [org.jboss.web.tomcat.security.JBossSecurityMgrRealm] Begin authenticate, username=user1 | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.plugins.JaasSecurityManager.enetemployer] Begin isValid, principal:user1, cache info: null | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.plugins.JaasSecurityManager.enetemployer] defaultLogin, principal=user1 | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] Begin getAppConfigurationEntry(enetemployer), size=9 | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.login.XMLLoginConfigImpl] End getAppConfigurationEntry(enetemployer), authInfo=AppConfigurationEntry[]: | [0] | LoginModule Class: org.jboss.security.auth.spi.DatabaseServerLoginModule | ControlFlag: LoginModuleControlFlag: required | Options:name=rolesQuery, value=select userRoles, 'Roles' from UserRoles where username=? | name=principalsQuery, value=select passwd from Users username where username=? | name=dsJndiName, value=java:/MySqlDS | | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] initialize, [EMAIL PROTECTED] | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] DatabaseServerLoginModule, dsJndiName=java:/MySqlDS | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] principalsQuery=select passwd from Users username where username=? | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] rolesQuery=select userRoles, 'Roles' from UserRoles where username=? | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendResume=true | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] login | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] suspendAnyTransaction | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] resumeAnyTransaction | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.auth.spi.DatabaseServerLoginModule] abort | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.plugins.JaasSecurityManager.enetemployer] Login failure | javax.security.auth.login.LoginException: java.lang.NullPointerException | at org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:141) | at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:585) | at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769) | at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) | at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) | at java.security.AccessController.doPrivileged(Native Method) | at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) | at javax.security.auth.login.LoginContext.login(LoginContext.java:579) | at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601) | at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535) | at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344) | at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491) | at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:257) | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416) | at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) | at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392) | at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495) | at org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:150) | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) | at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) | at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) | at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) | at java.lang.Thread.run(Thread.java:595) | | at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872) | at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) | at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) | at java.security.AccessController.doPrivileged(Native Method) | at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) | at javax.security.auth.login.LoginContext.login(LoginContext.java:579) | at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601) | at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535) | at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344) | at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491) | at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:257) | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416) | at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) | at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392) | at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495) | at org.apache.catalina.valves.RequestDumperValve.invoke(RequestDumperValve.java:150) | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) | at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) | at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) | at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) | at java.lang.Thread.run(Thread.java:595) | 2006-06-13 08:55:15,427 TRACE [org.jboss.security.plugins.JaasSecurityManager.enetemployer] End isValid, false | 2006-06-13 08:55:15,427 TRACE [org.jboss.web.tomcat.security.JBossSecurityMgrRealm] User: user1 is NOT authenticated | 2006-06-13 08:55:15,427 TRACE [org.jboss.web.tomcat.security.JBossSecurityMgrRealm] End authenticate, principal=null | 2006-06-13 08:55:15,443 DEBUG [org.apache.catalina.core.ApplicationDispatcher] servletPath=/eNETLoginError.html, pathInfo=null, queryString=null, name=null | 2006-06-13 08:55:15,443 DEBUG [org.apache.catalina.core.ApplicationDispatcher] Path Based Forward | 2006-06-13 08:55:15,443 TRACE [org.jboss.web.tomcat.security.RunAsListener] default, runAs: null | 2006-06-13 08:55:15,443 TRACE [org.jboss.web.tomcat.security.RunAsListener] default, runAs: null | 2006-06-13 08:55:15,443 TRACE [org.jboss.web.tomcat.security.RunAsListener] default, runAs: null | 2006-06-13 08:55:15,443 TRACE [org.jboss.web.tomcat.security.RunAsListener] default, runAs: null | 2006-06-13 08:55:15,443 DEBUG [org.apache.catalina.core.ApplicationDispatcher] Disabling the response for futher output | 2006-06-13 08:55:15,443 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] Failed authenticate() test ??/ENETEmployer/j_security_check | 2006-06-13 08:55:15,443 TRACE [org.jboss.security.SecurityAssociation] clear, server=true | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] --------------------------------------------------------------- | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] authType=null | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentLength=6425 | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] contentType=text/html | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=ETag=W/"6425-1150128244000" | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] header=Last-Modified=Mon, 12 Jun 2006 16:04:04 GMT | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] message=null | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] remoteUser=null | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] status=200 | 2006-06-13 08:55:15,443 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost]] =============================================================== I am using MySql database. I added and updated the mysql-ds.xml and configured the login config.xml: <application-policy name = "enetemployer"> | <authentication> | <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" | flag = "required"> | <module-option name="dsJndiName">java:/MySqlDS</module-option> | <module-option name="principalsQuery">select passwd from Users username where username=?</module-option> | <module-option name="rolesQuery">select userRoles, 'Roles' from UserRoles where username=?</module-option> | </login-module> | <!--login-module -- this one works: code="org.jboss.security.auth.spi.UsersRolesLoginModule" | flag = "required"> | <module-option name="usersProperties">props/enetemployer-users.properties</module-option> | <module-option name="rolesProperties">props/enetemployer-roles.properties</module-option> | </login-module--> | <!--login-module code="org.jboss.security.ClientLoginModule" | flag = "required"/--> | </authentication> | </application-policy> I am getting the same result for users that exist or dont exist in the database. Please help if you can. Thanks, TEFRON View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950669#3950669 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950669 _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
