Class AbstractAwsSigner
- java.lang.Object
-
- software.amazon.awssdk.auth.signer.internal.AbstractAwsSigner
-
- All Implemented Interfaces:
Signer
- Direct Known Subclasses:
AbstractAws4Signer
public abstract class AbstractAwsSigner extends Object implements Signer
Abstract base class for AWS signing protocol implementations. Provides utilities commonly needed by signing protocols such as computing canonicalized host names, query string parameters, etc.Not intended to be sub-classed by developers.
-
-
Constructor Summary
Constructors Constructor Description AbstractAwsSigner()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addSessionCredentials(SdkHttpFullRequest.Builder mutableRequest, AwsSessionCredentials credentials)
Adds session credentials to the request given.protected InputStream
getBinaryRequestPayloadStream(ContentStreamProvider streamProvider)
protected AwsCredentials
sanitizeCredentials(AwsCredentials credentials)
Loads the individual access key ID and secret key from the specified credentials, trimming any extra whitespace from the credentials.protected byte[]
sign(byte[] data, byte[] key, SigningAlgorithm algorithm)
protected byte[]
sign(String stringData, byte[] key, SigningAlgorithm algorithm)
protected String
signAndBase64Encode(String data, String key, SigningAlgorithm algorithm)
Computes an RFC 2104-compliant HMAC signature and returns the result as a Base64 encoded string.protected byte[]
signWithMac(String stringData, Mac mac)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.core.signer.Signer
credentialType, sign
-
-
-
-
Method Detail
-
signAndBase64Encode
protected String signAndBase64Encode(String data, String key, SigningAlgorithm algorithm) throws SdkClientException
Computes an RFC 2104-compliant HMAC signature and returns the result as a Base64 encoded string.- Throws:
SdkClientException
-
sign
protected byte[] sign(String stringData, byte[] key, SigningAlgorithm algorithm) throws SdkClientException
- Throws:
SdkClientException
-
sign
protected byte[] sign(byte[] data, byte[] key, SigningAlgorithm algorithm) throws SdkClientException
- Throws:
SdkClientException
-
getBinaryRequestPayloadStream
protected InputStream getBinaryRequestPayloadStream(ContentStreamProvider streamProvider)
-
sanitizeCredentials
protected AwsCredentials sanitizeCredentials(AwsCredentials credentials)
Loads the individual access key ID and secret key from the specified credentials, trimming any extra whitespace from the credentials.Returns either a
AwsSessionCredentials
or aAwsBasicCredentials
object, depending on the input type.- Returns:
- A new credentials object with the sanitized credentials.
-
addSessionCredentials
protected abstract void addSessionCredentials(SdkHttpFullRequest.Builder mutableRequest, AwsSessionCredentials credentials)
Adds session credentials to the request given.- Parameters:
mutableRequest
- The request to add session credentials information tocredentials
- The session credentials to add to the request
-
-