Sha256: b322cf9184ece71d67ee2443c68958195a37ad5f5e56848f57a647b0efa8223a

Contents?: true

Size: 389 Bytes

Versions: 1

Compression:

Stored size: 389 Bytes

Contents

# frozen_string_literal: true

require "uri"
require "json"

module JwkLoader
  module Jwks
    class << self
      def from_uri(uri)
        uri = URI.parse(uri) unless uri.is_a?(URI)

        response = Net::HTTP.get_response(uri)
        from_json(response.body)
      end

      def from_json(jwks_json)
        JSON.parse(jwks_json, symbolize_names: true)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jwk-loader-0.1.0 lib/jwk_loader/jwks.rb