class OmniAuth::Strategies::AzureOauth2V2

Constants

BASE_AZURE_URL

Public Instance Methods

client() click to toggle source
Calls superclass method
# File lib/omniauth/strategies/azure_oauth2_v2.rb, line 19
def client
  if options.tenant_provider
    provider = options.tenant_provider.new(self)
  else
    provider = options  # if pass has to config, get mapped right on to options
  end

  options.client_id = provider.client_id
  options.client_secret = provider.client_secret
  options.tenant_id =
    provider.respond_to?(:tenant_id) ? provider.tenant_id : 'common'
  options.base_azure_url =
    provider.respond_to?(:base_azure_url) ? provider.base_azure_url : BASE_AZURE_URL
  options.uid_claim = provider.respond_to?(:uid_claim) ? provider.uid_claim : 'sub'
  options.authorize_params.scope = 'openid profile email offline_access https://graph.microsoft.com/mail.read'
  options.authorize_params.redirect_uri = provider.redirect_uri if provider.respond_to?(:redirect_uri)
  options.authorize_params.response_mode = 'form_post'
  options.authorize_params.response_type = "token"
  options.authorize_params = provider.authorize_params if provider.respond_to?(:authorize_params)
  options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint
  options.authorize_params.prompt = request.params['prompt'] if defined? request && request.params['prompt']
  options.client_options.authorize_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/v2.0/authorize"
  super
end