From f8971742f283fcfc55e5cd7732d1cc870aa8063b Mon Sep 17 00:00:00 2001 From: Marcus Da Coregio Date: Tue, 2 Aug 2022 15:32:06 -0300 Subject: [PATCH] Remove FilterSecurityInterceptor from WebSecurity Closes gh-11325 --- .../annotation/web/builders/WebSecurity.java | 26 +++---------------- .../WebSecurityConfiguration.java | 7 ----- .../WebSecurityConfigurerAdapter.java | 6 +---- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java index 52b21c0af9..299b92fcf3 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java @@ -95,8 +95,6 @@ public final class WebSecurity extends AbstractConfiguredSecurityBuilder securityFilterChain); - for (Filter filter : securityFilterChain.getFilters()) { - if (filter instanceof FilterSecurityInterceptor) { - this.webSecurity.securityInterceptor((FilterSecurityInterceptor) filter); - break; - } - } } for (WebSecurityCustomizer customizer : this.webSecurityCustomizers) { customizer.customize(this.webSecurity); diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java index 78ff7f14e8..e33d980278 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java @@ -61,7 +61,6 @@ import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; import org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter; import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; @@ -317,10 +316,7 @@ public abstract class WebSecurityConfigurerAdapter implements WebSecurityConfigu @Override public void init(WebSecurity web) throws Exception { HttpSecurity http = getHttp(); - web.addSecurityFilterChainBuilder(http).postBuildAction(() -> { - FilterSecurityInterceptor securityInterceptor = http.getSharedObject(FilterSecurityInterceptor.class); - web.securityInterceptor(securityInterceptor); - }); + web.addSecurityFilterChainBuilder(http); } /**