Class: Aws::S3::Presigner
- Inherits:
-
Object
- Object
- Aws::S3::Presigner
- Defined in:
- lib/aws-sdk-s3/presigner.rb
Overview
Constant Summary collapse
- ONE_WEEK =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
60 * 60 * 24 * 7
- FIFTEEN_MINUTES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
60 * 15
- BLACKLISTED_HEADERS =
[ 'accept', 'cache-control', 'content-length', # due to a ELB bug 'expect', 'from', 'if-match', 'if-none-match', 'if-modified-since', 'if-unmodified-since', 'if-range', 'max-forwards', 'pragma', 'proxy-authorization', 'referer', 'te', 'user-agent' ].freeze
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Presigner
constructor
A new instance of Presigner.
- #presigned_url(method, params = {}) ⇒ Object
Constructor Details
Instance Method Details
#presigned_url(method, params = {}) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/aws-sdk-s3/presigner.rb', line 76 def presigned_url(method, params = {}) if params[:key].nil? or params[:key] == '' raise ArgumentError, ":key must not be blank" end virtual_host = !!params.delete(:virtual_host) time = params.delete(:time) whitelisted_headers = params.delete(:whitelist_headers) || [] unsigned_headers = BLACKLISTED_HEADERS - whitelisted_headers scheme = http_scheme(params, virtual_host) req = @client.build_request(method, params) use_bucket_as_hostname(req) if virtual_host sign_but_dont_send(req, expires_in(params), scheme, time, unsigned_headers) req.send_request.data end |