Class OAuth2Authorization
java.lang.Object
org.springframework.security.oauth2.server.authorization.OAuth2Authorization
- All Implemented Interfaces:
Serializable
A representation of an OAuth 2.0 Authorization, which holds state related to the
authorization granted to a
client, by the
resource owner or itself in the case of the
client_credentials grant type.- Since:
- 7.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder forOAuth2Authorization.static classOAuth2Authorization.Token<T extends OAuth2Token>A holder of an OAuth 2.0 Token and it's associated metadata. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic OAuth2Authorization.Builderfrom(OAuth2Authorization authorization) Returns a newOAuth2Authorization.Builder, initialized with the values from the providedOAuth2Authorization.Returns theOAuth2Authorization.Tokenof typeOAuth2AccessToken.<T> TgetAttribute(String name) Returns the value of an attribute associated to the authorization.Returns the attribute(s) associated to the authorization.Returns theauthorization grant typeused for the authorization.Returns the authorized scope(s).getId()Returns the identifier for the authorization.Returns thePrincipalname of the resource owner (or client).Returns theOAuth2Authorization.Tokenof typeOAuth2RefreshToken.Returns the identifier for theregistered client.<T extends OAuth2Token>
OAuth2Authorization.Token<T>Returns theOAuth2Authorization.Tokenof typetokenType.<T extends OAuth2Token>
OAuth2Authorization.Token<T>Returns theOAuth2Authorization.Tokenmatching thetokenValue.inthashCode()static OAuth2Authorization.BuilderwithRegisteredClient(RegisteredClient registeredClient) Returns a newOAuth2Authorization.Builder, initialized with the providedRegisteredClient.getId().
-
Constructor Details
-
OAuth2Authorization
protected OAuth2Authorization()
-
-
Method Details
-
getId
Returns the identifier for the authorization.- Returns:
- the identifier for the authorization
-
getRegisteredClientId
Returns the identifier for theregistered client.- Returns:
- the
RegisteredClient.getId()
-
getPrincipalName
Returns thePrincipalname of the resource owner (or client).- Returns:
- the
Principalname of the resource owner (or client)
-
getAuthorizationGrantType
Returns theauthorization grant typeused for the authorization.- Returns:
- the
AuthorizationGrantTypeused for the authorization
-
getAuthorizedScopes
Returns the authorized scope(s).- Returns:
- the
Setof authorized scope(s)
-
getAccessToken
Returns theOAuth2Authorization.Tokenof typeOAuth2AccessToken.- Returns:
- the
OAuth2Authorization.Tokenof typeOAuth2AccessToken
-
getRefreshToken
Returns theOAuth2Authorization.Tokenof typeOAuth2RefreshToken.- Returns:
- the
OAuth2Authorization.Tokenof typeOAuth2RefreshToken, ornullif not available
-
getToken
Returns theOAuth2Authorization.Tokenof typetokenType.- Type Parameters:
T- the type of the token- Parameters:
tokenType- the token type- Returns:
- the
OAuth2Authorization.Token, ornullif not available
-
getToken
Returns theOAuth2Authorization.Tokenmatching thetokenValue.- Type Parameters:
T- the type of the token- Parameters:
tokenValue- the token value- Returns:
- the
OAuth2Authorization.Token, ornullif not available
-
getAttributes
Returns the attribute(s) associated to the authorization.- Returns:
- a
Mapof the attribute(s)
-
getAttribute
Returns the value of an attribute associated to the authorization.- Type Parameters:
T- the type of the attribute- Parameters:
name- the name of the attribute- Returns:
- the value of an attribute associated to the authorization, or
nullif not available
-
equals
-
hashCode
public int hashCode() -
withRegisteredClient
Returns a newOAuth2Authorization.Builder, initialized with the providedRegisteredClient.getId().- Parameters:
registeredClient- theRegisteredClient- Returns:
- the
OAuth2Authorization.Builder
-
from
Returns a newOAuth2Authorization.Builder, initialized with the values from the providedOAuth2Authorization.- Parameters:
authorization- theOAuth2Authorizationused for initializing theOAuth2Authorization.Builder- Returns:
- the
OAuth2Authorization.Builder
-