Class AbstractSessionCredentialsProvider

java.lang.Object
org.apache.hadoop.fs.s3a.auth.AbstractAWSCredentialProvider
org.apache.hadoop.fs.s3a.auth.AbstractSessionCredentialsProvider
All Implemented Interfaces:
software.amazon.awssdk.auth.credentials.AwsCredentialsProvider, software.amazon.awssdk.identity.spi.IdentityProvider<software.amazon.awssdk.identity.spi.AwsCredentialsIdentity>
Direct Known Subclasses:
MarshalledCredentialProvider, TemporaryAWSCredentialsProvider

@Private public abstract class AbstractSessionCredentialsProvider extends AbstractAWSCredentialProvider
Base class for session credential support.
  • Constructor Details

    • AbstractSessionCredentialsProvider

      public AbstractSessionCredentialsProvider(@Nullable URI uri, org.apache.hadoop.conf.Configuration conf)
      Constructor.
      Parameters:
      uri - possibly null filesystem URI.
      conf - configuration.
  • Method Details

    • init

      @OnceTranslated protected void init() throws IOException
      Initialize the credentials by calling createCredentials(Configuration) with the current config.
      Throws:
      IOException - on any failure.
    • isInitialized

      public boolean isInitialized()
      Has an attempt to initialize the credentials been attempted?
      Returns:
      true if init() was called.
    • createCredentials

      protected abstract software.amazon.awssdk.auth.credentials.AwsCredentials createCredentials(org.apache.hadoop.conf.Configuration config) throws IOException
      Implementation point: whatever the subclass must do to load credentials. This is called from init() and then the credentials are cached, along with any exception.
      Parameters:
      config - the configuration
      Returns:
      the credentials
      Throws:
      IOException - on any failure.
    • resolveCredentials

      public software.amazon.awssdk.auth.credentials.AwsCredentials resolveCredentials() throws software.amazon.awssdk.core.exception.SdkException
      Get the credentials. Any exception raised in createCredentials(Configuration) is thrown here before any attempt to return the credentials is made.
      Returns:
      credentials, if set.
      Throws:
      software.amazon.awssdk.core.exception.SdkException - if one was raised during init
      CredentialInitializationException - on other failures.
    • hasCredentials

      public final boolean hasCredentials()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getInitializationException

      @VisibleForTesting public IOException getInitializationException()
      Get any IOE raised during initialization. Null if init() hasn't been called, or it actually worked.
      Returns:
      an exception or null.