Skip to content

PayloadValidatingInterceptor errors not clearing SecurityContextHolder [SWS-708] #802

@gregturn

Description

@gregturn

Harshi opened SWS-708 and commented

I have Validtion Interecptor first and SecurityInterceptor Later in the sequence.

When response has validation errors some how SecurityConextHolder has old previous authenticated user Information.

When there are NO response validation errors SecurityContextHolder is clean.

I am guessing that when PayloadValidatingInterceptor has errors which is causing not to clean up thread local ?

Once the request is complete all thread context should be nulled out and give back to pool. It does that there are no reponse validation errors but doesn't do that when there are response validation errors. I tried to debug the code , all the way to MessageDispatcherServlet but didn't find any clue.

Here is my configuration

<sws:interceptors>


        <bean id="wsSecurityInterceptor" class="com.mycompancy.MyXwsSecurityInterceptor">
            
            <property name="secureResponse" value="false"/>
            <property name="policyConfiguration"
                      value="/WEB-INF/spring/securityPolicy.xml"/>
            <property name="callbackHandlers">
                <list>
                    <bean class="com.mycompancy.security.MySpringDigestPasswordValidationCallbackHandler">
                        <property name="userDetailsService" ref="securityService"/>
                        <property name="userCache" ref="userCache"/>
                    </bean>
                </list>
            </property>
        </bean>


        <bean class="com.mycompancy.util.MyLoggingInterceptor"/>
        <bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor"
              p:validateRequest="true" p:validateResponse="true">
            <property name="schemas">
                <list>
                    <value>/WEB-INF/schema/customer.xsd</value>
                    <value>/WEB-INF/schema/users.xsd</value>
                    <value>/WEB-INF/schema/userDetails.xsd</value>
                </list>
            </property>
        </bean>
    </sws:interceptors>

Affects: 2.0 GA

Reference URL: http://forum.springsource.org/showthread.php?108650-PayloadValidatingInterceptor-error-not-clearing-SecurityContextHolder&p=360306

Attachments:

Referenced from: commits 078c390, 95ac668

Backported to: 1.5.10

Metadata

Metadata

Assignees

Labels

status: back-portAn issue tracking the back-port of a change made in an later branchtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions