Class SecurityContextHolderPrincipalResolver
java.lang.Object
org.springframework.security.oauth2.client.web.client.SecurityContextHolderPrincipalResolver
- All Implemented Interfaces:
OAuth2ClientHttpRequestInterceptor.PrincipalResolver
public class SecurityContextHolderPrincipalResolver
extends Object
implements OAuth2ClientHttpRequestInterceptor.PrincipalResolver
A strategy for resolving a
principal from an intercepted request
using the SecurityContextHolder.- Since:
- 6.4
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs aSecurityContextHolderPrincipalResolver.SecurityContextHolderPrincipalResolver(org.springframework.security.core.context.SecurityContextHolderStrategy securityContextHolderStrategy) Constructs aSecurityContextHolderPrincipalResolverusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authenticationresolve(org.springframework.http.HttpRequest request) Resolve theprincipalfrom the current request, which is used to obtain anOAuth2AuthorizedClient.
-
Constructor Details
-
SecurityContextHolderPrincipalResolver
public SecurityContextHolderPrincipalResolver()Constructs aSecurityContextHolderPrincipalResolver. -
SecurityContextHolderPrincipalResolver
public SecurityContextHolderPrincipalResolver(org.springframework.security.core.context.SecurityContextHolderStrategy securityContextHolderStrategy) Constructs aSecurityContextHolderPrincipalResolverusing the provided parameters.- Parameters:
securityContextHolderStrategy- theSecurityContextHolderStrategyto use for resolving theprincipal
-
-
Method Details
-
resolve
public org.springframework.security.core.Authentication resolve(org.springframework.http.HttpRequest request) Description copied from interface:OAuth2ClientHttpRequestInterceptor.PrincipalResolverResolve theprincipalfrom the current request, which is used to obtain anOAuth2AuthorizedClient.- Specified by:
resolvein interfaceOAuth2ClientHttpRequestInterceptor.PrincipalResolver- Parameters:
request- the intercepted request, containing HTTP method, URI, headers, and request attributes- Returns:
- the
principalto be used for resolving anOAuth2AuthorizedClient.
-