Ensure Unique Names

Issue: gh-4394
This commit is contained in:
Rob Winch 2017-06-14 16:02:16 -05:00
parent fda0220fad
commit 9d19b7337e
2 changed files with 9 additions and 3 deletions

View File

@ -38,6 +38,9 @@ import static org.springframework.security.config.web.server.HttpSecurity.http;
* @since 5.0
*/
public class HttpSecurityConfiguration implements WebFluxConfigurer {
private static final String BEAN_NAME_PREFIX = "org.springframework.security.config.annotation.web.reactive.HttpSecurityConfiguration.";
private static final String HTTPSECURITY_BEAN_NAME = BEAN_NAME_PREFIX + "httpSecurity";
@Autowired(required = false)
private ReactiveAdapterRegistry adapterRegistry = new ReactiveAdapterRegistry();
@ -57,7 +60,7 @@ public class HttpSecurityConfiguration implements WebFluxConfigurer {
return new AuthenticationPrincipalArgumentResolver(adapterRegistry);
}
@Bean
@Bean(HTTPSECURITY_BEAN_NAME)
@Scope("prototype")
public HttpSecurity httpSecurity() {
HttpSecurity http = http();

View File

@ -36,6 +36,9 @@ import java.util.List;
*/
@Configuration
public class WebFluxSecurityConfiguration {
private static final String BEAN_NAME_PREFIX = "org.springframework.security.config.annotation.web.reactive.WebFluxSecurityConfiguration.";
private static final String SPRING_SECURITY_WEBFILTERCHAINFILTER_BEAN_NAME = BEAN_NAME_PREFIX + "WebFilterChainFilter";
@Autowired(required = false)
private List<SecurityWebFilterChain> securityWebFilterChains;
@ -43,8 +46,8 @@ public class WebFluxSecurityConfiguration {
@Autowired
ApplicationContext context;
@Bean
public WebFilterChainFilter springSecurityFilterChain() {
@Bean(SPRING_SECURITY_WEBFILTERCHAINFILTER_BEAN_NAME)
public WebFilterChainFilter springSecurityWebFilterChainFilter() {
return WebFilterChainFilter.fromSecurityWebFilterChainsList(getSecurityWebFilterChains());
}