Class: SMARTAppLaunch::JWKS

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_app_launch/jwks.rb

Class Method Summary collapse

Class Method Details

.default_jwks_pathObject



13
14
15
# File 'lib/smart_app_launch/jwks.rb', line 13

def default_jwks_path
  @default_jwks_path ||= File.join(__dir__, 'smart_jwks.json')
end

.jwksObject



22
23
24
# File 'lib/smart_app_launch/jwks.rb', line 22

def jwks
  @jwks ||= JWT::JWK::Set.new(JSON.parse(File.read(jwks_path)))
end

.jwks_jsonObject



6
7
8
9
10
11
# File 'lib/smart_app_launch/jwks.rb', line 6

def jwks_json
  @jwks_json ||=
    JSON.pretty_generate(
      { keys: jwks.export[:keys].select { |key| key[:key_ops]&.include?('verify') } }
    )
end

.jwks_pathObject



17
18
19
20
# File 'lib/smart_app_launch/jwks.rb', line 17

def jwks_path
  @jwks_path ||=
    ENV.fetch('SMART_JWKS_PATH', default_jwks_path)
end