Announcement Announcement Module
No announcement yet.
Webapp configured with error-page seems to lose security after error on Tomcat Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webapp configured with error-page seems to lose security after error on Tomcat

    I've run into a container issue (Tomcat vs Jetty) ...

    I've got a spring security configured app running. The web.xml configures error pages for 404, 403, 500 to map to controller references within the security configured area. The controllers simply render a tiles based error view.

    The tiles based view contains the standard application menu we've created.

    Under Jetty, if the user then clicks a link within that menu (which keeps them within the secured context) they are brought to the appropriate page.

    Under tomcat however, the spring-security filter-chain kicks in and forces a re-authentication ... this unfortunately seems to trash all kinds of things in the session. As a result our app becomes unusable under Tomcat.

    Has anyone seen this behavior or has any pointers on how to possibly diagnose what's going on?


  • #2
    Editing my post:

    After further evaluation, I am struggling with the same exact problem. If the first auth fails, the custom error page gets forwarded, Spring Sec intercepts and tries to reauth. And so on. It does not notice that auth has already failed. I cannot tell it's whether Tomcat or Spring Security. But since Spring Security performs auth, it must be the source of error.

    I was able to reproduce this with the default basic filter with a LdapBindAuthenticator. I have found a resembling thread but with no real solution for that problem.

    Here is my config:

    I am on Tomcat 6.0.35, Spring Security 3.1.2, Spring 3.1.2

    	<dispatcher>ERROR</dispatcher> <!-- This is necessary otherwise the security context won't be available on that pages -->
    <!-- error pages -->
    A controller handles all /errors/* requests.

    <beans:bean id="securityContextPersistenceFilter"
    		class="" />
    <security:http pattern="/ext-resources/**" security="none" />
    <security:http pattern="/resources/**" security="none" />
    <security:http use-expressions="true" realm="My Application">
    			access="hasRole('User')" />
    			access="hasRole('Admin')" />
    		<security:logout invalidate-session="true" delete-cookies="JSESSIONID"
    			logout-url="/logout" logout-success-url="/logout-success" />
    		<security:http-basic />
    <!-- followed by the LDAP configuration -->
    If you remove the custom error pages, Tomcat's error report valve works as expected.

    So, what can we do here? Is there an error in our logic?

    <security:http pattern="/errors/401" security="none" />
    may here for this page but what about 500? This page cannot be set to none. I'd like to retain the security there while displaying the occured error.
    Last edited by Michael-O; Sep 14th, 2012, 04:36 AM.


    • #3
      That is more or less the behavior that I'm seeing under Tomcat. Jetty 8.x doesn't seem to exhibit the behavior so it must be some interaction with Tomcat that may be unintended. Judging by some of the quirks I've seen with Tomcat in the last month or so I'm assuming Tomcat is doing something wonky.


      • #4
        This actually not a Tomcat problem. This is a common problem with the filter archtecture. I have filed an issue already