Class OAuth2Authorization.Token<T extends org.springframework.security.oauth2.core.OAuth2Token>

java.lang.Object
org.springframework.security.oauth2.server.authorization.OAuth2Authorization.Token<T>
Type Parameters:
T - the type of the OAuth2Token
All Implemented Interfaces:
Serializable
Enclosing class:
OAuth2Authorization

public static class OAuth2Authorization.Token<T extends org.springframework.security.oauth2.core.OAuth2Token> extends Object implements Serializable
A holder of an OAuth 2.0 Token and it's associated metadata.
Since:
0.1.0
See Also:
  • Field Details

    • TOKEN_METADATA_NAMESPACE

      protected static final String TOKEN_METADATA_NAMESPACE
      See Also:
    • INVALIDATED_METADATA_NAME

      public static final String INVALIDATED_METADATA_NAME
      The name of the metadata that indicates if the token has been invalidated.
    • CLAIMS_METADATA_NAME

      public static final String CLAIMS_METADATA_NAME
      The name of the metadata used for the claims of the token.
  • Constructor Details

    • Token

      protected Token(T token)
    • Token

      protected Token(T token, Map<String,Object> metadata)
  • Method Details

    • getToken

      public T getToken()
      Returns the token of type OAuth2Token.
      Returns:
      the token of type OAuth2Token
    • isInvalidated

      public boolean isInvalidated()
      Returns true if the token has been invalidated (e.g. revoked). The default is false.
      Returns:
      true if the token has been invalidated, false otherwise
    • isExpired

      public boolean isExpired()
      Returns true if the token has expired.
      Returns:
      true if the token has expired, false otherwise
    • isBeforeUse

      public boolean isBeforeUse()
      Returns true if the token is before the time it can be used.
      Returns:
      true if the token is before the time it can be used, false otherwise
    • isActive

      public boolean isActive()
      Returns true if the token is currently active.
      Returns:
      true if the token is currently active, false otherwise
    • getClaims

      @Nullable public Map<String,Object> getClaims()
      Returns the claims associated to the token.
      Returns:
      a Map of the claims, or null if not available
    • getMetadata

      @Nullable public <V> V getMetadata(String name)
      Returns the value of the metadata associated to the token.
      Type Parameters:
      V - the value type of the metadata
      Parameters:
      name - the name of the metadata
      Returns:
      the value of the metadata, or null if not available
    • getMetadata

      public Map<String,Object> getMetadata()
      Returns the metadata associated to the token.
      Returns:
      a Map of the metadata
    • defaultMetadata

      protected static Map<String,Object> defaultMetadata()
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object