guardian/frontend — pull request #2660 by janua (2014-01-03 17:45:32+00:00)
Title: Authenticated S3 requests

This adds a trait and companion object `SecureS3Request` for making authenticated requests to S3. Some URLs within our bucket will change from public to private in the future, mainly for `collection.json` URLs.

Instead of going through the **blocking** `AmazonS3Client`, I have used `WS` from `Play`. This just returns a `WsRequestHolder` for you to then subsequently make the `GET` request with. This does not support other requests right now other than `GET`.

The idea now is to provide the ID for the item you want inside the bucket the configuration points to.

It uses `Configuration.frontend.store` as the URL to make a request to, and your `Configuration.aws.bucket`, `accessKey` and `secretKey` to generate a `SHA1`.

There is also a metric added to know if there have been any problems with S3 requests resulting in `403`.

These requests work for both public and private URLs. If the hash is wrong for either, it will fail even if public. The handy thing now is that requests to S3 for non existent items result in better response codes. Before, if you request an ID that does not exist you always receive a `403`, but this will now be a `404`.