Class: Wedge::Plugins::Uploader::S3Signature
- Defined in:
- lib/wedge/plugins/uploader.rb
Instance Attribute Summary collapse
-
#policy_data ⇒ Object
Returns the value of attribute policy_data.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
Instance Attribute Details
#policy_data ⇒ Object
Returns the value of attribute policy_data
13 14 15 |
# File 'lib/wedge/plugins/uploader.rb', line 13 def policy_data @policy_data end |
#settings ⇒ Object
Returns the value of attribute settings
13 14 15 |
# File 'lib/wedge/plugins/uploader.rb', line 13 def settings @settings end |
Instance Method Details
#policy ⇒ Object
14 15 16 |
# File 'lib/wedge/plugins/uploader.rb', line 14 def policy Base64.encode64(policy_data.to_json).gsub("\n", "") end |
#signature ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/wedge/plugins/uploader.rb', line 18 def signature # The presence of the “headers” property in the JSON request alerts your server to the fact that this is a request to sign a REST/multipart request and not a policy document. # Your server only needs to return the following in the body of an “application/json” response: encode_string = policy_data["headers"].present? ? policy_data["headers"] : policy Base64.encode64( OpenSSL::HMAC.digest( OpenSSL::Digest.new('sha1'), settings[:aws_secret_access_key], encode_string ) ).gsub("\n", "") end |