class OpenIDConfig

Attributes

config[R]

Public Class Methods

fetch(tid: 'common') click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 2
def self.fetch(tid: 'common')
  config_uri = URI("https://login.microsoftonline.com/#{tid}/v2.0/.well-known/openid-configuration")
  new(config: JSON.parse(Net::HTTP.get(config_uri)))
rescue JSON::ParserError
  fail StandardError, 'Unable to fetch OpenId configuration for ' \
    "AzureAD tenant '#{tid}'."
end
new(config:) click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 10
def initialize(config:)
  @config = config
end

Public Instance Methods

authorization_endpoint() click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 18
def authorization_endpoint
  config['authorization_endpoint']
end
issuer() click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 14
def issuer
  config['issuer']
end
jwks_uri() click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 22
def jwks_uri
  config['jwks_uri']
end
keys() click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 26
def keys
  @signing_keys ||= KeySet.new(keys: fetch_signing_keys)
end

Private Instance Methods

fetch_signing_keys() click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 34
def fetch_signing_keys
  response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))
  response['keys']
rescue JSON::ParserError
  raise StandardError, 'Unable to fetch AzureAD signing keys.'
end
signing_keys_url() click to toggle source
# File lib/omniauth/azure_adv2/openid_config.rb, line 41
def signing_keys_url
  return jwks_uri if jwks_uri
  fail StandardError, 'No jwks_uri in OpenId config response.'
end