Class OAuth2TokenProvider

java.lang.Object
org.apache.gravitino.client.OAuth2TokenProvider
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
DefaultOAuth2TokenProvider

public abstract class OAuth2TokenProvider extends Object
OAuth2TokenProvider will request the access token from the authorization server and then provide the access token for every request.
  • Field Details

    • client

      protected HTTPClient client
      The HTTP client used to request the access token from the authorization server.
  • Constructor Details

    • OAuth2TokenProvider

      public OAuth2TokenProvider()
  • Method Details

    • hasTokenData

      public boolean hasTokenData()
      Judge whether AuthDataProvider can provide token data.
      Returns:
      true if the AuthDataProvider can provide token data otherwise false.
    • getTokenData

      public byte[] getTokenData()
      Acquire the data of token for authentication. The client will set the token data as HTTP header Authorization directly. So the return value should ensure token data contain the token header (eg: Bearer, Basic) if necessary.
      Returns:
      the token data is used for authentication.
    • close

      public void close() throws IOException
      Closes the OAuth2TokenProvider and releases any underlying resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getAccessToken

      protected abstract String getAccessToken()
      Get the access token from the authorization server.
      Returns:
      The access token.