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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 881eaf3476eb9b98f7e02ba780e2893398f79f707c55c7e151f1de8f1a344f5c
4
- data.tar.gz: fe2329046f613383e73b4b8579d440f6e394457ad3b090fee27c373b47daa690
3
+ metadata.gz: 57ea07157a9156dcf76d2b9f3841fee290e138f13951f278ea960e0fe1f4f304
4
+ data.tar.gz: 21dd8d7ef8152698da900b8bd7feeb08877083e807bfbf62c211da774f2bd8a7
5
5
  SHA512:
6
- metadata.gz: d337b0e27607d55697ae6e162b25674fbcc27b21fe23bfa34d42bc4812e0a35f39f95b8eff66b7a4f6de7e78e883450f6e580931164c632a0146253b7ee89d58
7
- data.tar.gz: 0fea890071b4038cbc4ee8080d5c99388035f7642707dd1f4303bcafd7f5f9d8c2f517a5d938d988b551d680211ef6909987b6bbd7e3a5d4688136e37a469f54
6
+ metadata.gz: f795d708cc633acbbb844ab082004bd3408d14774dfd74232f371da3c8e6c2d4fadf6bd24309c10005acee0ce56f5ceade59669f2ed79f3e7616dab7517045b0
7
+ data.tar.gz: c5f41fda437761761c0590f4a5e35c49534b5e614c5341fe57d356ceb8be4fb64fb90de078ee03f63e8163e7155b742effa3667b65cdad507fda37e1cb400d8e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.15.0
1
+ 1.15.1
data/lib/json/jose.rb CHANGED
@@ -26,9 +26,7 @@ module JSON
26
26
  when JSON::JWK
27
27
  key.to_key
28
28
  when JSON::JWK::Set
29
- key.detect do |jwk|
30
- jwk[:kid] && jwk[:kid] == kid
31
- end&.to_key or raise JWK::Set::KidNotFound
29
+ key[kid]&.to_key or raise JWK::Set::KidNotFound
32
30
  else
33
31
  key
34
32
  end
@@ -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
- jwks.detect do |jwk|
77
- jwk[:kid] && jwk[:kid] == kid
78
- end or raise JWK::Set::KidNotFound
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)}
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.15.0
4
+ version: 1.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake