Given that the filters are the level at which the
SecurityContextHolder is consulted, this commit moves
the operation that ProviderManager was doing into each
authentication filter.
Issue gh-17862
@ -318,7 +318,6 @@ public class GlobalMethodSecurityConfiguration implements ImportAware, SmartInit
@@ -318,7 +318,6 @@ public class GlobalMethodSecurityConfiguration implements ImportAware, SmartInit
@ -162,10 +162,8 @@ public class WebAuthnConfigurer<H extends HttpSecurityBuilder<H>>
@@ -162,10 +162,8 @@ public class WebAuthnConfigurer<H extends HttpSecurityBuilder<H>>
@ -74,10 +72,6 @@ public class AuthenticationManagerFactoryBean implements FactoryBean<Authenticat
@@ -74,10 +72,6 @@ public class AuthenticationManagerFactoryBean implements FactoryBean<Authenticat
@ -58,20 +57,6 @@ public class DelegatingReactiveAuthenticationManager implements ReactiveAuthenti
@@ -58,20 +57,6 @@ public class DelegatingReactiveAuthenticationManager implements ReactiveAuthenti
@ -94,9 +92,6 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@@ -94,9 +92,6 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@ -187,7 +182,7 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@@ -187,7 +182,7 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
try{
result=provider.authenticate(authentication);
if(result!=null){
copyDetails(authentication,result);
result=copyDetails(authentication,result);
break;
}
}
@ -214,7 +209,6 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@@ -214,7 +209,6 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
lastException=ex;
}
}
result=applyPreviousAuthentication(result);
if(result==null&&this.parent!=null){
// Allow the parent to try.
try{
@ -271,20 +265,6 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@@ -271,20 +265,6 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@ -297,21 +277,20 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@@ -297,21 +277,20 @@ public class ProviderManager implements AuthenticationManager, MessageSourceAwar
@ -121,24 +118,6 @@ public class DelegatingReactiveAuthenticationManagerTests {
@@ -121,24 +118,6 @@ public class DelegatingReactiveAuthenticationManagerTests {
@ -248,6 +248,12 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
@@ -248,6 +248,12 @@ public abstract class AbstractAuthenticationProcessingFilter extends GenericFilt
// return immediately as subclass has indicated that it hasn't completed
@ -184,6 +184,12 @@ public class AuthenticationFilter extends OncePerRequestFilter {
@@ -184,6 +184,12 @@ public class AuthenticationFilter extends OncePerRequestFilter {
@ -204,6 +204,12 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
@@ -204,6 +204,12 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
@ -186,6 +186,10 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
@@ -186,6 +186,10 @@ public class BasicAuthenticationFilter extends OncePerRequestFilter {
this.logger.trace(LogMessage.format("Found username '%s' in Basic Authorization header",username));
@ -122,12 +122,26 @@ public class AuthenticationWebFilter implements WebFilter {
@@ -122,12 +122,26 @@ public class AuthenticationWebFilter implements WebFilter {