Jeffrey
Jeffrey

Reputation: 1118

Spring Security 3 - Multiple Secuirty Filters after First postion

I am using spring 3 and implementing a series of custom filters in the security chain. I need to call a series of already implemented filters after the FIRST position. If I try to list two filters in the same position (after="FIRST") the context fails to load with the error stating that position is already in use and there is a conflict.

How do I implement a series of custom filters to be called after the "FIRST" position?

(I prefer not to refactor the filters because they are pretty detailed)

Upvotes: 0

Views: 300

Answers (1)

amant singh
amant singh

Reputation: 518

If the conflict is between these two filters then you can define a composite filter:

 <bean id="customFilters" class="org.springframework.web.filter.CompositeFilter">
<property name="filters">
    <list>
        <ref bean="customfilter1"/>
        <ref bean="customfilter2"/>
    </list>
</property>

Add it to your filter chain like this:

 <security:http ...>
 <security:custom-filter after="FIRST" ref="customFilters" />
 ....
  </security:http>

Upvotes: 2

Related Questions