From 9d19b7337eb044624cbcbd75face43568f285ed7 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Wed, 14 Jun 2017 16:02:16 -0500 Subject: [PATCH] Ensure Unique Names Issue: gh-4394 --- .../annotation/web/reactive/HttpSecurityConfiguration.java | 5 ++++- .../web/reactive/WebFluxSecurityConfiguration.java | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/HttpSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/HttpSecurityConfiguration.java index bda889fa43..92d5e2c790 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/HttpSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/HttpSecurityConfiguration.java @@ -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(); diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java index 1a95d1d93e..951f8a250a 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java @@ -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 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()); }