class Aws::Plugins::RequestSigner::Handler
def apply_authtype(context)
def apply_authtype(context) if context.operation['authtype'].eql?('v4-unsigned-body') && context.http_request.endpoint.scheme.eql?('https') context.http_request.headers['X-Amz-Content-Sha256'] = 'UNSIGNED-PAYLOAD' end context end
def call(context)
def call(context) sign_authenticated_requests(context) unless unsigned_request?(context) @handler.call(context) end
def missing_credentials?(context)
def missing_credentials?(context) context.config.credentials.nil? or !context.config.credentials.set? end
def require_credentials(context)
def require_credentials(context) if missing_credentials?(context) msg = 'unable to sign request without credentials set' raise Errors::MissingCredentialsError, msg end end
def sign_authenticated_requests(context)
def sign_authenticated_requests(context) require_credentials(context) if signer = SIGNERS[context.config.signature_version] require_credentials(context) signer.sign(apply_authtype(context)) end end
def unsigned_request?(context)
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