From fdec2fa99f5d6b1e91f9216596f6fe58643b8209 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sun, 27 Mar 2016 16:19:55 -0700 Subject: [PATCH] JCLOUDS-766: Do not resign already-signed requests Previously jclouds would add both a V2 and V4 signature to some requests which Amazon rejects. Addresses AWSS3BlobSignerLiveTest test failures with time-limited requests. --- .../aws/s3/filters/AWSRequestAuthorizeSignatureV4.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignatureV4.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignatureV4.java index 6cb3bf13e7..f65040ac75 100644 --- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignatureV4.java +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/filters/AWSRequestAuthorizeSignatureV4.java @@ -17,11 +17,14 @@ package org.jclouds.aws.s3.filters; import static org.jclouds.http.utils.Queries.queryParser; +import static org.jclouds.aws.s3.blobstore.AWSS3BlobRequestSigner.TEMPORARY_SIGNATURE_PARAM; import static org.jclouds.s3.filters.AwsSignatureV4Constants.AMZ_SIGNATURE_PARAM; import javax.inject.Inject; import javax.inject.Singleton; +import com.google.common.collect.Multimap; + import org.jclouds.http.HttpRequest; import org.jclouds.s3.filters.Aws4SignerForAuthorizationHeader; import org.jclouds.s3.filters.Aws4SignerForChunkedUpload; @@ -50,7 +53,8 @@ public class AWSRequestAuthorizeSignatureV4 extends RequestAuthorizeSignatureV4 * with expiration. */ - if (queryParser().apply(request.getEndpoint().getQuery()).containsKey(AMZ_SIGNATURE_PARAM)) { + Multimap queryMap = queryParser().apply(request.getEndpoint().getQuery()); + if (queryMap.containsKey(AMZ_SIGNATURE_PARAM) || queryMap.containsKey(TEMPORARY_SIGNATURE_PARAM)) { return request; } return super.signForAuthorizationHeader(request);