Class AzureADTokenProvider

java.lang.Object
org.apache.hadoop.fs.adl.oauth2.AzureADTokenProvider

@Public @Evolving public abstract class AzureADTokenProvider extends Object
Provide an Azure Active Directory supported OAuth2 access token to be used to authenticate REST calls against Azure data lake file system AdlFileSystem.
  • Constructor Details

    • AzureADTokenProvider

      public AzureADTokenProvider()
  • Method Details

    • initialize

      public abstract void initialize(Configuration configuration) throws IOException
      Initialize with supported configuration. This method is invoked when the (URI, Configuration) method is invoked.
      Parameters:
      configuration - Configuration object
      Throws:
      IOException - if instance can not be configured.
    • getAccessToken

      public abstract String getAccessToken() throws IOException
      Obtain the access token that should be added to https connection's header. Will be called depending upon getExpiryTime() expiry time is set, so implementations should be performant. Implementations are responsible for any refreshing of the token.
      Returns:
      String containing the access token
      Throws:
      IOException - if there is an error fetching the token
    • getExpiryTime

      public abstract Date getExpiryTime()
      Obtain expiry time of the token. If implementation is performant enough to maintain expiry and expect getAccessToken() call for every connection then safe to return current or past time. However recommended to use the token expiry time received from Azure Active Directory.
      Returns:
      Date to expire access token retrieved from AAD.