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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/json/jwe.rb +6 -3
- data/lib/json/jwt.rb +2 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c53a91e5d33b3d3faa375c424a1aacba227456756da3eafe1794014ee69dae44
|
|
4
|
+
data.tar.gz: 5edb64703e8c0a0b91bceeff2d6313abbfbd86eee1623567cd2335e2cea7b1da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1f8b09219b80b0e2350450522e53ead2dc344662617e517916063cc7a08f5c9dff5ba9d81f3ff3ebabadae708c71286db4b086d5093af0fb459cf1793ae3c28
|
|
7
|
+
data.tar.gz: da998f84ffaf2996b7ef02d9ad2f4aff6067ec14c352bb0f0f0811474506f00212171f8623363462b03dbe2f17832cb3873b9882dd70c5a136e4ba97e7b61217
|
data/Gemfile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.17.
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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
|