Class OAuth2AccessToken
java.lang.Object
org.springframework.security.oauth2.core.AbstractOAuth2Token
org.springframework.security.oauth2.core.OAuth2AccessToken
- All Implemented Interfaces:
Serializable
,OAuth2Token
An implementation of an
AbstractOAuth2Token
representing an OAuth 2.0 Access
Token.
An access token is a credential that represents an authorization granted by the resource owner to the client. It is primarily used by the client to access protected resources on either a resource server or the authorization server that originally issued the access token.
- Since:
- 5.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Access Token Types. -
Constructor Summary
ConstructorsConstructorDescriptionOAuth2AccessToken
(OAuth2AccessToken.TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt) Constructs anOAuth2AccessToken
using the provided parameters.OAuth2AccessToken
(OAuth2AccessToken.TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt, Set<String> scopes) Constructs anOAuth2AccessToken
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the scope(s) associated to the token.Returns thetoken type
.Methods inherited from class org.springframework.security.oauth2.core.AbstractOAuth2Token
equals, getExpiresAt, getIssuedAt, getTokenValue, hashCode
-
Constructor Details
-
OAuth2AccessToken
public OAuth2AccessToken(OAuth2AccessToken.TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt) Constructs anOAuth2AccessToken
using the provided parameters.- Parameters:
tokenType
- the token typetokenValue
- the token valueissuedAt
- the time at which the token was issuedexpiresAt
- the expiration time on or after which the token MUST NOT be accepted
-
OAuth2AccessToken
public OAuth2AccessToken(OAuth2AccessToken.TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt, Set<String> scopes) Constructs anOAuth2AccessToken
using the provided parameters.- Parameters:
tokenType
- the token typetokenValue
- the token valueissuedAt
- the time at which the token was issuedexpiresAt
- the expiration time on or after which the token MUST NOT be acceptedscopes
- the scope(s) associated to the token
-
-
Method Details
-
getTokenType
Returns thetoken type
.- Returns:
- the
OAuth2AccessToken.TokenType
-
getScopes
Returns the scope(s) associated to the token.- Returns:
- the scope(s) associated to the token
-