Class: DaVinciCRDTestKit::JWKS

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

Class Method Summary collapse

Class Method Details

.default_jwks_pathObject



11
12
13
# File 'lib/davinci_crd_test_kit/jwks.rb', line 11

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

.jwksObject



20
21
22
# File 'lib/davinci_crd_test_kit/jwks.rb', line 20

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

.jwks_jsonObject



4
5
6
7
8
9
# File 'lib/davinci_crd_test_kit/jwks.rb', line 4

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

.jwks_pathObject



15
16
17
18
# File 'lib/davinci_crd_test_kit/jwks.rb', line 15

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