Class: OmniAuth::Strategies::MicrosoftGraph

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

Constant Summary collapse

BASE_SCOPE_URL =
'https://graph.microsoft.com/'
BASE_SCOPES =
%w[offline_access openid email profile].freeze
DEFAULT_SCOPE =
'offline_access openid email profile User.Read'.freeze

Instance Method Summary collapse

Instance Method Details

#auth_hashObject



47
48
49
50
51
# File 'lib/omniauth/strategies/microsoft_graph.rb', line 47

def auth_hash
  super.tap do |ah|
    verify_email(ah, access_token)
  end
end

#authorize_paramsObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/omniauth/strategies/microsoft_graph.rb', line 53

def authorize_params
  super.tap do |params|
    options[:authorize_options].each do |k|
      params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
    end

    params[:scope] = get_scope(params)
    params[:access_type] = 'offline' if params[:access_type].nil?

    session['omniauth.state'] = params[:state] if params[:state]
  end
end

#callback_urlObject



70
71
72
# File 'lib/omniauth/strategies/microsoft_graph.rb', line 70

def callback_url
  options[:callback_url] || full_host + script_name + callback_path
end

#custom_build_access_tokenObject Also known as: build_access_token



74
75
76
77
# File 'lib/omniauth/strategies/microsoft_graph.rb', line 74

def custom_build_access_token
  access_token = get_access_token(request)
  access_token
end

#raw_infoObject



66
67
68
# File 'lib/omniauth/strategies/microsoft_graph.rb', line 66

def raw_info
  @raw_info ||= access_token.get('https://graph.microsoft.com/v1.0/me').parsed
end