Module: JwkLoader

Defined in:
lib/jwk-loader.rb,
lib/jwk_loader/jwks.rb,
lib/jwk_loader/test.rb,
lib/jwk_loader/error.rb,
lib/jwk_loader/version.rb,
lib/jwk_loader/memory_cache.rb,
lib/jwk_loader/config/config.rb,
lib/jwk_loader/jwks_uri_provider.rb

Defined Under Namespace

Modules: Jwks, Test Classes: Config, Error, JwksLoadError, JwksUriProvider, MemoryCache

Constant Summary collapse

VERSION =
"1.2.0"

Class Method Summary collapse

Class Method Details

.cacheObject



18
19
20
# File 'lib/jwk-loader.rb', line 18

def cache
  config[:cache]
end

.configObject



26
27
28
29
30
31
# File 'lib/jwk-loader.rb', line 26

def config
  @config ||= JwkLoader::Config.new.tap do |cfg|
    cfg[:cache] = MemoryCache.new
    cfg[:cache_grace_period] = 900
  end
end

.configure {|config| ... } ⇒ Object

Yields:



22
23
24
# File 'lib/jwk-loader.rb', line 22

def configure
  yield config
end

.for_uri(**options) ⇒ Object



12
13
14
15
16
# File 'lib/jwk-loader.rb', line 12

def for_uri(**options)
  options[:cache] ||= config[:cache]
  options[:cache_grace_period] ||= config[:cache_grace_period]
  JwksUriProvider.new(**options)
end

.memory_storeObject



37
38
39
# File 'lib/jwk-loader.rb', line 37

def memory_store
  @memory_store ||= MemoryCache.new
end

.reset!Object



33
34
35
# File 'lib/jwk-loader.rb', line 33

def reset!
  @config = nil
end