Class: OmniAuth::Strategies::AzureOauth2

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

Constant Summary collapse

BASE_AZURE_URL =
'https://login.windows.net'

Instance Method Summary collapse

Instance Method Details

#clientObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/omniauth/strategies/azure_oauth2.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 ptions
  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.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint
  options.client_options.authorize_url = "#{BASE_AZURE_URL}/#{options.tenant_id}/oauth2/authorize"
  options.client_options.token_url = "#{BASE_AZURE_URL}/#{options.tenant_id}/oauth2/token"

  options.token_params.resource = options.resource
  super
end

#raw_infoObject



54
55
56
57
# File 'lib/omniauth/strategies/azure_oauth2.rb', line 54

def raw_info
  # it's all here in JWT http://msdn.microsoft.com/en-us/library/azure/dn195587.aspx
  @raw_info ||= ::JWT.decode(access_token.token, nil, false).first
end