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
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 Modifier and Type Field Description static String
EMPTY_STRING_SHA256_HEX
-
Constructor Summary
Constructors Constructor Description AbstractAws4Signer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addSessionCredentials(SdkHttpFullRequest.Builder mutableRequest, AwsSessionCredentials credentials)
Adds session credentials to the request given.protected String
calculateContentHash(SdkHttpFullRequest.Builder mutableRequest, T signerParams)
Calculate the hash of the request's payload.protected String
calculateContentHash(SdkHttpFullRequest.Builder mutableRequest, T signerParams, SdkChecksum contentFlexibleChecksum)
This method overloads calculateContentHash with contentFlexibleChecksum.protected abstract String
calculateContentHashPresign(SdkHttpFullRequest.Builder mutableRequest, U signerParams)
protected byte[]
deriveSigningKey(AwsCredentials credentials, Instant signingInstant, String region, String service)
protected byte[]
deriveSigningKey(AwsCredentials credentials, Aws4SignerRequestParams signerRequestParams)
Step 3 of the AWS Signature version 4 calculation.protected SdkHttpFullRequest.Builder
doPresign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, U signingParams)
protected SdkHttpFullRequest.Builder
doSign(SdkHttpFullRequest request, Aws4SignerRequestParams requestParams, T signingParams)
protected SdkHttpFullRequest.Builder
doSign(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 void
processRequestPayload(SdkHttpFullRequest.Builder mutableRequest, byte[] signature, byte[] signingKey, Aws4SignerRequestParams signerRequestParams, T signerParams)
protected abstract void
processRequestPayload(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, signWithMac
-
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
-
-
-
-
Field Detail
-
EMPTY_STRING_SHA256_HEX
public static final String EMPTY_STRING_SHA256_HEX
-
-
Method Detail
-
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:AbstractAwsSigner
Adds session credentials to the request given.- Specified by:
addSessionCredentials
in classAbstractAwsSigner
- Parameters:
mutableRequest
- The request to add session credentials information tocredentials
- The session credentials to add to the request
-
calculateContentHash
protected String calculateContentHash(SdkHttpFullRequest.Builder mutableRequest, T signerParams)
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)
-
-