Reputation: 65
I am using Google App Engine (java-based) to create a signed url for my files in google cloud storage. According to google cloud description, we need to define the expiration period. For example, can I create a long-term expiration period like 50 years? Google has not been very specific about this. It has mentioned 7 days, but my signed url has been working beyond 7 days.
On example like:
URL signedURL = storage.signUrl(blobinfo, 18000, TimeUnit.DAYS);
Upvotes: 1
Views: 2612
Reputation: 1024
The Signed URL limit of 7 days of expiration applies to V4 signing. As you are not specifying the signing version in your code, V2 will be used as default.
In the source code of the library in github here there's a comment stating that the V4 has a 7 day limit but it doesn't say anything about the V2. The V2 signing doesn't have any specific expiration limit, so the only limitation is the maximum value for int.
If you want to use V4 signing you have to include withV4Signature()
, for example:
URL url = storage.signUrl(blobinfo, 15, TimeUnit.MINUTES, Storage.SignUrlOption.withV4Signature());
Upvotes: 3