Class AbstractOAuth2Token

java.lang.Object
org.springframework.security.oauth2.core.AbstractOAuth2Token
All Implemented Interfaces:
Serializable, OAuth2Token
Direct Known Subclasses:
Jwt, OAuth2AccessToken, OAuth2DeviceCode, OAuth2RefreshToken, OAuth2UserCode, OidcIdToken, OidcLogoutToken

public abstract class AbstractOAuth2Token extends Object implements OAuth2Token, Serializable
Base class for OAuth 2.0 Token implementations.
Since:
5.0
See Also:
  • Constructor Details

    • AbstractOAuth2Token

      protected AbstractOAuth2Token(String tokenValue)
      Sub-class constructor.
      Parameters:
      tokenValue - the token value
    • AbstractOAuth2Token

      protected AbstractOAuth2Token(String tokenValue, @Nullable Instant issuedAt, @Nullable Instant expiresAt)
      Sub-class constructor.
      Parameters:
      tokenValue - the token value
      issuedAt - the time at which the token was issued, may be null
      expiresAt - the expiration time on or after which the token MUST NOT be accepted, may be null
  • Method Details

    • getTokenValue

      public String getTokenValue()
      Returns the token value.
      Specified by:
      getTokenValue in interface OAuth2Token
      Returns:
      the token value
    • getIssuedAt

      @Nullable public Instant getIssuedAt()
      Returns the time at which the token was issued.
      Specified by:
      getIssuedAt in interface OAuth2Token
      Returns:
      the time the token was issued or null
    • getExpiresAt

      @Nullable public Instant getExpiresAt()
      Returns the expiration time on or after which the token MUST NOT be accepted.
      Specified by:
      getExpiresAt in interface OAuth2Token
      Returns:
      the token expiration time or null
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object