Mantis - Resin
Viewing Issue Advanced Details
469 minor always 11-30-05 10:56 01-26-06 19:31
ferg  
ferg  
high  
closed  
fixed  
none    
none 3.0.18  
0000469: Container-Managed security nullpointer
(rep by Shane Cruz)

When recently switching to container-managed security (and FORM-based authentication) in Resin Pro 3.0.14 we noticed what appears to be a bug in Resin that results in a NullPointerException being thrown. The error occurs in the following scenario:
 
Web Application Name: bo20
 
Security Constraints (specified in web.xml):
 
      <security-constraint>
            <web-resource-collection>
                  <web-resource-name>BrokerOfficeApp</web-resource-name>
                  <description>Broker Office Web Application</description>
                  <url-pattern>/app/*</url-pattern>
            </web-resource-collection>
 
            <auth-constraint>
                  <role-name>BROKER_OFFICE</role-name>
            </auth-constraint>
 
            <user-data-constraint>
                  <transport-guarantee>NONE</transport-guarantee>
            </user-data-constraint>
      </security-constraint>
 
      <login-config>
 
            <auth-method>FORM</auth-method>
 
            <form-login-config>
                  <form-login-page>/login.do</form-login-page>
                  <form-error-page>/loginError.do</form-error-page>
            </form-login-config>
 
      </login-config>
 
To get the NPE, the client browser requests a secure page (e.g., /bo20/app/home.do). Resin correctly redirects the request to the login.do page that contains the j_security_check form. Once authenticated, the user is properly redirected to /bo20/app/home.do. Up until this point, everything is working fine. The problem occurs when the user clicks on any link from the main page and then clicks the back button. When this happens, Resin throws a NullPointerException because the client request is for /bo20/app/j_security_check.
 
Shouldn’t Resin be doing a redirect after the container authentication so the back button does not attempt to load the j_security_check page? Is there some way for us to work around this that I am not aware of?
 
We also noticed that if an unauthenticated user requests a secure page and then sits on the login screen until the session times out, a successful login will also cause a NPE. I am guessing this is because Resin is storing the user-requested URL in the session. Shouldn’t Resin also be handling this scenario so a NPE does not occur?
 

Notes
(0000494)
ferg   
11-30-05 10:57   
java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:336)
at com.caucho.server.security.XmlAuthenticator.loginImpl(XmlAuthenticator.java:138)
at com.caucho.server.security.AbstractAuthenticator.login(AbstractAuthenticator.java:206)
at com.caucho.server.security.AuthenticatorList.login(AuthenticatorList.java:103)
at com.caucho.server.security.FormLoginServlet.service(FormLoginServlet.java:76)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
at com.caucho.server.webapp.NamedDispatcherImpl.forward(NamedDispatcherImpl.java:119)
at com.caucho.server.dispatch.ForwardFilterChain.doFilter(ForwardFilterChain.java:74)
at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:135)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:209)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
at java.lang.Thread.run(Thread.java:595)
(0000799)
ferg   
01-26-06 19:31   
server/12h4