forked from External/greenlight
GRN2-107: Add office365 auth (#616)
* add office365 auth * Delete conflicting file
This commit is contained in:
committed by
Jesus Federico
parent
40b05b1626
commit
fc18976b6d
@ -123,7 +123,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.customBtn-microsoft_office365 {
|
||||
.customBtn-office365 {
|
||||
@extend .customBtn;
|
||||
background: #f65314;
|
||||
|
||||
|
@ -78,17 +78,23 @@ module SessionsHelper
|
||||
end
|
||||
|
||||
def omniauth_options(env)
|
||||
gl_redirect_url = (Rails.env.production? ? "https" : env["rack.url_scheme"]) + "://" + env["SERVER_NAME"] + ":" +
|
||||
env["SERVER_PORT"]
|
||||
user_domain = parse_user_domain(env["SERVER_NAME"])
|
||||
env['omniauth.strategy'].options[:customer] = user_domain
|
||||
env['omniauth.strategy'].options[:gl_redirect_url] = gl_redirect_url
|
||||
env['omniauth.strategy'].options[:default_callback_url] = Rails.configuration.gl_callback_url
|
||||
env['omniauth.strategy'].options[:checksum] = generate_checksum(user_domain, gl_redirect_url,
|
||||
Rails.configuration.launcher_secret)
|
||||
if env['omniauth.strategy'].options[:name] == "bn-launcher"
|
||||
gl_redirect_url = (Rails.env.production? ? "https" : env["rack.url_scheme"]) + "://" + env["SERVER_NAME"] + ":" +
|
||||
env["SERVER_PORT"]
|
||||
user_domain = parse_user_domain(env["SERVER_NAME"])
|
||||
env['omniauth.strategy'].options[:customer] = user_domain
|
||||
env['omniauth.strategy'].options[:gl_redirect_url] = gl_redirect_url
|
||||
env['omniauth.strategy'].options[:default_callback_url] = Rails.configuration.gl_callback_url
|
||||
env['omniauth.strategy'].options[:checksum] = generate_checksum(user_domain, gl_redirect_url,
|
||||
Rails.configuration.launcher_secret)
|
||||
elsif env['omniauth.strategy'].options[:name] == "google"
|
||||
set_hd(env, ENV['GOOGLE_OAUTH2_HD'])
|
||||
elsif env['omniauth.strategy'].options[:name] == "office365"
|
||||
set_hd(env, ENV['OFFICE365_HD'])
|
||||
end
|
||||
end
|
||||
|
||||
def google_omniauth_hd(env, hd)
|
||||
def set_hd(env, hd)
|
||||
hd_opts = hd.split(',')
|
||||
env['omniauth.strategy'].options[:hd] =
|
||||
if hd_opts.empty?
|
||||
|
@ -70,7 +70,7 @@ class User < ApplicationRecord
|
||||
# Provider attributes.
|
||||
def auth_name(auth)
|
||||
case auth['provider']
|
||||
when :microsoft_office365
|
||||
when :office365
|
||||
auth['info']['display_name']
|
||||
else
|
||||
auth['info']['name']
|
||||
@ -97,7 +97,7 @@ class User < ApplicationRecord
|
||||
when :twitter
|
||||
auth['info']['image'].gsub("http", "https").gsub("_normal", "")
|
||||
else
|
||||
auth['info']['image'] unless auth['provider'] == :microsoft_office365
|
||||
auth['info']['image']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user