Class: Sinatra::Jwt::JwkLoader::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/jwt/jwk_loader.rb

Direct Known Subclasses

File, String

Instance Method Summary collapse

Instance Method Details

#call(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sinatra/jwt/jwk_loader.rb', line 11

def call(options = {})
  if options[:kid_not_found] && @cache_last_update < Time.now.to_i - 300
    logger.info("Invalidating JWK cache. #{options[:kid]} not found from previous cache")
    @cached_keys = nil
  end
  @cached_keys ||= begin
    @cache_last_update = Time.now.to_i
    load
  end
rescue StandardError
  raise JwkLoadError, "Could not load the jwk file"
end

#loadObject

Raises:

  • (StandardError)


7
8
9
# File 'lib/sinatra/jwt/jwk_loader.rb', line 7

def load
  raise StandardError, "Jwk load is not implemented"
end