receiving null for j_username when using FormAuthValue
awclemen Jun 20, 2006 8:33 PMHello Forum Folks,
I'm trying to retrieve the j_username value from the session after a user SUCCESSFULLY logs in. I have the form authenticator setup and the user is able to log in correctly, however, I am getting null for the j_username value. I'm probably missing some small detail somewhere.
in the context.xml of the applicaiton, I have the following:
<Context> <Valve className="org.apache.catalina.authenticator.FormAuthenticator" disableProxyCaching="false" /> <Valve className="org.jboss.web.tomcat.security.FormAuthValve" includePassword="false" /> </Context>
I'm able to see the FormAuthValue listed in the valveObjectNames under the JMX Mbean View - so I know it is being loaded. Also, I'm getting feedback in the logs from it's behavior. Here is a snippet from the logs:
2006-06-20 17:17:20,669 DEBUG [org.apache.catalina.realm.RealmBase] Username 12345678 has role subcontractor 2006-06-20 17:17:20,669 TRACE [org.jboss.web.tomcat.security.JBossSecurityMgrRealm] No role found: subcontractor 2006-06-20 17:17:20,669 DEBUG [org.apache.catalina.authenticator.AuthenticatorBase] Successfully passed all security constraints 2006-06-20 17:17:20,669 TRACE [org.jboss.web.tomcat.security.FormAuthValve] Enter, j_username=null 2006-06-20 17:17:20,669 TRACE [org.jboss.web.tomcat.security.SecurityAssociationValve] Begin invoke, callerGenericPrincipal[12345678(subcontractor,)]
and this as well:
2006-06-20 17:17:21,407 TRACE [org.jboss.web.tomcat.security.RunAsListener] jsp, runAs: null 2006-06-20 17:17:21,407 TRACE [org.jboss.web.tomcat.security.RunAsListener] jsp, runAs: null 2006-06-20 17:17:21,407 TRACE [org.jboss.security.SecurityAssociation] popRunAsIdentity, runAs=null 2006-06-20 17:17:21,407 TRACE [org.jboss.web.tomcat.security.SecurityAssociationValve] End invoke, callerGenericPrincipal[12345678(subcontractor,)] 2006-06-20 17:17:21,407 TRACE [org.jboss.web.tomcat.security.FormAuthValve] SessionID: mWGFptpNKjrU1uHatsb47g** 2006-06-20 17:17:21,407 TRACE [org.jboss.web.tomcat.security.FormAuthValve] SecurityAssociation.exception: null 2006-06-20 17:17:21,407 TRACE [org.jboss.web.tomcat.security.FormAuthValve] Exit, username: null 2006-06-20 17:17:21,407 TRACE [org.jboss.security.SecurityAssociation] clear, server=true
You can see that the j_username is null, for some reason.
Placing this in the jsp gives me null as well:
<% String username = (String) session.getAttribute("j_username"); %> <p>Username: <%=username%></p>
I've read through the wiki that was presented in the FAQ, butI'm not sure what I am missing....
Any ideas?
thanks in advance!
--Andy