lib/aws/s3/presigned_post.rb in aws-sdk-1.5.2 vs lib/aws/s3/presigned_post.rb in aws-sdk-1.5.3
- old
+ new
@@ -10,11 +10,10 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
require 'uri'
-require 'base64'
require 'time'
module AWS
class S3
@@ -80,11 +79,12 @@
:content_encoding,
:expires_header,
:acl,
:server_side_encryption,
:success_action_redirect,
- :success_action_status]
+ :success_action_status,
+ :filename]
# @private
attr_reader :conditions
# @return [Array<String>] Additional fields which may be sent
@@ -340,21 +340,23 @@
# S3. Additional form fields may be added after the fact as
# long as they are described by a policy condition (see
# {#where}).
def fields
- signature = config.signer.sign(policy, "sha1")
+ secret = config.credential_provider.secret_access_key
+ signature = Core::Signer.sign(secret, policy, 'sha1')
fields = {
- "AWSAccessKeyId" => config.signer.access_key_id,
+ "AWSAccessKeyId" => config.credential_provider.access_key_id,
"key" => key,
"policy" => policy,
"signature" => signature
}.merge(optional_fields)
- fields["x-amz-security-token"] = config.signer.session_token if
- config.signer.session_token
+ if token = config.credential_provider.session_token
+ fields["x-amz-security-token"] = token
+ end
fields.merge(optional_fields)
end
@@ -498,11 +500,11 @@
conditions += key_conditions
conditions += optional_fields.map { |(n, v)| Hash[[[n, v]]] }
conditions += range_conditions
conditions += ignored_conditions
- if config.signer.session_token
- conditions << {"x-amz-security-token" => config.signer.session_token}
+ if token = config.credential_provider.session_token
+ conditions << { "x-amz-security-token" => token }
end
conditions
end