Class OAuth2AccessToken

  • All Implemented Interfaces:
    java.io.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:
    Section 1.4 Access Token, Serialized Form
    • Constructor Detail

      • OAuth2AccessToken

        public OAuth2AccessToken​(OAuth2AccessToken.TokenType tokenType,
                                 java.lang.String tokenValue,
                                 java.time.Instant issuedAt,
                                 java.time.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,
                                 java.lang.String tokenValue,
                                 java.time.Instant issuedAt,
                                 java.time.Instant expiresAt,
                                 java.util.Set<java.lang.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