public class OAuth2Authorization
extends java.lang.Object
implements java.io.Serializable
client, by the resource owner
or itself in the case of the client_credentials grant type.RegisteredClient,
AuthorizationGrantType,
OAuth2Token,
OAuth2AccessToken,
OAuth2RefreshToken,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
OAuth2Authorization.Builder
A builder for
OAuth2Authorization. |
static class |
OAuth2Authorization.Token<T extends org.springframework.security.oauth2.core.OAuth2Token>
A holder of an OAuth 2.0 Token and it's associated metadata.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUTHORIZED_SCOPE_ATTRIBUTE_NAME
The name of the
attribute used for the authorized scope(s). |
| Modifier | Constructor and Description |
|---|---|
protected |
OAuth2Authorization() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static OAuth2Authorization.Builder |
from(OAuth2Authorization authorization)
Returns a new
OAuth2Authorization.Builder, initialized with the values from the provided OAuth2Authorization. |
OAuth2Authorization.Token<org.springframework.security.oauth2.core.OAuth2AccessToken> |
getAccessToken()
Returns the
OAuth2Authorization.Token of type OAuth2AccessToken. |
<T> T |
getAttribute(java.lang.String name)
Returns the value of an attribute associated to the authorization.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Returns the attribute(s) associated to the authorization.
|
org.springframework.security.oauth2.core.AuthorizationGrantType |
getAuthorizationGrantType()
Returns the
authorization grant type used for the authorization. |
java.lang.String |
getId()
Returns the identifier for the authorization.
|
java.lang.String |
getPrincipalName()
Returns the
Principal name of the resource owner (or client). |
OAuth2Authorization.Token<org.springframework.security.oauth2.core.OAuth2RefreshToken> |
getRefreshToken()
Returns the
OAuth2Authorization.Token of type OAuth2RefreshToken. |
java.lang.String |
getRegisteredClientId()
Returns the identifier for the
registered client. |
<T extends org.springframework.security.oauth2.core.OAuth2Token> |
getToken(java.lang.Class<T> tokenType)
Returns the
OAuth2Authorization.Token of type tokenType. |
<T extends org.springframework.security.oauth2.core.OAuth2Token> |
getToken(java.lang.String tokenValue)
Returns the
OAuth2Authorization.Token matching the tokenValue. |
int |
hashCode() |
static OAuth2Authorization.Builder |
withRegisteredClient(RegisteredClient registeredClient)
Returns a new
OAuth2Authorization.Builder, initialized with the provided RegisteredClient.getId(). |
public static final java.lang.String AUTHORIZED_SCOPE_ATTRIBUTE_NAME
attribute used for the authorized scope(s).
The value of the attribute is of type Set<String>.public java.lang.String getId()
public java.lang.String getRegisteredClientId()
registered client.RegisteredClient.getId()public java.lang.String getPrincipalName()
Principal name of the resource owner (or client).Principal name of the resource owner (or client)public org.springframework.security.oauth2.core.AuthorizationGrantType getAuthorizationGrantType()
authorization grant type used for the authorization.AuthorizationGrantType used for the authorizationpublic OAuth2Authorization.Token<org.springframework.security.oauth2.core.OAuth2AccessToken> getAccessToken()
OAuth2Authorization.Token of type OAuth2AccessToken.OAuth2Authorization.Token of type OAuth2AccessToken@Nullable public OAuth2Authorization.Token<org.springframework.security.oauth2.core.OAuth2RefreshToken> getRefreshToken()
OAuth2Authorization.Token of type OAuth2RefreshToken.OAuth2Authorization.Token of type OAuth2RefreshToken, or null if not available@Nullable public <T extends org.springframework.security.oauth2.core.OAuth2Token> OAuth2Authorization.Token<T> getToken(java.lang.Class<T> tokenType)
OAuth2Authorization.Token of type tokenType.T - the type of the tokentokenType - the token typeOAuth2Authorization.Token, or null if not available@Nullable public <T extends org.springframework.security.oauth2.core.OAuth2Token> OAuth2Authorization.Token<T> getToken(java.lang.String tokenValue)
OAuth2Authorization.Token matching the tokenValue.T - the type of the tokentokenValue - the token valueOAuth2Authorization.Token, or null if not availablepublic java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Map of the attribute(s)@Nullable public <T> T getAttribute(java.lang.String name)
T - the type of the attributename - the name of the attributenull if not availablepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static OAuth2Authorization.Builder withRegisteredClient(RegisteredClient registeredClient)
OAuth2Authorization.Builder, initialized with the provided RegisteredClient.getId().registeredClient - the RegisteredClientOAuth2Authorization.Builderpublic static OAuth2Authorization.Builder from(OAuth2Authorization authorization)
OAuth2Authorization.Builder, initialized with the values from the provided OAuth2Authorization.authorization - the OAuth2Authorization used for initializing the OAuth2Authorization.BuilderOAuth2Authorization.Builder