Set the FilterSecurityInterceptor property without creating a custom filter

If I understood correctly when I configured Spring Security, an instance of FilterSecurityInterceptor was created automatically. I would like to set the alwaysReauthenticate property to true , but I do not want to create my own FilterSecurityInterceptor filter or configure my own custom filter chain. Is there any way to do this?

Update: May 01, 2012 Based on the comment below, I came up with this code that works as I wish:

public class ForceAuthCheckinator implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (beanName.contains("FilterSecurityInterceptor")) {
            ((FilterSecurityInterceptor bean).setAlwaysReauthenticate(true);
        }
        return bean;
    }
}

Then, in my application context file, I added this single line, which activated the class and connected it to the place:

<bean class="com.mydomain.ForceAuthCheckinator"/>

Thanks for the help.

+3
source share
1 answer

BeanPostProcessor, FilterSecurityInterceptor bean .

+4

All Articles