Interface IdentityProvider<IdentityT extends Identity>
-
@SdkPublicApi @ThreadSafe public interface IdentityProvider<IdentityT extends Identity>
Interface for loadingIdentitythat is used for authentication.Identity providers are responsible for resolving credentials, tokens, or other authentication identities that are used by signers to authenticate requests. The SDK provides built-in identity providers for common identity types like
AwsCredentialsIdentityandTokenIdentity.Common Built-in Identity Providers
DefaultCredentialsProvider- Resolves AWS credentials from the default credential chainStaticCredentialsProvider- Provides static AWS credentialsProfileCredentialsProvider- Resolves credentials from AWS profilesStsAssumeRoleCredentialsProvider- Assumes an IAM role using STS
How Identity Providers Work
Identity providers are selected by
software.amazon.awssdk.http.auth.spi.scheme.AuthSchemes based on the identity type they produce. The SDK matches the identity type required by the auth scheme with the appropriate provider fromIdentityProviders.Implementing a Custom Identity Provider
You can implement custom identity providers for specialized authentication scenarios, such as retrieving credentials from a custom credential store or implementing a custom token provider.
Example - Custom credentials provider: {@snippet : public class CustomCredentialsProvider implements IdentityProvider
{ - See Also:
Identity,IdentityProviders,IdentityProperty,software.amazon.awssdk.http.auth.spi.scheme.AuthScheme
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Class<IdentityT>identityType()Retrieve the class of identity this identity provider produces.default CompletableFuture<? extends IdentityT>resolveIdentity()Resolve the identity from this identity provider.default CompletableFuture<? extends IdentityT>resolveIdentity(Consumer<ResolveIdentityRequest.Builder> consumer)Resolve the identity from this identity provider.CompletableFuture<? extends IdentityT>resolveIdentity(ResolveIdentityRequest request)Resolve the identity from this identity provider.
-
-
-
Method Detail
-
identityType
Class<IdentityT> identityType()
Retrieve the class of identity this identity provider produces. This is necessary for the SDK core to determine which identity provider should be used to resolve a specific type of identity.
-
resolveIdentity
CompletableFuture<? extends IdentityT> resolveIdentity(ResolveIdentityRequest request)
Resolve the identity from this identity provider.- Parameters:
request- The request to resolve an Identity
-
resolveIdentity
default CompletableFuture<? extends IdentityT> resolveIdentity(Consumer<ResolveIdentityRequest.Builder> consumer)
Resolve the identity from this identity provider. Similar toresolveIdentity(ResolveIdentityRequest), but takes a lambda to configure a newResolveIdentityRequest.Builder. This removes the need to callResolveIdentityRequest.builder()andSdkBuilder.build().- Parameters:
consumer- AConsumerto which an emptyResolveIdentityRequest.Builderwill be given.
-
resolveIdentity
default CompletableFuture<? extends IdentityT> resolveIdentity()
Resolve the identity from this identity provider.
-
-