Class AccessToken


  • public class AccessToken
    extends Object
    An access token that can be used for authentication to make calls to Ethos Integration. To get an Authorization header that can be used to make HTTP requests, use the getAuthHeader() method. This will return a Map containing a single entry of the Authorization header key/value pair. That can be used as-is or added to an existing headers map to pass to the EthosClient making the requests.
    Since:
    0.0.1
    • Constructor Detail

      • AccessToken

        public AccessToken​(String token,
                           LocalDateTime expirationTime)
        Creates an instance of an access token that expires at the given time.
        Parameters:
        token - an encoded JWT string
        expirationTime - the time when this token will expire
    • Method Detail

      • getToken

        public String getToken()
        Gets the JWT value for this access token.
        Returns:
        encoded JWT string
      • getExpirationTime

        public LocalDateTime getExpirationTime()
        Gets the time when this access token will expire
        Returns:
        the expiration time
      • isValid

        public boolean isValid()
        Determines if the token is still valid, meaning that is has a JWT string and it is not expired.
        Returns:
        if the token is valid.
      • getAuthHeader

        public Map<String,​String> getAuthHeader()
        Gets an HTTP Authorization header containing the access token.
        Returns:
        Authorization header containing the access token