kr / s3

Go package for Amazon’s S3 API
http://godoc.org/github.com/kr/s3
MIT License
107 stars 34 forks source link

Support Expiring URLs #10

Open mfine opened 11 years ago

mfine commented 11 years ago

http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html

You can also send a signature as a URL-encoded query-string parameter in the URL for the request. This is useful if you want to enable a third party to access S3 on your behalf without your having to proxy the data transfer. For example, if you want to enable a user to download your private data directly from S3, you can insert a pre-signed URL into a web page before giving it to your user. The canonicalized string that you sign is the same, except that you replace the DATE field in the string with an Expires field that indicates when you want the signature to expire. The Expires field is given as the number of seconds since epoch time, and is also included as a query string parameter along with your AWS Access Key ID.

kr commented 11 years ago

Oh cool. What would this look like? Maybe

func SignedURL(r *http.Request, expires time.Time, k Keys) *url.URL

?

mfine commented 11 years ago

Took a stab at it. https://github.com/kr/s3/pull/11.

AlekSi commented 10 years ago

+1