FilterSecurityInterceptor is now configured through ConfigUtils, rather than by autowiring.
This commit is contained in:
parent
0185dc5a90
commit
685d74d81b
|
@ -8,7 +8,6 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
import org.springframework.core.OrderComparator;
|
import org.springframework.core.OrderComparator;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.security.AccessDecisionManager;
|
|
||||||
import org.springframework.security.AuthenticationManager;
|
import org.springframework.security.AuthenticationManager;
|
||||||
import org.springframework.security.context.HttpSessionContextIntegrationFilter;
|
import org.springframework.security.context.HttpSessionContextIntegrationFilter;
|
||||||
import org.springframework.security.ui.AuthenticationEntryPoint;
|
import org.springframework.security.ui.AuthenticationEntryPoint;
|
||||||
|
@ -31,27 +30,17 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor, Ordered {
|
public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor, Ordered {
|
||||||
private Log logger = LogFactory.getLog(getClass());
|
private Log logger = LogFactory.getLog(getClass());
|
||||||
private AuthenticationManager authManager;
|
|
||||||
|
|
||||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||||
HttpSessionContextIntegrationFilter httpSCIF = (HttpSessionContextIntegrationFilter)
|
|
||||||
beanFactory.getBean(HttpSecurityBeanDefinitionParser.DEFAULT_HTTP_SESSION_FILTER_ID);
|
|
||||||
authManager = ConfigUtils.getAuthenticationManager(beanFactory);
|
|
||||||
|
|
||||||
configureAuthenticationEntryPoint(beanFactory);
|
|
||||||
|
|
||||||
configureFilterSecurityInterceptor(beanFactory);
|
|
||||||
|
|
||||||
configureFilterChain(beanFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void configureFilterSecurityInterceptor(ConfigurableListableBeanFactory beanFactory) {
|
|
||||||
ConfigUtils.registerAccessManagerIfNecessary(beanFactory);
|
ConfigUtils.registerAccessManagerIfNecessary(beanFactory);
|
||||||
|
|
||||||
BeanDefinition securityInterceptor =
|
BeanDefinition securityInterceptor =
|
||||||
beanFactory.getBeanDefinition(HttpSecurityBeanDefinitionParser.DEFAULT_FILTER_SECURITY_INTERCEPTOR_ID);
|
beanFactory.getBeanDefinition(HttpSecurityBeanDefinitionParser.DEFAULT_FILTER_SECURITY_INTERCEPTOR_ID);
|
||||||
|
|
||||||
ConfigUtils.configureSecurityInterceptor(beanFactory, securityInterceptor);
|
ConfigUtils.configureSecurityInterceptor(beanFactory, securityInterceptor);
|
||||||
|
|
||||||
|
configureAuthenticationEntryPoint(beanFactory);
|
||||||
|
|
||||||
|
configureFilterChain(beanFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +52,6 @@ public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor
|
||||||
* <li>throw an exception (for now). TODO: Examine additional beans and types and make decision</li>
|
* <li>throw an exception (for now). TODO: Examine additional beans and types and make decision</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param beanFactory
|
* @param beanFactory
|
||||||
*/
|
*/
|
||||||
private void configureAuthenticationEntryPoint(ConfigurableListableBeanFactory beanFactory) {
|
private void configureAuthenticationEntryPoint(ConfigurableListableBeanFactory beanFactory) {
|
||||||
|
@ -101,9 +89,9 @@ public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor
|
||||||
|
|
||||||
filterMap.put(allUrlsMatch, defaultFilterChain);
|
filterMap.put(allUrlsMatch, defaultFilterChain);
|
||||||
|
|
||||||
filterChainProxy.setFilterChainMap(filterMap);
|
filterChainProxy.setFilterChainMap(filterMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List orderFilters(ConfigurableListableBeanFactory beanFactory) {
|
private List orderFilters(ConfigurableListableBeanFactory beanFactory) {
|
||||||
Map filters = beanFactory.getBeansOfType(Filter.class);
|
Map filters = beanFactory.getBeansOfType(Filter.class);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue