I have to exclude one default filter from Spring Security stack. So all filters should work as usual. It seems like I find the way to do so, make custom FilterChainProxy:
public class CustomFilterChainProxy extends FilterChainProxy {
Logger LOGGER = Logger.getLogger(CustomFilterChainProxy.class);
public CustomFilterChainProxy() {
super();
LOGGER.debug("Run custom filter proxy");
LOGGER.debug("String filters: " + this.toString());
}
public CustomFilterChainProxy(SecurityFilterChain chain) {
super(chain);
LOGGER.debug("Run custom filter proxy with chains");
}
}
As you see it have constructor which get list of filters, so I will be able to delete one filter from chain as I need and all the rest will work as usual. But I can`t make bean in security config for such constructor. If I use
<bean id="filterChainProxy" class="com.pkg.CustomFilterChainProxy">
it, of course build object with default constructor. Ok, I try to make bean with list of some filters:
<bean id="filterChainProxy" class="ru.olekstra.backoffice.util.CustomFilterChainProxy">
<constructor-arg>
<list>
<sec:filter-chain pattern="/**"
filters="BasicUserApprovalFilter" />
</list>
</constructor-arg>
</bean>
But this wont compile, cause BasicUserApprovalFilter is unknown bean. So how could I exclude one filter from default filter stack? If my way with custom filter chain proxy is good decision, so how create bean with default filter chain?