Class: HolisticAuth::Providers::Outlook

Inherits:
MsGraph show all
Defined in:
lib/holistic_auth/providers/outlook.rb

Constant Summary collapse

RESOURCE =
'https://outlook.office.com'.freeze
API_VERSION =
'v2.0'.freeze
SETTINGS =
{
  site: 'https://login.microsoftonline.com',
  token_url: 'oauth2/v2.0/token',
  user_info_url: URI("#{RESOURCE}/api/#{API_VERSION}/Me"),
  additional_parameters: {
    resource: RESOURCE,
  },
}.freeze

Constants inherited from MsGraph

MsGraph::DEFAULT_CONTENT_TYPE, MsGraph::GRAPH_RESOURCE

Instance Attribute Summary

Attributes inherited from GenericProvider

#api_key, #client_id, #client_secret, #oauth2_client, #site, #tenant_id, #token_url, #user_info_url

Instance Method Summary collapse

Methods inherited from MsGraph

#full_site_url, #query!, #retrieve_user_info, #sanity_check!, #settings

Methods inherited from GenericProvider

#add_secrets, #empty?, #exchange, #full_site_url, #initialize, #present?, #retrieve_user_info, #secrets, #settings, #site_token_url, #to_hash

Constructor Details

This class inherits a constructor from HolisticAuth::Providers::GenericProvider

Instance Method Details

#nameObject



16
17
18
# File 'lib/holistic_auth/providers/outlook.rb', line 16

def name
  :outlook
end

#process_info(hash) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/holistic_auth/providers/outlook.rb', line 20

def process_info(hash)
  sanity_check!(hash)

  {
    email_verified: hash['EmailAddress'].present?,
    email: hash['EmailAddress'],
    display_name: hash['DisplayName'],
    name: {
      givenName: hash['givenName'],
      familyName: hash['familyName'],
    },
    picture_url: '',
    uid: hash['Id'],
    language: hash['preferredLanguage'],
  }.with_indifferent_access
end