Class OAuth2AuthorizeRequest
- java.lang.Object
-
- org.springframework.security.oauth2.client.OAuth2AuthorizeRequest
-
public final class OAuth2AuthorizeRequest extends java.lang.Object
Represents a request theOAuth2AuthorizedClientManager
uses toauthorize
(or re-authorize) theclient
identified by the providedclientRegistrationId
.- Since:
- 5.2
- See Also:
OAuth2AuthorizedClientManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OAuth2AuthorizeRequest.Builder
A builder forOAuth2AuthorizeRequest
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
getAttribute(java.lang.String name)
Returns the value of an attribute associated to the request ornull
if not available.java.util.Map<java.lang.String,java.lang.Object>
getAttributes()
Returns the attributes associated to the request.OAuth2AuthorizedClient
getAuthorizedClient()
Returns theauthorized client
ornull
if it was not provided.java.lang.String
getClientRegistrationId()
Returns the identifier for theclient registration
.Authentication
getPrincipal()
Returns thePrincipal
(to be) associated to the authorized client.static OAuth2AuthorizeRequest.Builder
withAuthorizedClient(OAuth2AuthorizedClient authorizedClient)
Returns a newOAuth2AuthorizeRequest.Builder
initialized with theauthorized client
.static OAuth2AuthorizeRequest.Builder
withClientRegistrationId(java.lang.String clientRegistrationId)
Returns a newOAuth2AuthorizeRequest.Builder
initialized with the identifier for theclient registration
.
-
-
-
Method Detail
-
getClientRegistrationId
public java.lang.String getClientRegistrationId()
Returns the identifier for theclient registration
.- Returns:
- the identifier for the client registration
-
getAuthorizedClient
@Nullable public OAuth2AuthorizedClient getAuthorizedClient()
Returns theauthorized client
ornull
if it was not provided.- Returns:
- the
OAuth2AuthorizedClient
ornull
if it was not provided
-
getPrincipal
public Authentication getPrincipal()
Returns thePrincipal
(to be) associated to the authorized client.- Returns:
- the
Principal
(to be) associated to the authorized client
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Returns the attributes associated to the request.- Returns:
- a
Map
of the attributes associated to the request
-
getAttribute
@Nullable public <T> T getAttribute(java.lang.String name)
Returns the value of an attribute associated to the request ornull
if not available.- Type Parameters:
T
- the type of the attribute- Parameters:
name
- the name of the attribute- Returns:
- the value of the attribute associated to the request
-
withClientRegistrationId
public static OAuth2AuthorizeRequest.Builder withClientRegistrationId(java.lang.String clientRegistrationId)
Returns a newOAuth2AuthorizeRequest.Builder
initialized with the identifier for theclient registration
.- Parameters:
clientRegistrationId
- the identifier for theclient registration
- Returns:
- the
OAuth2AuthorizeRequest.Builder
-
withAuthorizedClient
public static OAuth2AuthorizeRequest.Builder withAuthorizedClient(OAuth2AuthorizedClient authorizedClient)
Returns a newOAuth2AuthorizeRequest.Builder
initialized with theauthorized client
.- Parameters:
authorizedClient
- theauthorized client
- Returns:
- the
OAuth2AuthorizeRequest.Builder
-
-