Some of injected propertiea are uninitialized during login process.
-------------------------------------------------------------------
Key: AS7-2447
URL:
https://issues.jboss.org/browse/AS7-2447
Project: Application Server 7
Issue Type: Bug
Components: CDI / Weld, JSF, Security
Affects Versions: 7.0.2.Final
Environment: Windows XP SP3, JDK1.6.0.20, PostgreSQL JDBC Driver -
postgresql-9.0-801.jdbc4.jar,
Reporter: Alexander Mitenko
Assignee: Stuart Douglas
My Security realm description:
<security-domain name="Database">
<authentication>
<login-module code="Database"
flag="required">
<module-option name="dsJndiName"
value="jdbc/NFCS"/>
<module-option name="principalsQuery"
value="select password from users where username=?"/>
<module-option name="rolesQuery"
value="select r.name as role, 'Roles' as roleGroup from user_roles as ur join
users as u on u.id=ur.user_id join roles as r on r.id=ur.role_id where
username=?"/>
</login-module>
</authentication>
</security-domain>
Code, where exception raised:
@ManagedBean
@SessionScoped
public class LoginBean implements Serializable {
...
public String validate() throws ServletException {
HttpServletRequest request = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
try {
if (request.getUserPrincipal() == null) {
request.login(this.login, this.password); // <-- here
}
Exception:
16:20:34,910 ERROR [org.jboss.security.authentication.JBossCachedAuthenticationManager]
(http--127.0.0.1-8080-1) Login failure: javax.security.auth.login.LoginException:
java.lang.IllegalStateException
at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47)
at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:116)
at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:43)
at org.jboss.msc.service.ServiceControllerImpl.getValue(ServiceControllerImpl.java:1216)
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:111)
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:73)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:173)
at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:47)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:209)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.jboss.security.auth.spi.DatabaseServerLoginModule.getUsersPassword(DatabaseServerLoginModule.java:173)
at
org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:245)
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:597)
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.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:411)
at
org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:345)
at
org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:154)
at org.jboss.as.web.security.JBossWebRealm.authenticate(JBossWebRealm.java:127)
at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:315)
at org.apache.catalina.connector.Request.login(Request.java:3242)
at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1082)
at nfcs.web.LoginBean.validate(LoginBean.java:56)
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:597)
at org.apache.el.parser.AstValue.invoke(AstValue.java:196)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:388)
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
at
org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
at java.lang.Thread.run(Thread.java:619)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:872) [:1.6.0_20]
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [:1.6.0_20]
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [:1.6.0_20]
at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_20]
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [:1.6.0_20]
at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [:1.6.0_20]
at
org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:411)
[picketbox-infinispan-4.0.1.jar:4.0.1]
at
org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:345)
[picketbox-infinispan-4.0.1.jar:4.0.1]
at
org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:154)
[picketbox-infinispan-4.0.1.jar:4.0.1]
at org.jboss.as.web.security.JBossWebRealm.authenticate(JBossWebRealm.java:127)
[jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.apache.catalina.authenticator.AuthenticatorBase.login(AuthenticatorBase.java:315)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.connector.Request.login(Request.java:3242)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.connector.RequestFacade.login(RequestFacade.java:1082)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at nfcs.web.LoginBean.validate(LoginBean.java:56) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[:1.6.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[:1.6.0_20]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_20]
at org.apache.el.parser.AstValue.invoke(AstValue.java:196)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
[jsf-impl-2.1.3-b02-jbossorg-2.jar:2.1.3-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
[jboss-jsf-api_2.1_spec-2.0.0.Beta1.jar:2.0.0.Beta1]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
[jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:388)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
[jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at
org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
[jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
[jbossweb-7.0.1.Final.jar:7.0.2.Final]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_20]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira