aws-sigv4 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aws-sigv4/signer.rb +9 -17
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb4db422d46522a4ad3274b0dc5b28689ed5def4
4
- data.tar.gz: 061ca3ebfd24ffea8a1717ac9e12f9fc0650d4f8
3
+ metadata.gz: 14842135b7b85dbb735af02ed0abf4f7b2210637
4
+ data.tar.gz: ead9c20e040190ce9eedef01ab271ee168a6f91a
5
5
  SHA512:
6
- metadata.gz: fef836871abeaf35b99b00a28deab1506f45d6792a6c732d74db4a37250d77e62ee64da491ad91a21a0f8098ba91dae19953d27c48aec0a36d7e2ad403f4edf6
7
- data.tar.gz: 6bee73d7bbcd3f7fe8cb92275eabb13d5981869dc566bfc818960449143fdc28f91270465efd9d38adbfb4f91d12c23a2c70e7cfebf4c45d8954df3c0a082b36
6
+ metadata.gz: 67efebc735d8688893603ac6c4a7167f4a4e4d667570a62546838da4d3cc07e80ea3f549b49289df298ca981b1ed4007dc7fb08d5c67a585368c8439c957413c
7
+ data.tar.gz: de205f21528e37090f87164acaaf7cd8d6abdb5172a0e5c7baa9a1b422eb6af3a5bdda0ba39cb35d88b186c9cbd3e8fe41080c6173fbe85f28769ab95ae95f6f
@@ -202,7 +202,7 @@ module Aws
202
202
  #
203
203
  def sign_request(request)
204
204
 
205
- creds = get_credentials
205
+ creds = fetch_credentials
206
206
 
207
207
  http_method = extract_http_method(request)
208
208
  url = extract_url(request)
@@ -280,7 +280,7 @@ module Aws
280
280
  # signature value (a binary string) used at ':chunk-signature' needs to converted to
281
281
  # hex-encoded string using #unpack
282
282
  def sign_event(prior_signature, payload, encoder)
283
- creds = get_credentials
283
+ creds = fetch_credentials
284
284
  time = Time.now
285
285
  headers = {}
286
286
 
@@ -367,7 +367,7 @@ module Aws
367
367
  #
368
368
  def presign_url(options)
369
369
 
370
- creds = get_credentials
370
+ creds = fetch_credentials
371
371
 
372
372
  http_method = extract_http_method(options)
373
373
  url = extract_url(options)
@@ -549,18 +549,14 @@ module Aws
549
549
  end
550
550
 
551
551
  def host(uri)
552
- if standard_port?(uri)
552
+ # Handles known and unknown URI schemes; default_port nil when unknown.
553
+ if uri.default_port == uri.port
553
554
  uri.host
554
555
  else
555
556
  "#{uri.host}:#{uri.port}"
556
557
  end
557
558
  end
558
559
 
559
- def standard_port?(uri)
560
- (uri.scheme == 'http' && uri.port == 80) ||
561
- (uri.scheme == 'https' && uri.port == 443)
562
- end
563
-
564
560
  # @param [File, Tempfile, IO#read, String] value
565
561
  # @return [String<SHA256 Hexdigest>]
566
562
  def sha256_hexdigest(value)
@@ -656,20 +652,16 @@ module Aws
656
652
  self.class.uri_escape_path(string)
657
653
  end
658
654
 
659
- def get_credentials
655
+ def fetch_credentials
660
656
  credentials = @credentials_provider.credentials
661
- if credentials_set?(credentials)
657
+ if credentials.access_key_id && credentials.secret_access_key
662
658
  credentials
663
659
  else
664
- msg = 'unable to sign request without credentials set'
665
- raise Errors::MissingCredentialsError.new(msg)
660
+ raise Errors::MissingCredentialsError,
661
+ 'unable to sign request without credentials set'
666
662
  end
667
663
  end
668
664
 
669
- def credentials_set?(credentials)
670
- credentials.access_key_id && credentials.secret_access_key
671
- end
672
-
673
665
  class << self
674
666
 
675
667
  # @api private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sigv4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2020-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-eventstream
@@ -30,7 +30,7 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.2
33
- description: Amazon Web Services Signature Version 4 signing ligrary. Generates sigv4
33
+ description: Amazon Web Services Signature Version 4 signing library. Generates sigv4
34
34
  signature for HTTP requests.
35
35
  email:
36
36
  executables: []
@@ -43,7 +43,7 @@ files:
43
43
  - lib/aws-sigv4/request.rb
44
44
  - lib/aws-sigv4/signature.rb
45
45
  - lib/aws-sigv4/signer.rb
46
- homepage: http://github.com/aws/aws-sdk-ruby
46
+ homepage: https://github.com/aws/aws-sdk-ruby
47
47
  licenses:
48
48
  - Apache-2.0
49
49
  metadata: