Class AbstractAws4Signer<T extends Aws4SignerParams,U extends Aws4PresignerParams>
java.lang.Object
software.amazon.awssdk.auth.signer.internal.AbstractAwsSigner
software.amazon.awssdk.auth.signer.internal.AbstractAws4Signer<T,U>
- Type Parameters:
T- Type of the signing params class that is used for signing the requestU- Type of the signing params class that is used for pre signing the request
- Direct Known Subclasses:
AbstractAwsS3V4Signer,BaseAws4Signer
@SdkInternalApi
public abstract class AbstractAws4Signer<T extends Aws4SignerParams,U extends Aws4PresignerParams>
extends AbstractAwsSigner
implements Presigner
Abstract base class for the AWS SigV4 signer implementations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddSessionCredentials(SdkHttpFullRequest.Builder mutableRequest, AwsSessionCredentials credentials) Adds session credentials to the request given.protected StringcalculateContentHash(SdkHttpFullRequest.Builder mutableRequest, T signerParams) Calculate the hash of the request's payload.protected StringcalculateContentHash(SdkHttpFullRequest.Builder mutableRequest, T signerParams, SdkChecksum contentFlexibleChecksum) This method overloads calculateContentHash with contentFlexibleChecksum.protected abstract StringcalculateContentHashPresign(SdkHttpFullRequest.Builder mutableRequest, U signerParams) protected final byte[]deriveSigningKey(AwsCredentials credentials, Instant signingInstant, String region, String service) protected final byte[]deriveSigningKey(AwsCredentials credentials, Aws4SignerRequestParams signerRequestParams) Step 3 of the AWS Signature version 4 calculation.protected SdkHttpFullRequest.BuilderdoPresign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, U signingParams) protected SdkHttpFullRequest.BuilderdoSign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, T signingParams) protected SdkHttpFullRequest.BuilderdoSign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, T signingParams, ContentChecksum contentChecksum) protected <B extends Aws4PresignerParams.Builder>
BextractPresignerParams(B builder, ExecutionAttributes executionAttributes) protected <B extends Aws4SignerParams.Builder>
BextractSignerParams(B paramsBuilder, ExecutionAttributes executionAttributes) protected abstract voidprocessRequestPayload(SdkHttpFullRequest.Builder mutableRequest, byte[] signature, byte[] signingKey, Aws4SignerRequestParams signerRequestParams, T signerParams) protected abstract voidprocessRequestPayload(SdkHttpFullRequest.Builder mutableRequest, byte[] signature, byte[] signingKey, Aws4SignerRequestParams signerRequestParams, T signerParams, SdkChecksum sdkChecksum) Methods inherited from class software.amazon.awssdk.auth.signer.internal.AbstractAwsSigner
getBinaryRequestPayloadStream, sanitizeCredentials, sign, sign, signAndBase64Encode, signWithMacMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.awssdk.core.signer.Signer
credentialType, sign
-
Field Details
-
EMPTY_STRING_SHA256_HEX
-
-
Constructor Details
-
AbstractAws4Signer
public AbstractAws4Signer()
-
-
Method Details
-
doSign
protected SdkHttpFullRequest.Builder doSign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, T signingParams) -
doSign
protected SdkHttpFullRequest.Builder doSign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, T signingParams, ContentChecksum contentChecksum) -
doPresign
protected SdkHttpFullRequest.Builder doPresign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, U signingParams) -
addSessionCredentials
protected void addSessionCredentials(SdkHttpFullRequest.Builder mutableRequest, AwsSessionCredentials credentials) Description copied from class:AbstractAwsSignerAdds session credentials to the request given.- Specified by:
addSessionCredentialsin classAbstractAwsSigner- Parameters:
mutableRequest- The request to add session credentials information tocredentials- The session credentials to add to the request
-
calculateContentHash
Calculate the hash of the request's payload. Subclass could override this method to provide different values for "x-amz-content-sha256" header or do any other necessary set-ups on the request headers. (e.g. aws-chunked uses a pre-defined header value, and needs to change some headers relating to content-encoding and content-length.) -
calculateContentHash
protected String calculateContentHash(SdkHttpFullRequest.Builder mutableRequest, T signerParams, SdkChecksum contentFlexibleChecksum) This method overloads calculateContentHash with contentFlexibleChecksum. The contentFlexibleChecksum is computed at the same time while hash is calculated for Content. -
processRequestPayload
protected abstract void processRequestPayload(SdkHttpFullRequest.Builder mutableRequest, byte[] signature, byte[] signingKey, Aws4SignerRequestParams signerRequestParams, T signerParams) -
processRequestPayload
protected abstract void processRequestPayload(SdkHttpFullRequest.Builder mutableRequest, byte[] signature, byte[] signingKey, Aws4SignerRequestParams signerRequestParams, T signerParams, SdkChecksum sdkChecksum) -
calculateContentHashPresign
protected abstract String calculateContentHashPresign(SdkHttpFullRequest.Builder mutableRequest, U signerParams) -
deriveSigningKey
protected final byte[] deriveSigningKey(AwsCredentials credentials, Aws4SignerRequestParams signerRequestParams) Step 3 of the AWS Signature version 4 calculation. It involves deriving the signing key and computing the signature. Refer to http://docs.aws.amazon .com/general/latest/gr/sigv4-calculate-signature.html -
deriveSigningKey
protected final byte[] deriveSigningKey(AwsCredentials credentials, Instant signingInstant, String region, String service) -
extractPresignerParams
protected <B extends Aws4PresignerParams.Builder> B extractPresignerParams(B builder, ExecutionAttributes executionAttributes) -
extractSignerParams
protected <B extends Aws4SignerParams.Builder> B extractSignerParams(B paramsBuilder, ExecutionAttributes executionAttributes)
-