INT-3331: Add ChannelSecurityInterceptorFB

JIRA: https://jira.spring.io/browse/INT-3331

INT-3331: PR comments and others

* Register `ChannelSecurityInterceptorBeanPostProcessor` as a `BeanDefinition` (not `BPP`)
* Get `ChannelSecurityInterceptor`s from `ChannelSecurityInterceptorBeanPostProcessor#afterPropertiesSet()`
* Make `ChannelSecurityInterceptor` `final` to disallow to subclass it for unexpected issues
* Provide more convenience to the `ChannelSecurityInterceptorFactoryBean` - to allow to use it from xml configuration

Doc Polishing
This commit is contained in:
Artem Bilan
2014-03-20 11:58:22 +02:00
committed by Gary Russell
parent 5587d79070
commit e3f8ef534b
12 changed files with 425 additions and 34 deletions

View File

@@ -58,6 +58,38 @@
</programlisting>
</para>
<para>
Starting with <emphasis>version 4.0</emphasis>, the same configuration is available when using
<code>@Configuration</code> classes, by declaring a
<classname>ChannelSecurityInterceptorFactoryBean</classname>. This class delegates all options for
the <classname>ChannelSecurityInterceptor</classname> with a <emphasis>builder</emphasis> pattern:
</para>
<programlisting language="java"><![CDATA[@Configuration
@EnableIntegration
public class ContextConfiguration {
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private AccessDecisionManager accessDecisionManager;
@Bean
public ChannelSecurityInterceptorFactoryBean channelSecurityInterceptor() {
return new ChannelSecurityInterceptorFactoryBean()
.authenticationManager(this.authenticationManager)
.accessDecisionManager(this.accessDecisionManager)
.accessPolicy("admin.*", "ROLE_ADMIN")
.accessPolicy("user.*", null, "ROLE_USER");
}
}]]></programlisting>
<note>
The <classname>@EnableIntegration</classname> annotation is required to provide the Spring Integration
infrastructure (including Security) to the Application Context. In addition this <interfacename>FactoryBean</interfacename>
falls back to <interfacename>AuthenticationManager</interfacename> and <interfacename>AccessDecisionManager</interfacename>
beans with names <code>authenticationManager</code> and <code>accessDecisionManager</code> respectively, if they aren't provided
in the <classname>ChannelSecurityInterceptorFactoryBean</classname> bean definition.
</note>
</section>

View File

@@ -101,6 +101,14 @@
annotation in a <code>@Configuration</code> class. For more information, see <xref linkend="jmx-mbean-exporter"/>.
</para>
</section>
<section id="4.0-channel-security-interceptor">
<title>ChannelSecurityInterceptorFactoryBean</title>
<para>
Configuration of Spring Security for message channels using <code>@Configuration</code> classes is
now supported by using a <classname>ChannelSecurityInterceptorFactoryBean</classname>.
For more information, see <xref linkend="security"/>.
</para>
</section>
</section>
<section id="4.0-general">