Class CredentialsProviderFactory


  • public final class CredentialsProviderFactory
    extends Object
    Factory class for handling credentials provider creation. This class can be used by any connector that needs to support both OAuth and username/password authentication.
    • Method Detail

      • createCredentialProvider

        public static CredentialsProvider createCredentialProvider​(String secretName,
                                                                   CachableSecretsManager secretsManager,
                                                                   InitializableCredentialsProvider provider)
        Creates a credentials provider based on the secret configuration. If OAuth is configured (determined by the provider's isOAuthConfigured method), creates an instance of the specified OAuth provider. Otherwise, creates a default username/password credentials provider.
        Parameters:
        secretName - The name of the secret in AWS Secrets Manager
        secretsManager - The secrets manager instance
        provider - The InitializableCredentialsProvider instance to check and initialize
        Returns:
        A new CredentialsProvider instance based on the secret configuration
        Throws:
        AthenaConnectorException - if there are errors deserializing the secret or creating the provider
      • createCredentialProvider

        public static CredentialsProvider createCredentialProvider​(String secretName,
                                                                   CachableSecretsManager secretsManager,
                                                                   InitializableCredentialsProvider provider,
                                                                   software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration requestOverrideConfiguration)
        Creates a credentials provider based on the secret configuration with optional request override configuration. If OAuth is configured (determined by the provider's isOAuthConfigured method), creates an instance of the specified OAuth provider. Otherwise, creates a default username/password credentials provider.
        Parameters:
        secretName - The name of the secret in AWS Secrets Manager
        secretsManager - The secrets manager instance
        provider - The InitializableCredentialsProvider instance to check and initialize
        requestOverrideConfiguration - Optional AWS request override configuration for federated requests
        Returns:
        A new CredentialsProvider instance based on the secret configuration
        Throws:
        AthenaConnectorException - if there are errors deserializing the secret or creating the provider