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)


165
166
167
168
169
170
171
172
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 165

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.



156
157
158
159
160
161
162
163
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 156

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.



15
16
17
18
19
20
21
22
23
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 15

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.



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

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.



25
26
27
28
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 25

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