google-cloud-env 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad4a496680f310900fc41089c24e9ec06ce45525b0770e48a2d856c14d779cc4
4
- data.tar.gz: 9480e4bedae18e535ff6f6a1f88febc728cdd2586855afd5994a62383ca62226
3
+ metadata.gz: 90efc7ff417c91cb62cbb85b70f1a16f25ad41b84effa31e7a753d64d0f541a8
4
+ data.tar.gz: 6925442cc3d569125696bf34112b8ce4fce1030295c48b259533219c6577e6c4
5
5
  SHA512:
6
- metadata.gz: cba25bf0603f67d9029d215bac97bac46b739da8d230d832a07d694e975c04034756f4a1e9c09100b57b9c5149fbccb9d7732d351021ad60f121999359161dfa
7
- data.tar.gz: c1c2b2bf84d183e499252867dfa925f287e74abb8416728764205c32060a9487cb02ce4afe0197f1da9f4f77f3b66bd3381e256947c03db49776e7066f102fad
6
+ metadata.gz: 5076fb608c2552701f6f267f641a83ae0301b8a7d6b3103613046b67179bed1e9c32ea65d238c3f81776ce1f7a77883c906fb3c421b1c4f4e9edb0a567f1dfe6
7
+ data.tar.gz: 81a486aa7b6c23c143a6af6cab570cd7ce3af5a22966303dccaf3081ff90e05e9a9f94a50356d860f03d2f03afffc74089abf71b4ea3a19b9dd87ebcb223dcaf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.2.1 (2024-10-04)
4
+
5
+ #### Bug Fixes
6
+
7
+ * Fixed edge cases in token expiration extraction ([#73](https://github.com/googleapis/ruby-cloud-env/issues/73))
8
+
3
9
  ### 2.2.0 (2024-08-22)
4
10
 
5
11
  #### Features
@@ -806,7 +806,7 @@ module Google
806
806
  #
807
807
  def access_token_lifetime data
808
808
  json = JSON.parse data rescue nil
809
- return 0 unless json&.key? "expires_in"
809
+ return 0 unless json.respond_to?(:key?) && json.key?("expires_in")
810
810
  lifetime = json["expires_in"].to_i - TOKEN_EXPIRY_BUFFER
811
811
  lifetime = 0 if lifetime.negative?
812
812
  lifetime
@@ -818,9 +818,9 @@ module Google
818
818
  #
819
819
  def identity_token_lifetime data
820
820
  return 0 unless data =~ /^[\w=-]+\.([\w=-]+)\.[\w=-]+$/
821
- base64 = Base64.decode64 Regexp.last_match[1]
821
+ base64 = Base64.urlsafe_decode64 Regexp.last_match[1]
822
822
  json = JSON.parse base64 rescue nil
823
- return 0 unless json&.key? "exp"
823
+ return 0 unless json.respond_to?(:key?) && json&.key?("exp")
824
824
  lifetime = json["exp"].to_i - Time.now.to_i - TOKEN_EXPIRY_BUFFER
825
825
  lifetime = 0 if lifetime.negative?
826
826
  lifetime
@@ -20,7 +20,7 @@ module Google
20
20
  # Library version
21
21
  # @return [String]
22
22
  #
23
- VERSION = "2.2.0".freeze
23
+ VERSION = "2.2.1".freeze
24
24
  end
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-27 00:00:00.000000000 Z
11
+ date: 2024-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -59,10 +59,10 @@ homepage: https://github.com/googleapis/ruby-cloud-env
59
59
  licenses:
60
60
  - Apache-2.0
61
61
  metadata:
62
- changelog_uri: https://rubydoc.info/gems/google-cloud-env/2.2.0/CHANGELOG.md
62
+ changelog_uri: https://rubydoc.info/gems/google-cloud-env/2.2.1/CHANGELOG.md
63
63
  source_code_uri: https://github.com/googleapis/ruby-cloud-env
64
64
  bug_tracker_uri: https://github.com/googleapis/ruby-cloud-env/issues
65
- documentation_uri: https://rubydoc.info/gems/google-cloud-env/2.2.0
65
+ documentation_uri: https://rubydoc.info/gems/google-cloud-env/2.2.1
66
66
  post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths: