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
(SecurityContextHolderStrategy securityContextHolderStrategy) Constructs aSecurityContextHolderPrincipalResolver
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionresolve
(org.springframework.http.HttpRequest request) Resolve theprincipal
from the current request, which is used to obtain anOAuth2AuthorizedClient
.
-
Constructor Details
-
SecurityContextHolderPrincipalResolver
public SecurityContextHolderPrincipalResolver()Constructs aSecurityContextHolderPrincipalResolver
. -
SecurityContextHolderPrincipalResolver
public SecurityContextHolderPrincipalResolver(SecurityContextHolderStrategy securityContextHolderStrategy) Constructs aSecurityContextHolderPrincipalResolver
using the provided parameters.- Parameters:
securityContextHolderStrategy
- theSecurityContextHolderStrategy
to use for resolving theprincipal
-
-
Method Details
-
resolve
Description copied from interface:OAuth2ClientHttpRequestInterceptor.PrincipalResolver
Resolve theprincipal
from the current request, which is used to obtain anOAuth2AuthorizedClient
.- Specified by:
resolve
in interfaceOAuth2ClientHttpRequestInterceptor.PrincipalResolver
- Parameters:
request
- the intercepted request, containing HTTP method, URI, headers, and request attributes- Returns:
- the
principal
to be used for resolving anOAuth2AuthorizedClient
.
-