class Aws::Plugins::RequestSigner::Handler

Constants

COGNITO_IDENTITY_UNSIGNED_REQUESTS
SIGNERS
STS_UNSIGNED_REQUESTS

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-core/plugins/request_signer.rb, line 83
def call(context)
  sign_authenticated_requests(context) unless unsigned_request?(context)
  @handler.call(context)
end

Private Instance Methods

missing_credentials?(context) click to toggle source
# File lib/aws-sdk-core/plugins/request_signer.rb, line 105
def missing_credentials?(context)
  context.config.credentials.nil? or
  !context.config.credentials.set?
end
require_credentials(context) click to toggle source
# File lib/aws-sdk-core/plugins/request_signer.rb, line 98
def require_credentials(context)
  if missing_credentials?(context)
    msg = 'unable to sign request without credentials set'
    raise Errors::MissingCredentialsError, msg
  end
end
sign_authenticated_requests(context) click to toggle source
# File lib/aws-sdk-core/plugins/request_signer.rb, line 90
def sign_authenticated_requests(context)
  require_credentials(context)
  if signer = SIGNERS[context.config.signature_version]
    require_credentials(context)
    signer.sign(context)
  end
end
unsigned_request?(context) click to toggle source
# File lib/aws-sdk-core/plugins/request_signer.rb, line 110
def unsigned_request?(context)
  if context.config.api.metadata['endpointPrefix'] == 'sts'
    STS_UNSIGNED_REQUESTS.include?(context.operation.name)
  elsif context.config.api.metadata['endpointPrefix'] == 'cloudsearchdomain'
    context.config.credentials.nil? || !context.config.credentials.set?
  elsif context.config.api.metadata['endpointPrefix'] == 'cognito-identity'
    COGNITO_IDENTITY_UNSIGNED_REQUESTS.include?(context.operation.name)
  else
    false
  end
end