Sha256: 5a6e141776d3369ca768d4f41cbec212bbfbd5a3a5aeb818ff777f991644ecef

Contents?: true

Size: 408 Bytes

Versions: 1

Compression:

Stored size: 408 Bytes

Contents

# frozen_string_literal: true

require "uri"
require "json"
require "net/http"

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.1 lib/jwk_loader/jwks.rb