From 2079309c5aa483dc0038093fa87c1998cd1696c6 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Fri, 24 Jun 2022 13:24:24 -0600 Subject: [PATCH] Add SecurityContextHolderStrategy XML Configuration for OAuth2 Issue gh-11061 --- .../oauth2/client/OAuth2LoginConfigurer.java | 1 + .../http/AuthenticationConfigBuilder.java | 31 ++++++---- .../OAuth2ClientBeanDefinitionParser.java | 8 ++- .../http/OAuth2LoginBeanDefinitionParser.java | 10 +++- ...th2ResourceServerBeanDefinitionParser.java | 10 +++- .../OAuth2ResourceServerConfigurerTests.java | 3 +- .../OAuth2LoginBeanDefinitionParserTests.java | 29 ++++++++- ...sourceServerBeanDefinitionParserTests.java | 25 ++++++-- ...ithCustomSecurityContextHolderStrategy.xml | 59 +++++++++++++++++++ ...JwtCustomSecurityContextHolderStrategy.xml | 41 +++++++++++++ 10 files changed, 194 insertions(+), 23 deletions(-) create mode 100644 config/src/test/resources/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests-WithCustomSecurityContextHolderStrategy.xml create mode 100644 config/src/test/resources/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests-JwtCustomSecurityContextHolderStrategy.xml diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java index e26e12c14d..e1bb0b6740 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java @@ -290,6 +290,7 @@ public final class OAuth2LoginConfigurer> OAuth2LoginAuthenticationFilter authenticationFilter = new OAuth2LoginAuthenticationFilter( OAuth2ClientConfigurerUtils.getClientRegistrationRepository(this.getBuilder()), OAuth2ClientConfigurerUtils.getAuthorizedClientRepository(this.getBuilder()), this.loginProcessingUrl); + authenticationFilter.setSecurityContextHolderStrategy(getSecurityContextHolderStrategy()); this.setAuthenticationFilter(authenticationFilter); super.loginProcessingUrl(this.loginProcessingUrl); if (this.loginPage != null) { diff --git a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java index 7eb17c0384..8ec6a81dfe 100644 --- a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java +++ b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java @@ -230,11 +230,12 @@ final class AuthenticationConfigBuilder { createAnonymousFilter(authenticationFilterSecurityContextHolderStrategyRef); createRememberMeFilter(authenticationManager, authenticationFilterSecurityContextHolderStrategyRef); createBasicFilter(authenticationManager, authenticationFilterSecurityContextHolderStrategyRef); - createBearerTokenAuthenticationFilter(authenticationManager); + createBearerTokenAuthenticationFilter(authenticationManager, + authenticationFilterSecurityContextHolderStrategyRef); createFormLoginFilter(sessionStrategy, authenticationManager, authenticationFilterSecurityContextHolderStrategyRef, authenticationFilterSecurityContextRepositoryRef); createOAuth2ClientFilters(sessionStrategy, requestCache, authenticationManager, - authenticationFilterSecurityContextRepositoryRef); + authenticationFilterSecurityContextRepositoryRef, authenticationFilterSecurityContextHolderStrategyRef); createSaml2LoginFilter(authenticationManager, authenticationFilterSecurityContextRepositoryRef); createX509Filter(authenticationManager, authenticationFilterSecurityContextHolderStrategyRef); createJeeFilter(authenticationManager, authenticationFilterSecurityContextHolderStrategyRef); @@ -304,22 +305,26 @@ final class AuthenticationConfigBuilder { } void createOAuth2ClientFilters(BeanReference sessionStrategy, BeanReference requestCache, - BeanReference authenticationManager, BeanReference authenticationFilterSecurityContextRepositoryRef) { + BeanReference authenticationManager, BeanReference authenticationFilterSecurityContextRepositoryRef, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategy) { createOAuth2LoginFilter(sessionStrategy, authenticationManager, - authenticationFilterSecurityContextRepositoryRef); - createOAuth2ClientFilter(requestCache, authenticationManager, authenticationFilterSecurityContextRepositoryRef); + authenticationFilterSecurityContextRepositoryRef, authenticationFilterSecurityContextHolderStrategy); + createOAuth2ClientFilter(requestCache, authenticationManager, authenticationFilterSecurityContextRepositoryRef, + authenticationFilterSecurityContextHolderStrategy); registerOAuth2ClientPostProcessors(); } void createOAuth2LoginFilter(BeanReference sessionStrategy, BeanReference authManager, - BeanReference authenticationFilterSecurityContextRepositoryRef) { + BeanReference authenticationFilterSecurityContextRepositoryRef, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategy) { Element oauth2LoginElt = DomUtils.getChildElementByTagName(this.httpElt, Elements.OAUTH2_LOGIN); if (oauth2LoginElt == null) { return; } this.oauth2LoginEnabled = true; OAuth2LoginBeanDefinitionParser parser = new OAuth2LoginBeanDefinitionParser(this.requestCache, this.portMapper, - this.portResolver, sessionStrategy, this.allowSessionCreation); + this.portResolver, sessionStrategy, this.allowSessionCreation, + authenticationFilterSecurityContextHolderStrategy); BeanDefinition oauth2LoginFilterBean = parser.parse(oauth2LoginElt, this.pc); BeanDefinition defaultAuthorizedClientRepository = parser.getDefaultAuthorizedClientRepository(); registerDefaultAuthorizedClientRepositoryIfNecessary(defaultAuthorizedClientRepository); @@ -358,14 +363,16 @@ final class AuthenticationConfigBuilder { } void createOAuth2ClientFilter(BeanReference requestCache, BeanReference authenticationManager, - BeanReference authenticationFilterSecurityContextRepositoryRef) { + BeanReference authenticationFilterSecurityContextRepositoryRef, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategy) { Element oauth2ClientElt = DomUtils.getChildElementByTagName(this.httpElt, Elements.OAUTH2_CLIENT); if (oauth2ClientElt == null) { return; } this.oauth2ClientEnabled = true; OAuth2ClientBeanDefinitionParser parser = new OAuth2ClientBeanDefinitionParser(requestCache, - authenticationManager, authenticationFilterSecurityContextRepositoryRef); + authenticationManager, authenticationFilterSecurityContextRepositoryRef, + authenticationFilterSecurityContextHolderStrategy); parser.parse(oauth2ClientElt, this.pc); BeanDefinition defaultAuthorizedClientRepository = parser.getDefaultAuthorizedClientRepository(); registerDefaultAuthorizedClientRepositoryIfNecessary(defaultAuthorizedClientRepository); @@ -476,7 +483,8 @@ final class AuthenticationConfigBuilder { this.basicFilter = filterBuilder.getBeanDefinition(); } - void createBearerTokenAuthenticationFilter(BeanReference authManager) { + void createBearerTokenAuthenticationFilter(BeanReference authManager, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategyRef) { Element resourceServerElt = DomUtils.getChildElementByTagName(this.httpElt, Elements.OAUTH2_RESOURCE_SERVER); if (resourceServerElt == null) { // No resource server, do nothing @@ -484,7 +492,8 @@ final class AuthenticationConfigBuilder { } OAuth2ResourceServerBeanDefinitionParser resourceServerBuilder = new OAuth2ResourceServerBeanDefinitionParser( authManager, this.authenticationProviders, this.defaultEntryPointMappings, - this.defaultDeniedHandlerMappings, this.csrfIgnoreRequestMatchers); + this.defaultDeniedHandlerMappings, this.csrfIgnoreRequestMatchers, + authenticationFilterSecurityContextHolderStrategyRef); this.bearerTokenAuthenticationFilter = resourceServerBuilder.parse(resourceServerElt, this.pc); } diff --git a/config/src/main/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParser.java index 30985d08b2..1672d1faa6 100644 --- a/config/src/main/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/http/OAuth2ClientBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,8 @@ final class OAuth2ClientBeanDefinitionParser implements BeanDefinitionParser { private final BeanReference authenticationFilterSecurityContextRepositoryRef; + private final BeanMetadataElement authenticationFilterSecurityContextHolderStrategy; + private BeanDefinition defaultAuthorizedClientRepository; private BeanDefinition authorizationRequestRedirectFilter; @@ -63,10 +65,12 @@ final class OAuth2ClientBeanDefinitionParser implements BeanDefinitionParser { private BeanDefinition authorizationCodeAuthenticationProvider; OAuth2ClientBeanDefinitionParser(BeanReference requestCache, BeanReference authenticationManager, - BeanReference authenticationFilterSecurityContextRepositoryRef) { + BeanReference authenticationFilterSecurityContextRepositoryRef, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategy) { this.requestCache = requestCache; this.authenticationManager = authenticationManager; this.authenticationFilterSecurityContextRepositoryRef = authenticationFilterSecurityContextRepositoryRef; + this.authenticationFilterSecurityContextHolderStrategy = authenticationFilterSecurityContextHolderStrategy; } @Override diff --git a/config/src/main/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParser.java index 1b8efc6695..eb6ac43500 100644 --- a/config/src/main/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,6 +117,8 @@ final class OAuth2LoginBeanDefinitionParser implements BeanDefinitionParser { private final boolean allowSessionCreation; + private final BeanMetadataElement authenticationFilterSecurityContextHolderStrategy; + private BeanDefinition defaultAuthorizedClientRepository; private BeanDefinition oauth2AuthorizationRequestRedirectFilter; @@ -130,12 +132,14 @@ final class OAuth2LoginBeanDefinitionParser implements BeanDefinitionParser { private BeanDefinition oauth2LoginLinks; OAuth2LoginBeanDefinitionParser(BeanReference requestCache, BeanReference portMapper, BeanReference portResolver, - BeanReference sessionStrategy, boolean allowSessionCreation) { + BeanReference sessionStrategy, boolean allowSessionCreation, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategy) { this.requestCache = requestCache; this.portMapper = portMapper; this.portResolver = portResolver; this.sessionStrategy = sessionStrategy; this.allowSessionCreation = allowSessionCreation; + this.authenticationFilterSecurityContextHolderStrategy = authenticationFilterSecurityContextHolderStrategy; } @Override @@ -248,6 +252,8 @@ final class OAuth2LoginBeanDefinitionParser implements BeanDefinitionParser { oauth2LoginAuthenticationFilterBuilder.addPropertyValue("authenticationFailureHandler", failureHandlerBuilder.getBeanDefinition()); } + oauth2LoginAuthenticationFilterBuilder.addPropertyValue("securityContextHolderStrategy", + this.authenticationFilterSecurityContextHolderStrategy); // prepare loginlinks this.oauth2LoginLinks = BeanDefinitionBuilder.rootBeanDefinition(Map.class) .setFactoryMethodOnBean("getLoginLinks", oauth2LoginBeanConfigId).getBeanDefinition(); diff --git a/config/src/main/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParser.java index 4150d72691..fbd1c8d77a 100644 --- a/config/src/main/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,14 +85,18 @@ final class OAuth2ResourceServerBeanDefinitionParser implements BeanDefinitionPa private final BeanDefinition accessDeniedHandler = new RootBeanDefinition(BearerTokenAccessDeniedHandler.class); + private final BeanMetadataElement authenticationFilterSecurityContextHolderStrategy; + OAuth2ResourceServerBeanDefinitionParser(BeanReference authenticationManager, List authenticationProviders, Map entryPoints, - Map deniedHandlers, List ignoreCsrfRequestMatchers) { + Map deniedHandlers, List ignoreCsrfRequestMatchers, + BeanMetadataElement authenticationFilterSecurityContextHolderStrategy) { this.authenticationManager = authenticationManager; this.authenticationProviders = authenticationProviders; this.entryPoints = entryPoints; this.deniedHandlers = deniedHandlers; this.ignoreCsrfRequestMatchers = ignoreCsrfRequestMatchers; + this.authenticationFilterSecurityContextHolderStrategy = authenticationFilterSecurityContextHolderStrategy; } /** @@ -134,6 +138,8 @@ final class OAuth2ResourceServerBeanDefinitionParser implements BeanDefinitionPa filterBuilder.addConstructorArgValue(authenticationManagerResolver); filterBuilder.addPropertyValue(BEARER_TOKEN_RESOLVER, bearerTokenResolver); filterBuilder.addPropertyValue(AUTHENTICATION_ENTRY_POINT, authenticationEntryPoint); + filterBuilder.addPropertyValue("securityContextHolderStrategy", + this.authenticationFilterSecurityContextHolderStrategy); return filterBuilder.getBeanDefinition(); } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java index 9a20a3e285..bc9e8474df 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurerTests.java @@ -225,7 +225,8 @@ public class OAuth2ResourceServerConfigurerTests { @Test public void getWhenCustomSecurityContextHolderStrategyThenUses() throws Exception { - this.spring.register(RestOperationsConfig.class, DefaultConfig.class, BasicController.class, SecurityContextChangedListenerConfig.class).autowire(); + this.spring.register(RestOperationsConfig.class, DefaultConfig.class, BasicController.class, + SecurityContextChangedListenerConfig.class).autowire(); mockRestOperations(jwks("Default")); String token = this.token("ValidNoScopes"); // @formatter:off diff --git a/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java index 8b98a9a9a0..9ad2b910fe 100644 --- a/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper; +import org.springframework.security.core.context.SecurityContextHolderStrategy; import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService; import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; @@ -80,6 +81,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -142,6 +144,9 @@ public class OAuth2LoginBeanDefinitionParserTests { @Autowired(required = false) private RequestCache requestCache; + @Autowired(required = false) + private SecurityContextHolderStrategy securityContextHolderStrategy; + @Autowired private MockMvc mvc; @@ -488,6 +493,28 @@ public class OAuth2LoginBeanDefinitionParserTests { verify(this.authorizedClientService).saveAuthorizedClient(any(), any()); } + @Test + public void requestWhenCustomSecurityContextHolderStrategyThenCalled() throws Exception { + this.spring.configLocations(this.xml("WithCustomSecurityContextHolderStrategy")).autowire(); + ClientRegistration clientRegistration = TestClientRegistrations.clientRegistration().build(); + given(this.clientRegistrationRepository.findByRegistrationId(any())).willReturn(clientRegistration); + Map attributes = new HashMap<>(); + attributes.put(OAuth2ParameterNames.REGISTRATION_ID, clientRegistration.getRegistrationId()); + OAuth2AuthorizationRequest authorizationRequest = TestOAuth2AuthorizationRequests.request() + .attributes(attributes).build(); + given(this.authorizationRequestRepository.removeAuthorizationRequest(any(), any())) + .willReturn(authorizationRequest); + OAuth2AccessTokenResponse accessTokenResponse = TestOAuth2AccessTokenResponses.accessTokenResponse().build(); + given(this.accessTokenResponseClient.getTokenResponse(any())).willReturn(accessTokenResponse); + OAuth2User oauth2User = TestOAuth2Users.create(); + given(this.oauth2UserService.loadUser(any())).willReturn(oauth2User); + MultiValueMap params = new LinkedMultiValueMap<>(); + params.add("code", "code123"); + params.add("state", authorizationRequest.getState()); + this.mvc.perform(get("/login/oauth2/code/" + clientRegistration.getRegistrationId()).params(params)); + verify(this.securityContextHolderStrategy, atLeastOnce()).getContext(); + } + @WithMockUser @Test public void requestWhenAuthorizedClientFoundThenMethodArgumentResolved() throws Exception { diff --git a/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java index ef900c98ef..b2acea886f 100644 --- a/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java +++ b/config/src/test/java/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.w3c.dom.Element; +import org.springframework.beans.BeanMetadataElement; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.annotation.Autowired; @@ -107,6 +108,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; @@ -146,6 +148,20 @@ public class OAuth2ResourceServerBeanDefinitionParserTests { // @formatter:on } + @Test + public void getWhenCustomSecurityContextHolderStrategyThenUses() throws Exception { + this.spring.configLocations(xml("JwtRestOperations"), xml("JwtCustomSecurityContextHolderStrategy")).autowire(); + mockRestOperations(jwks("Default")); + String token = this.token("ValidNoScopes"); + // @formatter:off + this.mvc.perform(get("/").header("Authorization", "Bearer " + token)) + .andExpect(status().isNotFound()); + // @formatter:on + SecurityContextHolderStrategy securityContextHolderStrategy = this.spring.getContext() + .getBean(SecurityContextHolderStrategy.class); + verify(securityContextHolderStrategy, atLeastOnce()).getContext(); + } + @Test public void getWhenUsingJwkSetUriThenAcceptsRequest() throws Exception { this.spring.configLocations(xml("WebServer"), xml("JwkSetUri")).autowire(); @@ -507,7 +523,8 @@ public class OAuth2ResourceServerBeanDefinitionParserTests { @Test public void getBearerTokenResolverWhenNoResolverSpecifiedThenTheDefaultIsUsed() { OAuth2ResourceServerBeanDefinitionParser oauth2 = new OAuth2ResourceServerBeanDefinitionParser( - mock(BeanReference.class), mock(List.class), mock(Map.class), mock(Map.class), mock(List.class)); + mock(BeanReference.class), mock(List.class), mock(Map.class), mock(Map.class), mock(List.class), + mock(BeanMetadataElement.class)); assertThat(oauth2.getBearerTokenResolver(mock(Element.class))).isInstanceOf(RootBeanDefinition.class); } @@ -816,7 +833,7 @@ public class OAuth2ResourceServerBeanDefinitionParserTests { @Test public void validateConfigurationWhenMoreThanOneResourceServerModeThenError() { OAuth2ResourceServerBeanDefinitionParser parser = new OAuth2ResourceServerBeanDefinitionParser(null, null, null, - null, null); + null, null, null); Element element = mock(Element.class); given(element.hasAttribute(OAuth2ResourceServerBeanDefinitionParser.AUTHENTICATION_MANAGER_RESOLVER_REF)) .willReturn(true); @@ -832,7 +849,7 @@ public class OAuth2ResourceServerBeanDefinitionParserTests { @Test public void validateConfigurationWhenNoResourceServerModeThenError() { OAuth2ResourceServerBeanDefinitionParser parser = new OAuth2ResourceServerBeanDefinitionParser(null, null, null, - null, null); + null, null, null); Element element = mock(Element.class); given(element.hasAttribute(OAuth2ResourceServerBeanDefinitionParser.AUTHENTICATION_MANAGER_RESOLVER_REF)) .willReturn(false); diff --git a/config/src/test/resources/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests-WithCustomSecurityContextHolderStrategy.xml b/config/src/test/resources/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests-WithCustomSecurityContextHolderStrategy.xml new file mode 100644 index 0000000000..6af68c55fa --- /dev/null +++ b/config/src/test/resources/org/springframework/security/config/http/OAuth2LoginBeanDefinitionParserTests-WithCustomSecurityContextHolderStrategy.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/src/test/resources/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests-JwtCustomSecurityContextHolderStrategy.xml b/config/src/test/resources/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests-JwtCustomSecurityContextHolderStrategy.xml new file mode 100644 index 0000000000..c61bb3911a --- /dev/null +++ b/config/src/test/resources/org/springframework/security/config/http/OAuth2ResourceServerBeanDefinitionParserTests-JwtCustomSecurityContextHolderStrategy.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + +