Class: Aws::Plugins::Sign::Bearer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/plugins/sign.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 collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Bearer

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.

Returns a new instance of Bearer.



75
76
77
# File 'lib/aws-sdk-core/plugins/sign.rb', line 75

def initialize(config)
  @token_provider = config.token_provider
end

Instance Attribute Details

#token_providerObject (readonly)

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.



79
80
81
# File 'lib/aws-sdk-core/plugins/sign.rb', line 79

def token_provider
  @token_provider
end

Instance Method Details

#presign_url(*args) ⇒ 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.

Raises:

  • (ArgumentError)


90
91
92
# File 'lib/aws-sdk-core/plugins/sign.rb', line 90

def presign_url(*args)
  raise ArgumentError, 'Bearer auth does not support presigned urls'
end

#sign(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.



81
82
83
84
85
86
87
88
# File 'lib/aws-sdk-core/plugins/sign.rb', line 81

def sign(context)
  if context.http_request.endpoint.scheme != 'https'
    raise ArgumentError, 'Unable to use bearer authorization on non https endpoint.'
  end
  raise Errors::MissingBearerTokenError unless @token_provider && @token_provider.set?

  context.http_request.headers['Authorization'] = "Bearer #{@token_provider.token.token}"
end

#sign_event(*args) ⇒ 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.

Raises:

  • (ArgumentError)


94
95
96
# File 'lib/aws-sdk-core/plugins/sign.rb', line 94

def sign_event(*args)
  raise ArgumentError, 'Bearer auth does not support event signing'
end