Interface IdentityProviders

All Superinterfaces:
ToCopyableBuilder<IdentityProviders.Builder,IdentityProviders>
All Known Implementing Classes:
DefaultIdentityProviders

An interface to allow retrieving an IdentityProvider based on the identity type.

IdentityProviders is a registry that maps identity types to their corresponding identity providers. It is used by AuthSchemes to retrieve the appropriate identity provider for resolving authentication identities.

How It Works

When an auth scheme needs to resolve an identity, it calls identityProvider(Class) with the identity type it requires (e.g., AwsCredentialsIdentity.class). The registry returns the corresponding provider that was configured on the client.

Default Configuration

The SDK automatically configures identity providers based on the client configuration:

  • When you set credentialsProvider() on the client builder, it registers an AwsCredentialsIdentity provider
  • When you set tokenProvider() on the client builder, it registers a TokenIdentity provider

Usage in Auth Schemes

Auth schemes use IdentityProviders to retrieve the appropriate identity provider for their identity type.

Example - Auth scheme using IdentityProviders:

public class CustomAuthScheme implements AwsV4AuthScheme {
    @Override
    public String schemeId() {
        return AwsV4AuthScheme.SCHEME_ID;
    }

    @Override
    public IdentityProvider<AwsCredentialsIdentity> identityProvider(IdentityProviders providers) {
        // Retrieve the AWS credentials provider from the registry
        return providers.identityProvider(AwsCredentialsIdentity.class);
    }

    @Override
    public AwsV4HttpSigner signer() {
        return new CustomSigV4Signer();
    }
}

Standard Identity Types

The SDK provides standard identity types:

See Also: