-
-
Notifications
You must be signed in to change notification settings - Fork 81
JWK Set
Nov Matake edited this page Aug 11, 2022
·
8 revisions
JSON::JWK::Set
can be initiated by putting an array of JSON::JWK
instances, or Hash
represented JSON Web Key Set.
JSON::JWK::Set.new(jwk1, jwk2, jwk3, ...)
JSON::JWK::Set.new([jwk1, jwk2, jwk3, ...])
JSON::JWK::Set.new(
keys: [{
kty: :RSA,
e: 'AQAB',
n: 'AK8ppaAGn6N3jDic2...'
}, {
:
}]
)
Just call JSON::JWK::Set#to_json
.
# NOTE: Optionally by setting cache instance, JWKs are cached by kid.
JSON::JWK::Set::Fetcher.cache = Rails.cache
JSON::JWK::Set::Fetcher.fetch(jwks_uri, kid: kid)
# => returns JSON::JWK instance or raise JSON::JWK::Set::KidNotFound
JSON::JWK::Set::Fetcher.fetch(jwks_uri, kid: kid, auto_detect: false)
# => returns JSON::JWK::Set without JWK detection by given kid (NOTE: kid is still required for caching)