Class RequestAttributePrincipalResolver
java.lang.Object
org.springframework.security.oauth2.client.web.client.RequestAttributePrincipalResolver
- All Implemented Interfaces:
OAuth2ClientHttpRequestInterceptor.PrincipalResolver
public class RequestAttributePrincipalResolver
extends Object
implements OAuth2ClientHttpRequestInterceptor.PrincipalResolver
A strategy for resolving a
principal from an intercepted request
using attributes.- Since:
- 6.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprincipal(org.springframework.security.core.Authentication principal) org.springframework.security.core.Authenticationresolve(org.springframework.http.HttpRequest request) Resolve theprincipalfrom the current request, which is used to obtain anOAuth2AuthorizedClient.
-
Constructor Details
-
RequestAttributePrincipalResolver
public RequestAttributePrincipalResolver()
-
-
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.
-
principal
public static Consumer<Map<String,Object>> principal(org.springframework.security.core.Authentication principal) - Parameters:
principal- theprincipalto be used to look up theOAuth2AuthorizedClient- Returns:
- the
Consumerto populate the attributes
-
principal
- Parameters:
principalName- theprincipalNameto be used to look up theOAuth2AuthorizedClient- Returns:
- the
Consumerto populate the attributes
-