Example usage for org.springframework.security.config BeanIds SPRING_SECURITY_FILTER_CHAIN

List of usage examples for org.springframework.security.config BeanIds SPRING_SECURITY_FILTER_CHAIN

Introduction

In this page you can find the example usage for org.springframework.security.config BeanIds SPRING_SECURITY_FILTER_CHAIN.

Prototype

String SPRING_SECURITY_FILTER_CHAIN

To view the source code for org.springframework.security.config BeanIds SPRING_SECURITY_FILTER_CHAIN.

Click Source Link

Document

External alias for FilterChainProxy bean, for use in web.xml files

Usage

From source file:com.kabiliravi.kaman.web.KamanApplicationInitializer.java

private void registerSpringSecurityFilterChain(ServletContext servletContext) {
    FilterRegistration.Dynamic springSecurityFilterChain = servletContext
            .addFilter(BeanIds.SPRING_SECURITY_FILTER_CHAIN, new DelegatingFilterProxy());
    springSecurityFilterChain.addMappingForUrlPatterns(null, false, "/*");
}

From source file:org.springframework.security.config.debug.SecurityDebugBeanFactoryPostProcessor.java

public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
    logger.warn("\n\n" + "********************************************************************\n"
            + "**********        Security debugging is enabled.       *************\n"
            + "**********    This may include sensitive information.  *************\n"
            + "**********      Do not use in a production system!     *************\n"
            + "********************************************************************\n\n");
    // SPRING_SECURITY_FILTER_CHAIN does not exist yet since it is an alias that has
    // not been processed, so use FILTER_CHAIN_PROXY
    if (registry.containsBeanDefinition(BeanIds.FILTER_CHAIN_PROXY)) {
        BeanDefinition fcpBeanDef = registry.getBeanDefinition(BeanIds.FILTER_CHAIN_PROXY);
        BeanDefinitionBuilder debugFilterBldr = BeanDefinitionBuilder.genericBeanDefinition(DebugFilter.class);
        debugFilterBldr.addConstructorArgValue(fcpBeanDef);
        // Remove the alias to SPRING_SECURITY_FILTER_CHAIN, so that it does not
        // override the new
        // SPRING_SECURITY_FILTER_CHAIN definition
        registry.removeAlias(BeanIds.SPRING_SECURITY_FILTER_CHAIN);
        registry.registerBeanDefinition(BeanIds.SPRING_SECURITY_FILTER_CHAIN,
                debugFilterBldr.getBeanDefinition());
    }/* w  w  w .  ja va  2 s  .  c o m*/
}

From source file:org.springframework.security.config.http.HttpSecurityBeanDefinitionParser.java

static void registerFilterChainProxyIfNecessary(ParserContext pc, Object source) {
    if (pc.getRegistry().containsBeanDefinition(BeanIds.FILTER_CHAIN_PROXY)) {
        return;/*www  .j  av  a2s .  c  o  m*/
    }
    // Not already registered, so register the list of filter chains and the
    // FilterChainProxy
    BeanDefinition listFactoryBean = new RootBeanDefinition(ListFactoryBean.class);
    listFactoryBean.getPropertyValues().add("sourceList", new ManagedList());
    pc.registerBeanComponent(new BeanComponentDefinition(listFactoryBean, BeanIds.FILTER_CHAINS));

    BeanDefinitionBuilder fcpBldr = BeanDefinitionBuilder.rootBeanDefinition(FilterChainProxy.class);
    fcpBldr.getRawBeanDefinition().setSource(source);
    fcpBldr.addConstructorArgReference(BeanIds.FILTER_CHAINS);
    fcpBldr.addPropertyValue("filterChainValidator", new RootBeanDefinition(DefaultFilterChainValidator.class));
    BeanDefinition fcpBean = fcpBldr.getBeanDefinition();
    pc.registerBeanComponent(new BeanComponentDefinition(fcpBean, BeanIds.FILTER_CHAIN_PROXY));
    pc.getRegistry().registerAlias(BeanIds.FILTER_CHAIN_PROXY, BeanIds.SPRING_SECURITY_FILTER_CHAIN);
}