Class AccessToken

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    IdToken

    public class AccessToken
    extends java.lang.Object
    implements java.io.Serializable
    Represents a temporary OAuth2 access token and its expiration information.
    See Also:
    Serialized Form
    • Field Detail

      • tokenValue

        private final java.lang.String tokenValue
      • expirationTimeMillis

        private final java.lang.Long expirationTimeMillis
      • scopes

        private final java.util.List<java.lang.String> scopes
    • Constructor Detail

      • AccessToken

        public AccessToken​(java.lang.String tokenValue,
                           java.util.Date expirationTime)
        Parameters:
        tokenValue - String representation of the access token.
        expirationTime - Time when access token will expire.
    • Method Detail

      • getScopes

        public java.util.List<java.lang.String> getScopes()
        Scopes from the access token response. Not all credentials provide scopes in response and as per https://datatracker.ietf.org/doc/html/rfc6749#section-5.1 it is optional in the response.
        Returns:
        List of scopes
      • getTokenValue

        public java.lang.String getTokenValue()
        String representation of the access token.
        Returns:
        The raw access token string value.
      • getExpirationTime

        public java.util.Date getExpirationTime()
        Time when access token will expire.
        Returns:
        The expiration time as a Date.
      • getExpirationTimeMillis

        java.lang.Long getExpirationTimeMillis()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object