Class: OmniAuth::Strategies::InfinumAzure

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/infinum_azure.rb

Instance Method Summary collapse

Instance Method Details

#azure_oauth_urlObject



23
24
25
# File 'lib/omniauth/strategies/infinum_azure.rb', line 23

def azure_oauth_url
  File.join(base_azure_url, 'oauth2/v2.0')
end

#base_azure_urlObject

rubocop:disable Metrics/AbcSize



27
28
29
30
31
32
# File 'lib/omniauth/strategies/infinum_azure.rb', line 27

def base_azure_url # rubocop:disable Metrics/AbcSize
  raise 'Domain not provided' if options.client_options.domain.nil?
  raise 'Tenant not provided' if options.client_options.tenant.nil?

  "#{options.client_options.domain}/#{options.client_options.tenant}.onmicrosoft.com/#{options.policy}"
end

#clientObject

rubocop:disable Metrics/AbcSize



12
13
14
15
16
17
18
19
20
21
# File 'lib/omniauth/strategies/infinum_azure.rb', line 12

def client # rubocop:disable Metrics/AbcSize
  options.client_options.authorize_url = File.join(azure_oauth_url, 'authorize')
  options.client_options.token_url = File.join(azure_oauth_url, 'token')
  options.client_options.jwks_url = File.join(base_azure_url, 'discovery/v2.0/keys')
  options.client_options.logout_url = File.join(azure_oauth_url, 'logout').concat(
    "?post_logout_redirect_uri=#{File.join(full_host, path_prefix, 'logout')}"
  )

  super
end

#other_phaseObject



34
35
36
37
38
# File 'lib/omniauth/strategies/infinum_azure.rb', line 34

def other_phase
  return call_app! unless current_path == File.join(path_prefix, name.to_s, 'logout')

  redirect(client.options[:logout_url])
end