Sha256: 4ceb107f62b683f4b22af6321743aae56b399bc7d69f1837986548bec0c02601

Contents?: true

Size: 591 Bytes

Versions: 11

Compression:

Stored size: 591 Bytes

Contents

require 'jwt'

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

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
smart_app_launch_test_kit-0.6.0 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.5.1 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.5.0 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.6 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.5 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.4 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.3 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.2 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.1 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.4.0 lib/smart_app_launch/jwks.rb
smart_app_launch_test_kit-0.3.0 lib/smart_app_launch/jwks.rb