Module: AWS::Core::AuthorizeV4

Defined in:
lib/aws/core/authorize_v4.rb

Overview

Mixed into clients that use signature v4 authorization.

Instance Method Summary collapse

Instance Method Details

#add_authorization!(signer) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/aws/core/authorize_v4.rb', line 35

def add_authorization! signer
  self.access_key_id = signer.access_key_id
  datetime = Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
  headers['content-type'] ||= 'application/x-www-form-urlencoded'
  headers['host'] = host
  headers['x-amz-date'] = datetime
  headers['x-amz-security-token'] = signer.session_token if signer.session_token
  headers['authorization'] = authorization(signer, datetime)
end