Class: Aws::Signers::V3 Private

Inherits:
Base
  • Object
show all
Defined in:
lib/aws-sdk-core/signers/v3.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods inherited from Base

#initialize, sign

Constructor Details

This class inherits a constructor from Aws::Signers::Base

Instance Method Details

#sign(http_req) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/aws-sdk-core/signers/v3.rb', line 10

def sign(http_req)

  date = Time.now.httpdate
  http_req.headers['Date'] = date

  if @credentials.session_token
    http_req.headers['X-Amz-Security-Token'] = @credentials.session_token
  end

  parts = []
  parts << "AWS3-HTTPS AWSAccessKeyId=#{@credentials.access_key_id}"
  parts << "Algorithm=HmacSHA256"
  parts << "Signature=#{signature(date)}"
  http_req.headers['X-Amzn-Authorization'] = parts.join(',')
end