https://github.com/strd6/s3_policy
Generate a signed S3 policy document for namespaced clientside uploads.
https://github.com/strd6/s3_policy
Last synced: about 1 year ago
JSON representation
Generate a signed S3 policy document for namespaced clientside uploads.
- Host: GitHub
- URL: https://github.com/strd6/s3_policy
- Owner: STRd6
- License: mit
- Created: 2014-07-02T23:14:42.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-12-14T08:33:27.000Z (over 7 years ago)
- Last Synced: 2025-04-03T23:44:30.641Z (about 1 year ago)
- Language: Ruby
- Size: 148 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# S3Policy
Generate a signed S3 policy document for namespaced clientside uploads.
## Installation
Add this line to your application's Gemfile:
gem 's3_policy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install s3_policy
## Usage
```ruby
require 's3_policy'
policy = S3Policy.generate_policy_document(
bucket: "my_awesome_bucket",
namespace: "users/#{user_id}/"
)
signature = S3Policy.sign_document(policy, aws_secret_key)
# Give this to the client
{
aws_access_key_id: aws_access_key_id,
policy: policy,
signature: signature
}
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request