class Aws::S3::Plugins::S3Signer
This plugin is an implementation detail and may be modified. @api private
Public Class Methods
build_v4_signer(options = {})
click to toggle source
@option options [required, String] :region @option options [required, credentials] :credentials @api private
# File lib/aws-sdk-s3/plugins/s3_signer.rb, line 222 def build_v4_signer(options = {}) Aws::Sigv4::Signer.new( service: options[:service], region: options[:region], credentials_provider: options[:credentials], signing_algorithm: options.fetch(:signing_algorithm, :sigv4), uri_escape_path: false, unsigned_headers: ['content-length', 'x-amzn-trace-id'] ) end
new_hostname(context, region)
click to toggle source
Check to see if the bucket is actually an ARN
Otherwise it will retry with the ARN
as the bucket name.
# File lib/aws-sdk-s3/plugins/s3_signer.rb, line 235 def new_hostname(context, region) uri = URI.parse( Aws::Partitions::EndpointProvider.resolve(region, 's3') ) if (arn = context.metadata[:s3_arn]) # Retry with the response region and not the ARN resolved one ARN.resolve_url!(uri, arn[:arn], region).host else "#{context.params[:bucket]}.#{uri.host}" end end
Public Instance Methods
add_handlers(handlers, cfg)
click to toggle source
# File lib/aws-sdk-s3/plugins/s3_signer.rb, line 28 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)
click to toggle source
# File lib/aws-sdk-s3/plugins/s3_signer.rb, line 44 def add_legacy_handler(handlers) handlers.add(LegacyHandler, step: :sign) end
add_v4_handlers(handlers)
click to toggle source
# File lib/aws-sdk-s3/plugins/s3_signer.rb, line 38 def add_v4_handlers(handlers) handlers.add(CachedBucketRegionHandler, step: :sign, priority: 60) handlers.add(V4Handler, step: :sign) handlers.add(BucketRegionErrorHandler, step: :sign, priority: 40) end