Class OAuth2AccessToken
- java.lang.Object
-
- org.springframework.security.oauth2.core.AbstractOAuth2Token
-
- org.springframework.security.oauth2.core.OAuth2AccessToken
-
- All Implemented Interfaces:
java.io.Serializable
,OAuth2Token
public class OAuth2AccessToken extends AbstractOAuth2Token
An implementation of anAbstractOAuth2Token
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:
- Section 1.4 Access Token, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OAuth2AccessToken.TokenType
Access Token Types.
-
Constructor Summary
Constructors Constructor Description OAuth2AccessToken(OAuth2AccessToken.TokenType tokenType, java.lang.String tokenValue, java.time.Instant issuedAt, java.time.Instant expiresAt)
Constructs anOAuth2AccessToken
using the provided parameters.OAuth2AccessToken(OAuth2AccessToken.TokenType tokenType, java.lang.String tokenValue, java.time.Instant issuedAt, java.time.Instant expiresAt, java.util.Set<java.lang.String> scopes)
Constructs anOAuth2AccessToken
using the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>
getScopes()
Returns the scope(s) associated to the token.OAuth2AccessToken.TokenType
getTokenType()
Returns thetoken type
.-
Methods inherited from class org.springframework.security.oauth2.core.AbstractOAuth2Token
equals, getExpiresAt, getIssuedAt, getTokenValue, hashCode
-
-
-
-
Constructor Detail
-
OAuth2AccessToken
public OAuth2AccessToken(OAuth2AccessToken.TokenType tokenType, java.lang.String tokenValue, java.time.Instant issuedAt, java.time.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, java.lang.String tokenValue, java.time.Instant issuedAt, java.time.Instant expiresAt, java.util.Set<java.lang.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 Detail
-
getTokenType
public OAuth2AccessToken.TokenType getTokenType()
Returns thetoken type
.- Returns:
- the
OAuth2AccessToken.TokenType
-
getScopes
public java.util.Set<java.lang.String> getScopes()
Returns the scope(s) associated to the token.- Returns:
- the scope(s) associated to the token
-
-