From 3a1710d15c1a778ed79a504258bf37011a6e0ec9 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 18 Apr 2017 18:49:02 -0700 Subject: [PATCH] Default Swift signer timeout to 15 minutes This matches other providers. --- .../RegionScopedTemporaryUrlBlobSigner.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedTemporaryUrlBlobSigner.java b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedTemporaryUrlBlobSigner.java index c227e042e5..d4182d7c2f 100644 --- a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedTemporaryUrlBlobSigner.java +++ b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedTemporaryUrlBlobSigner.java @@ -43,7 +43,7 @@ import com.google.inject.name.Named; /** * Uses {@link TemporaryUrlSigner} to sign requests for access to blobs. If no - * interval is supplied, it defaults to a year. + * interval is supplied, it defaults to a 15 minutes. */ public class RegionScopedTemporaryUrlBlobSigner implements BlobRequestSigner { @@ -57,7 +57,7 @@ public class RegionScopedTemporaryUrlBlobSigner implements BlobRequestSigner { this.storageUrl = regionToUris.get().get(regionId).get(); } - private static final long YEAR = TimeUnit.DAYS.toSeconds(365); + private static final long DEFAULT_SIGNING_TIMEOUT = TimeUnit.MINUTES.toSeconds(15); private final BlobToHttpGetOptions toGetOptions = new BlobToHttpGetOptions(); private final Provider timestamp; private final TemporaryUrlSigner signer; @@ -65,7 +65,7 @@ public class RegionScopedTemporaryUrlBlobSigner implements BlobRequestSigner { @Override public HttpRequest signGetBlob(String container, String name) { - return signGetBlob(container, name, YEAR); + return signGetBlob(container, name, DEFAULT_SIGNING_TIMEOUT); } @Override @@ -75,12 +75,12 @@ public class RegionScopedTemporaryUrlBlobSigner implements BlobRequestSigner { @Override public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) { - return sign("GET", container, name, toGetOptions.apply(options), timestamp.get() + YEAR); + return sign("GET", container, name, toGetOptions.apply(options), timestamp.get() + DEFAULT_SIGNING_TIMEOUT); } @Override public HttpRequest signPutBlob(String container, Blob blob) { - return signPutBlob(container, blob, YEAR); + return signPutBlob(container, blob, DEFAULT_SIGNING_TIMEOUT); } @Override @@ -91,7 +91,7 @@ public class RegionScopedTemporaryUrlBlobSigner implements BlobRequestSigner { @Deprecated @Override public HttpRequest signRemoveBlob(String container, String name) { - return sign("DELETE", container, name, GetOptions.NONE, timestamp.get() + YEAR); + return sign("DELETE", container, name, GetOptions.NONE, timestamp.get() + DEFAULT_SIGNING_TIMEOUT); } private HttpRequest sign(String method, String container, String name, GetOptions options, long expires) {