Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import software.amazon.awssdk.core.interceptor.ExecutionAttributes;
import software.amazon.awssdk.core.signer.Signer;
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.http.SdkHttpMethod;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.slf4j.Logger;
Expand All @@ -56,6 +57,7 @@
import static org.apache.hadoop.fs.s3a.Constants.CUSTOM_SIGNERS;
import static org.apache.hadoop.fs.s3a.Constants.ENABLE_MULTI_DELETE;
import static org.apache.hadoop.fs.s3a.Constants.SIGNING_ALGORITHM_S3;
import static software.amazon.awssdk.auth.signer.S3SignerExecutionAttribute.ENABLE_PAYLOAD_SIGNING;
import static org.apache.hadoop.fs.s3a.MultipartTestUtils.createMagicFile;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.disableFilesystemCaching;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides;
Expand Down Expand Up @@ -278,6 +280,17 @@ public SdkHttpFullRequest sign(SdkHttpFullRequest request,
return realKMSSigner.sign(request, executionAttributes);
} else {
AwsS3V4Signer realSigner = AwsS3V4Signer.create();
if (request.method() == SdkHttpMethod.POST) {
// we need this to work, the attribute is tagged @SdkProtectedApi, this is only needed
// for S3Express buckets.
executionAttributes.putAttribute(ENABLE_PAYLOAD_SIGNING, Boolean.TRUE);
}
if(LOG.isDebugEnabled()) {
LOG.debug("Request Headers:");
for (String hd : request.headers().keySet()) {
LOG.debug("{}={}", hd, request.headers().get(hd));
}
}
return realSigner.sign(request, executionAttributes);
}
}
Expand Down