Search in sources :

Example 1 with ChannelSecurityMetadataSource

use of org.springframework.integration.security.channel.ChannelSecurityMetadataSource in project spring-integration by spring-projects.

the class ChannelSecurityInterceptorBeanPostProcessor method postProcessBeforeInitialization.

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) {
    if (this.accessPolicyMapping != null && bean instanceof ChannelSecurityInterceptor && this.accessPolicyMapping.containsKey(beanName)) {
        Map<Pattern, ChannelAccessPolicy> accessPolicies = this.accessPolicyMapping.get(beanName);
        ChannelSecurityMetadataSource securityMetadataSource = (ChannelSecurityMetadataSource) ((ChannelSecurityInterceptor) bean).obtainSecurityMetadataSource();
        for (Map.Entry<Pattern, ChannelAccessPolicy> entry : accessPolicies.entrySet()) {
            securityMetadataSource.addPatternMapping(entry.getKey(), entry.getValue());
        }
    }
    return bean;
}
Also used : Pattern(java.util.regex.Pattern) ChannelAccessPolicy(org.springframework.integration.security.channel.ChannelAccessPolicy) ChannelSecurityMetadataSource(org.springframework.integration.security.channel.ChannelSecurityMetadataSource) ChannelSecurityInterceptor(org.springframework.integration.security.channel.ChannelSecurityInterceptor) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 Pattern (java.util.regex.Pattern)1 ChannelAccessPolicy (org.springframework.integration.security.channel.ChannelAccessPolicy)1 ChannelSecurityInterceptor (org.springframework.integration.security.channel.ChannelSecurityInterceptor)1 ChannelSecurityMetadataSource (org.springframework.integration.security.channel.ChannelSecurityMetadataSource)1