Interface HttpSigner<IdentityT extends Identity>
- Type Parameters:
IdentityT- The type of the identity.
- All Known Implementing Classes:
NoOpHttpSigner
Interface for the process of modifying a request destined for a service so that the service can authenticate the SDK customer’s
identity.
You can configure the signer by first implementing a custom AuthScheme returning this signer and then configuring
the AuthSchemes on the client builder via SdkClientBuilder#putAuthScheme(AuthScheme).
Example - Custom signer implementation:
When to Use Each Approach
- Use custom
AuthSchemeProviderwhen you only need to override signing properties (service name, region, etc.). SeeAuthSchemeProviderfor examples. - Use custom
HttpSignerwhen you need to change the signing algorithm or logic itself.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SignerProperty<Clock>AClockto be used to derive the signing time. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends Identity>
HttpSigner<T>Retrieve a signer that returns the input message, without signing.default SignedRequestsign(Consumer<SignRequest.Builder<IdentityT>> consumer) Method that takes in inputs to sign a request with sync payload and returns a signed version of the request.sign(SignRequest<? extends IdentityT> request) Method that takes in inputs to sign a request with sync payload and returns a signed version of the request.default CompletableFuture<AsyncSignedRequest>signAsync(Consumer<AsyncSignRequest.Builder<IdentityT>> consumer) Method that takes in inputs to sign a request with async payload and returns a future containing the signed version of the request.signAsync(AsyncSignRequest<? extends IdentityT> request) Method that takes in inputs to sign a request with async payload and returns a future containing the signed version of the request.
-
Field Details
-
SIGNING_CLOCK
AClockto be used to derive the signing time. This property defaults to the system clock.Note, signing time may not be relevant to some signers.
-
-
Method Details
-
doNotSign
Retrieve a signer that returns the input message, without signing. -
sign
Method that takes in inputs to sign a request with sync payload and returns a signed version of the request.- Parameters:
request- The inputs to sign a request.- Returns:
- A signed version of the request.
-
sign
Method that takes in inputs to sign a request with sync payload and returns a signed version of the request.Similar to
sign(SignRequest), but takes a lambda to configure a newSignRequest.Builder. This removes the need to callSignRequest#builder(IdentityT)} andSdkBuilder.build().- Parameters:
consumer- AConsumerto which an emptySignRequest.Builderwill be given.- Returns:
- A signed version of the request.
-
signAsync
Method that takes in inputs to sign a request with async payload and returns a future containing the signed version of the request.- Parameters:
request- The inputs to sign a request.- Returns:
- A future containing the signed version of the request.
-
signAsync
default CompletableFuture<AsyncSignedRequest> signAsync(Consumer<AsyncSignRequest.Builder<IdentityT>> consumer) Method that takes in inputs to sign a request with async payload and returns a future containing the signed version of the request.Similar to
signAsync(AsyncSignRequest), but takes a lambda to configure a newAsyncSignRequest.Builder. This removes the need to callAsyncSignRequest#builder(IdentityT)} andSdkBuilder.build().- Parameters:
consumer- AConsumerto which an emptyBaseSignRequest.Builderwill be given.- Returns:
- A future containing the signed version of the request.
-