json-jwt 1.15.0 → 1.15.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of json-jwt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/json/jose.rb +1 -3
- data/lib/json/jwk/set/fetcher.rb +8 -4
- data/lib/json/jwk/set.rb +6 -0
- 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: 57ea07157a9156dcf76d2b9f3841fee290e138f13951f278ea960e0fe1f4f304
|
4
|
+
data.tar.gz: 21dd8d7ef8152698da900b8bd7feeb08877083e807bfbf62c211da774f2bd8a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f795d708cc633acbbb844ab082004bd3408d14774dfd74232f371da3c8e6c2d4fadf6bd24309c10005acee0ce56f5ceade59669f2ed79f3e7616dab7517045b0
|
7
|
+
data.tar.gz: c5f41fda437761761c0590f4a5e35c49534b5e614c5341fe57d356ceb8be4fb64fb90de078ee03f63e8163e7155b742effa3667b65cdad507fda37e1cb400d8e
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.15.
|
1
|
+
1.15.1
|
data/lib/json/jose.rb
CHANGED
data/lib/json/jwk/set/fetcher.rb
CHANGED
@@ -60,12 +60,13 @@ module JSON
|
|
60
60
|
end
|
61
61
|
self.cache = Cache.new
|
62
62
|
|
63
|
-
def self.fetch(jwks_uri, kid:)
|
63
|
+
def self.fetch(jwks_uri, kid:, auto_detect: true)
|
64
64
|
cache_key = [
|
65
65
|
'json:jwk:set',
|
66
66
|
OpenSSL::Digest::MD5.hexdigest(jwks_uri),
|
67
67
|
kid
|
68
68
|
].collect(&:to_s).join(':')
|
69
|
+
|
69
70
|
jwks = Set.new(
|
70
71
|
JSON.parse(
|
71
72
|
cache.fetch(cache_key) do
|
@@ -73,9 +74,12 @@ module JSON
|
|
73
74
|
end
|
74
75
|
)
|
75
76
|
)
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
|
78
|
+
if auto_detect
|
79
|
+
jwks[kid] or raise KidNotFound
|
80
|
+
else
|
81
|
+
jwks
|
82
|
+
end
|
79
83
|
end
|
80
84
|
end
|
81
85
|
end
|
data/lib/json/jwk/set.rb
CHANGED
@@ -19,6 +19,12 @@ module JSON
|
|
19
19
|
'application/jwk-set+json'
|
20
20
|
end
|
21
21
|
|
22
|
+
def [](kid)
|
23
|
+
detect do |jwk|
|
24
|
+
jwk[:kid] && jwk[:kid] == kid
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
22
28
|
def as_json(options = {})
|
23
29
|
# NOTE: Array.new wrapper is requied to avoid CircularReferenceError
|
24
30
|
{keys: Array.new(self)}
|