Sha256: fb45a680780eac31f0c97c279a86ddbc24043c014b287b40a52d0a8d31331fc7
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
# frozen_string_literal: true require "omniauth_openid_connect" require_relative "../../extensions/discovery" module OmniAuth module Strategies class BaseStrategy < OmniAuth::Strategies::OpenIDConnect def public_key @public_key ||= if options.discovery config.jwks elsif key_or_secret key_or_secret elsif client_options.jwks_uri fetch_key end end private def fetch_key @fetch_key ||= parse_jwk_key(::OpenIDConnect.http_client.get_content(client_options.jwks_uri)) end def key_or_secret @key_or_secret ||= case options.client_signing_alg&.to_sym when :HS256, :HS384, :HS512 client_options.secret when :RS256, :RS384, :RS512 parse_key end end def encoded_post_logout_redirect_uri return unless options.post_logout_redirect_uri query = { post_logout_redirect_uri: options.post_logout_redirect_uri, } query = query.merge({ id_token_hint: params["id_token_hint"] }) if params["id_token_hint"] URI.encode_www_form(query) end def parse_key if options.client_jwk_signing_key parse_jwk_key(options.client_jwk_signing_key) elsif options.client_x509_signing_key parse_x509_key(options.client_x509_signing_key) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omniauth-nitro-id-1.1.1 | lib/omniauth/strategies/base_strategy.rb |
omniauth-nitro-id-1.1.0 | lib/omniauth/strategies/base_strategy.rb |