Interface AuthScheme<T extends Identity>
-
- Type Parameters:
T- The type of theIdentityused by this authentication scheme.
@SdkPublicApi public interface AuthScheme<T extends Identity>
An authentication scheme, composed of:- A scheme ID - A unique identifier for the authentication scheme.
- An identity provider - An API that can be queried to acquire the customer's identity.
- A signer - An API that can be used to sign HTTP requests.
Auth schemes are used to configure how requests are authenticated. The SDK provides built-in schemes like
AwsV4AuthSchemefor AWS Signature Version 4, but you can implement custom schemes for specialized authentication requirements.See example auth schemes defined here.
Implementing a Custom Auth Scheme
To implement a custom authentication scheme, you need to:
- Implement the
AuthSchemeinterface - Implement a custom
HttpSigner - Configure the scheme on the client builder
Example - Custom authentication scheme with custom signer: {@snippet : // Step 1: Implement custom signer public class CustomHttpSigner implements HttpSigner
{ public static final SignerProperty CUSTOM_HEADER = SignerProperty.create(CustomHttpSigner.class, "CustomHeader"); - See Also:
IdentityProvider,HttpSigner,AuthSchemeProvider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IdentityProvider<T>identityProvider(IdentityProviders providers)Retrieve the identity provider associated with this authentication scheme.StringschemeId()Retrieve the scheme ID, a unique identifier for the authentication scheme.HttpSigner<T>signer()Retrieve the signer associated with this authentication scheme.
-
-
-
Method Detail
-
schemeId
String schemeId()
Retrieve the scheme ID, a unique identifier for the authentication scheme.
-
identityProvider
IdentityProvider<T> identityProvider(IdentityProviders providers)
Retrieve the identity provider associated with this authentication scheme. The identity generated by this provider is guaranteed to be supported by the signer in this authentication scheme.For example, if the scheme ID is aws.auth#sigv4, the provider returns an
AwsCredentialsIdentity, if the scheme ID is httpBearerAuth, the provider returns aTokenIdentity.Note, the returned identity provider may differ from the type of identity provider retrieved from the provided
IdentityProviders.
-
signer
HttpSigner<T> signer()
Retrieve the signer associated with this authentication scheme. This signer is guaranteed to support the identity generated by the identity provider in this authentication scheme.
-
-