Class TokenManager

java.lang.Object
com.atlan.auth.TokenManager
Direct Known Subclasses:
APITokenManager, EscalationTokenManager, LocalTokenManager, OAuthClientManager, UserTokenManager

public abstract class TokenManager extends Object
Manage authorization tokens in a standard way.
  • Field Details

    • lock

      protected final ReadWriteLock lock
    • token

      protected volatile char[] token
  • Constructor Details

    • TokenManager

      protected TokenManager(char[] token)
  • Method Details

    • getHeader

      public final String getHeader(AtlanClient client) throws AtlanException
      Retrieve the header to use for Authorization using this token.
      Parameters:
      client - through which to retrieve the token (if a refresh is needed)
      Returns:
      the value for the Authorization header
      Throws:
      AtlanException - on any API communication issue during attempted refresh (if needed)
    • getAuthHeader

      protected abstract String getAuthHeader()
      Retrieve the header to use for Authorization using this token.
      Returns:
      the value for the Authorization header
    • refresh

      public final boolean refresh(AtlanClient client) throws AtlanException
      Refresh the managed token for a new, valid token.
      Parameters:
      client - through which to refresh the token
      Returns:
      true iff the refresh was successful
      Throws:
      AtlanException - on any API communication issue during the attempted refresh
    • refreshToken

      protected abstract boolean refreshToken(AtlanClient client) throws AtlanException
      Refresh the managed token for a new, valid token.
      Parameters:
      client - through which to refresh the token
      Returns:
      true iff the refresh was successful
      Throws:
      AtlanException - on any API communication issue during the attempted refresh