Class: Aws::Plugins::BearerAuthorization::Handler Private

Inherits:
Seahorse::Client::Handler show all
Defined in:
lib/aws-sdk-core/plugins/bearer_authorization.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 Attribute Summary

Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ 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.

[View source]

53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/aws-sdk-core/plugins/bearer_authorization.rb', line 53

def call(context)
  if context.http_request.endpoint.scheme != 'https'
    raise ArgumentError, 'Unable to use bearer authorization on non https endpoint.'
  end

  token_provider = context.config.token_provider
  if token_provider && token_provider.set?
    context.http_request.headers['Authorization'] = "Bearer #{token_provider.token.token}"
  else
    raise Errors::MissingBearerTokenError
  end
  @handler.call(context)
end