Class OAuth2AccessToken

java.lang.Object
org.springframework.security.oauth2.core.AbstractOAuth2Token
org.springframework.security.oauth2.core.OAuth2AccessToken
All Implemented Interfaces:
Serializable, OAuth2Token

public class OAuth2AccessToken extends AbstractOAuth2Token
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:
  • Constructor Details

    • OAuth2AccessToken

      public OAuth2AccessToken(OAuth2AccessToken.TokenType tokenType, String tokenValue, Instant issuedAt, Instant expiresAt)
      Constructs an OAuth2AccessToken using the provided parameters.
      Parameters:
      tokenType - the token type
      tokenValue - the token value
      issuedAt - the time at which the token was issued
      expiresAt - 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 an OAuth2AccessToken using the provided parameters.
      Parameters:
      tokenType - the token type
      tokenValue - the token value
      issuedAt - the time at which the token was issued
      expiresAt - the expiration time on or after which the token MUST NOT be accepted
      scopes - the scope(s) associated to the token
  • Method Details