Sha256: 4d6bf4cd29f57f813d5dc85eea072fd1e6b4630082ac656d6818e169be00bf26

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# 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 'time'

module AWS
  class CloudFront

    # @private
    class Request < Core::Http::Request

      def add_authorization! credentials

        self.access_key_id = credentials.access_key_id

        auth = "AWS #{access_key_id}:#{signature(credentials)}"
        headers['authorization'] = auth

      end

      protected

      def signature credentials
        Core::Signer.sign(credentials.secret_access_key, string_to_sign, 'sha1')
      end

      def string_to_sign
        headers['date'] ||= Time.now.rfc822
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-sdk-1.8.0 lib/aws/cloud_front/request.rb