Class: Aws::S3::Plugins::S3Signer Private

Inherits:
Seahorse::Client::Plugin
  • Object
show all
Defined in:
lib/aws-sdk-s3/plugins/s3_signer.rb

Overview

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.

This plugin used to have a V4 signer but it was removed in favor of generic Sign plugin that uses endpoint auth scheme.

Defined Under Namespace

Classes: BucketRegionErrorHandler, CachedBucketRegionHandler, LegacyHandler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.custom_endpoint?(context) ⇒ Boolean

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:

  • (Boolean)


170
171
172
173
174
175
176
177
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 170

def custom_endpoint?(context)
  region = context.config.region
  partition = Aws::Endpoints::Matchers.aws_partition(region)
  endpoint = context.http_request.endpoint

  !endpoint.hostname.include?(partition['dnsSuffix']) &&
    !endpoint.hostname.include?(partition['dualStackDnsSuffix'])
end

.new_hostname(context, region) ⇒ 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.



161
162
163
164
165
166
167
168
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 161

def new_hostname(context, region)
  endpoint_params = context[:endpoint_params].dup
  endpoint_params.region = region
  endpoint_params.endpoint = nil
  endpoint =
    context.config.endpoint_provider.resolve_endpoint(endpoint_params)
  URI(endpoint.url).host
end

Instance Method Details

#add_handlers(handlers, cfg) ⇒ 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.



20
21
22
23
24
25
26
27
28
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 20

def add_handlers(handlers, cfg)
  case cfg.signature_version
  when 'v4' then add_v4_handlers(handlers)
  when 's3' then add_legacy_handler(handlers)
  else
    msg = "unsupported signature version `#{cfg.signature_version}'"
    raise ArgumentError, msg
  end
end

#add_legacy_handler(handlers) ⇒ 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.



35
36
37
38
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 35

def add_legacy_handler(handlers)
  # generic Sign plugin will be skipped if it sees sigv2
  handlers.add(LegacyHandler, step: :sign)
end

#add_v4_handlers(handlers) ⇒ 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.



30
31
32
33
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 30

def add_v4_handlers(handlers)
  handlers.add(CachedBucketRegionHandler, step: :sign, priority: 60)
  handlers.add(BucketRegionErrorHandler, step: :sign, priority: 40)
end