json-jwt 1.17.1 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/VERSION +1 -1
  4. data/lib/json/jwe.rb +6 -3
  5. data/lib/json/jwt.rb +2 -6
  6. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 477700420d1f91dfa45a302ecccc12c76548a8a5f281ac709f2b406b76e2abbf
4
- data.tar.gz: b4e2f42d9fa50ff0902e8e72a3584ebc760d18b82c857e532f390253472d96a7
3
+ metadata.gz: c53a91e5d33b3d3faa375c424a1aacba227456756da3eafe1794014ee69dae44
4
+ data.tar.gz: 5edb64703e8c0a0b91bceeff2d6313abbfbd86eee1623567cd2335e2cea7b1da
5
5
  SHA512:
6
- metadata.gz: 66ce8c45f9d3c046a749e2cff596258eec0d63ee842e8033a691efe745d8cd44b4943a8a70700cd1ee8692e4417ad67b658155a1cc7ad0cd0313d142b4751489
7
- data.tar.gz: 21e4328f6b842ab18293bd735f973131db0a7ed1f308023ef976df3c25c9a4a0d59e6481f561bfa90b7921560eff7b856cc6b6cffc0e89f68ceb26b012847a39
6
+ metadata.gz: b1f8b09219b80b0e2350450522e53ead2dc344662617e517916063cc7a08f5c9dff5ba9d81f3ff3ebabadae708c71286db4b086d5093af0fb459cf1793ae3c28
7
+ data.tar.gz: da998f84ffaf2996b7ef02d9ad2f4aff6067ec14c352bb0f0f0811474506f00212171f8623363462b03dbe2f17832cb3873b9882dd70c5a136e4ba97e7b61217
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.17.1
1
+ 1.17.2
data/lib/json/jwe.rb CHANGED
@@ -259,7 +259,10 @@ module JSON
259
259
  end
260
260
 
261
261
  class << self
262
- def decode_compact_serialized(input, private_key_or_secret, algorithms = nil, encryption_methods = nil, _allow_blank_payload = false)
262
+ def decode_compact_serialized(input, private_key_or_secret, algorithms = nil, encryption_methods = nil, allow_blank_payload = false)
263
+ if allow_blank_payload
264
+ raise InvalidFormat.new("JWE w/ blank payload is not supported.")
265
+ end
263
266
  unless input.count('.') + 1 == NUM_OF_SEGMENTS
264
267
  raise InvalidFormat.new("Invalid JWE Format. JWE should include #{NUM_OF_SEGMENTS} segments.")
265
268
  end
@@ -279,7 +282,7 @@ module JSON
279
282
  jwe
280
283
  end
281
284
 
282
- def decode_json_serialized(input, private_key_or_secret, algorithms = nil, encryption_methods = nil, _allow_blank_payload = false)
285
+ def decode_json_serialized(input, private_key_or_secret, algorithms = nil, encryption_methods = nil, allow_blank_payload = false)
283
286
  input = input.with_indifferent_access
284
287
  jwe_encrypted_key = if input[:recipients].present?
285
288
  input[:recipients].first[:encrypted_key]
@@ -293,7 +296,7 @@ module JSON
293
296
  input[:ciphertext],
294
297
  input[:tag]
295
298
  ].join('.')
296
- decode_compact_serialized compact_serialized, private_key_or_secret, algorithms, encryption_methods
299
+ decode_compact_serialized compact_serialized, private_key_or_secret, algorithms, encryption_methods, allow_blank_payload
297
300
  end
298
301
  end
299
302
  end
data/lib/json/jwt.rb CHANGED
@@ -109,11 +109,7 @@ module JSON
109
109
  when JWS::NUM_OF_SEGMENTS
110
110
  JWS.decode_compact_serialized jwt_string, key_or_secret, algorithms, allow_blank_payload
111
111
  when JWE::NUM_OF_SEGMENTS
112
- if allow_blank_payload
113
- raise InvalidFormat.new("JWE w/ blank payload is not supported.")
114
- else
115
- JWE.decode_compact_serialized jwt_string, key_or_secret, algorithms, encryption_methods
116
- end
112
+ JWE.decode_compact_serialized jwt_string, key_or_secret, algorithms, encryption_methods, allow_blank_payload
117
113
  else
118
114
  raise InvalidFormat.new("Invalid JWT Format. JWT should include #{JWS::NUM_OF_SEGMENTS} or #{JWE::NUM_OF_SEGMENTS} segments.")
119
115
  end
@@ -124,7 +120,7 @@ module JSON
124
120
  if (input[:signatures] || input[:signature]).present?
125
121
  JWS.decode_json_serialized input, key_or_secret, algorithms, allow_blank_payload
126
122
  elsif input[:ciphertext].present?
127
- JWE.decode_json_serialized input, key_or_secret, algorithms, encryption_methods
123
+ JWE.decode_json_serialized input, key_or_secret, algorithms, encryption_methods, allow_blank_payload
128
124
  else
129
125
  raise InvalidFormat.new("Unexpected JOSE JSON Serialization Format.")
130
126
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.1
4
+ version: 1.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake