Sha256: 780c79586d978c3f1b114141b02b1c6ef93295364f15930ad2c2ff1bdd27bb61
Contents?: true
Size: 1.08 KB
Versions: 8
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "rodauth/oauth" require "rodauth/oauth/http_extensions" module Rodauth Feature.define(:oauth_jwt_jwks, :OauthJwtJwks) do depends :oauth_jwt_base auth_value_methods(:jwks_set) auth_server_route(:jwks) do |r| before_jwks_route r.get do json_response_success({ keys: jwks_set }, true) end end private def oauth_server_metadata_body(path = nil) metadata = super metadata.merge!(jwks_uri: jwks_url) metadata end def jwks_set @jwks_set ||= [ *( unless oauth_jwt_public_keys.empty? oauth_jwt_public_keys.flat_map { |algo, pkeys| Array(pkeys).map { |pkey| jwk_export(pkey).merge(use: "sig", alg: algo) } } end ), *( unless oauth_jwt_jwe_public_keys.empty? oauth_jwt_jwe_public_keys.flat_map do |(algo, _enc), pkeys| Array(pkeys).map do |pkey| jwk_export(pkey).merge(use: "enc", alg: algo) end end end ) ].compact end end end
Version data entries
8 entries across 8 versions & 1 rubygems