Class AbstractTokenAPIHandler

    • Constructor Detail

      • AbstractTokenAPIHandler

        protected AbstractTokenAPIHandler​(AbstractTokenAPIHandler.Conf builder)
        Constructor
        Parameters:
        builder - The builder to use.
    • Method Detail

      • addToHeaders

        public void addToHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
        Override this to add authentication tokens. TokenHandlers do not have tokens, so this only returns default headers.
        Specified by:
        addToHeaders in class AbstractAPIHandler
        Parameters:
        headers - Map of headers with initial values.
      • getToken

        public abstract java.lang.String getToken()
                                           throws java.io.IOException,
                                                  java.lang.InterruptedException,
                                                  HiroException
        Return the current token.
        Returns:
        The current token.
        Throws:
        java.lang.InterruptedException - When call gets interrupted.
        java.io.IOException - When call has IO errors.
        HiroException - On Hiro protocol / handling errors.
      • refreshToken

        public abstract void refreshToken()
                                   throws java.io.IOException,
                                          java.lang.InterruptedException,
                                          HiroException
        Refresh an invalid token.
        Throws:
        java.lang.InterruptedException - When call gets interrupted.
        java.io.IOException - When call has IO errors.
        HiroException - On Hiro protocol / handling errors.
      • revokeToken

        public abstract void revokeToken()
                                  throws java.io.IOException,
                                         java.lang.InterruptedException,
                                         HiroException
        Revoke a token
        Throws:
        java.lang.InterruptedException - When call gets interrupted.
        java.io.IOException - When call has IO errors.
        HiroException - On Hiro protocol / handling errors.
      • hasToken

        public abstract boolean hasToken()
        Check for existence of a token in the TokenAPIHandler.
        Returns:
        true if a token has been set or retrieved, false if the token is empty.
      • hasRefreshToken

        public abstract boolean hasRefreshToken()
        Check for existence of a refresh token in the TokenAPIHandler.
        Returns:
        true if a refresh token retrieved, false if no such token exists or these tokens are not applicable for this TokenAPIHandler.
      • expiryInstant

        public abstract java.time.Instant expiryInstant()
        Calculate the Instant after which the token should be refreshed.
        Returns:
        The Instant after which the token shall be refreshed. null if token cannot be refreshed.