2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2017-07-13 15:08:53 +00:00
|
|
|
class MicrosoftOffice365Database < OmniAuth::Strategies::MicrosoftOffice365
|
|
|
|
option :name, 'microsoft_office365'
|
|
|
|
|
|
|
|
def initialize(app, *args, &block)
|
|
|
|
|
|
|
|
# database lookup
|
|
|
|
config = Setting.get('auth_microsoft_office365_credentials') || {}
|
|
|
|
args[0] = config['app_id']
|
|
|
|
args[1] = config['app_secret']
|
2021-03-08 13:13:15 +00:00
|
|
|
tenant = config['app_tenant'].presence || 'common'
|
|
|
|
|
2017-07-13 15:08:53 +00:00
|
|
|
super
|
2021-03-08 13:13:15 +00:00
|
|
|
|
|
|
|
@options[:client_options][:authorize_url] = "/#{tenant}/oauth2/v2.0/authorize"
|
|
|
|
@options[:client_options][:token_url] = "/#{tenant}/oauth2/v2.0/token"
|
2017-07-13 15:08:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|