Module: AWS::Core::Signature::Version4

Defined in:
lib/aws/core/signature/version_4.rb

Instance Method Summary collapse

Instance Method Details

#add_authorization!(credentials) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/aws/core/signature/version_4.rb', line 27

def add_authorization! credentials
  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'] = credentials.session_token if
    credentials.session_token
  headers['x-amz-content-sha256'] ||= hexdigest(body || '')
  headers['authorization'] = authorization(credentials, datetime)
end