Class OAuth2AuthorizeRequest
- java.lang.Object
-
- org.springframework.security.oauth2.client.OAuth2AuthorizeRequest
-
public final class OAuth2AuthorizeRequest extends java.lang.ObjectRepresents a request theOAuth2AuthorizedClientManageruses toauthorize(or re-authorize) theclientidentified by the providedclientRegistrationId.- Since:
- 5.2
- See Also:
OAuth2AuthorizedClientManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOAuth2AuthorizeRequest.BuilderA builder forOAuth2AuthorizeRequest.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetAttribute(java.lang.String name)Returns the value of an attribute associated to the request ornullif not available.java.util.Map<java.lang.String,java.lang.Object>getAttributes()Returns the attributes associated to the request.OAuth2AuthorizedClientgetAuthorizedClient()Returns theauthorized clientornullif it was not provided.java.lang.StringgetClientRegistrationId()Returns the identifier for theclient registration.AuthenticationgetPrincipal()Returns thePrincipal(to be) associated to the authorized client.static OAuth2AuthorizeRequest.BuilderwithAuthorizedClient(OAuth2AuthorizedClient authorizedClient)Returns a newOAuth2AuthorizeRequest.Builderinitialized with theauthorized client.static OAuth2AuthorizeRequest.BuilderwithClientRegistrationId(java.lang.String clientRegistrationId)Returns a newOAuth2AuthorizeRequest.Builderinitialized 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 clientornullif it was not provided.- Returns:
- the
OAuth2AuthorizedClientornullif 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
Mapof 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 ornullif 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.Builderinitialized 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.Builderinitialized with theauthorized client.- Parameters:
authorizedClient- theauthorized client- Returns:
- the
OAuth2AuthorizeRequest.Builder
-
-