Class: RackJwtVerifier::KeySource::RemoteJwks

Inherits:
Remote
  • Object
show all
Defined in:
lib/rack_jwt_verifier/key_source.rb

Overview

A JSON Web Key Set served at a URL (typically /.well-known/jwks.json).

Constant Summary collapse

CACHE_KEY_PREFIX =
"rack_jwt_verifier:jwks"

Constants inherited from Remote

RackJwtVerifier::KeySource::Remote::DEFAULT_CACHE_TTL, RackJwtVerifier::KeySource::Remote::DEFAULT_HTTP_TIMEOUT, RackJwtVerifier::KeySource::Remote::DEFAULT_REFETCH_INTERVAL, RackJwtVerifier::KeySource::Remote::MAX_RESPONSE_BYTES

Instance Attribute Summary

Attributes inherited from Remote

#cache_key, #url

Instance Method Summary collapse

Methods inherited from Remote

#initialize, #refresh!

Constructor Details

This class inherits a constructor from RackJwtVerifier::KeySource::Remote

Instance Method Details

#jwks?Boolean

Returns:



308
309
310
# File 'lib/rack_jwt_verifier/key_source.rb', line 308

def jwks?
  true
end

#jwks_loaderObject

ruby-jwt calls the loader once, and again with kid_not_found: true when the token's kid is absent from the set it got — the rotation signal for JWKS. Refresh (rate-limited) on that signal, then hand back the set.



315
316
317
318
319
320
# File 'lib/rack_jwt_verifier/key_source.rb', line 315

def jwks_loader
  lambda do |options|
    refresh! if options[:kid_not_found] || options[:invalidate]
    material
  end
end