Commit e3670ac9 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

If `omniauth_auto_sign_in_with_provider` is set,

it also means we're using omniauth, so we need to set it up.
parent 23a770a69199
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
end end
end end
if Gitlab.config.omniauth.enabled if Gitlab::OmniauthInitializer.enabled?
Gitlab::OmniauthInitializer.new(config).execute(Gitlab.config.omniauth.providers) Gitlab::OmniauthInitializer.new(config).execute(Gitlab.config.omniauth.providers)
end end
end end
...@@ -17,7 +17,7 @@ module OmniAuth::Strategies ...@@ -17,7 +17,7 @@ module OmniAuth::Strategies
Gitlab::RequestForgeryProtection.call(env) Gitlab::RequestForgeryProtection.call(env)
end end
if Gitlab.config.omniauth.enabled if Gitlab::OmniauthInitializer.enabled?
provider_names = Gitlab.config.omniauth.providers.map(&:name) provider_names = Gitlab.config.omniauth.providers.map(&:name)
Gitlab::Auth.omniauth_setup_providers(provider_names) Gitlab::Auth.omniauth_setup_providers(provider_names)
end end
module Gitlab module Gitlab
class OmniauthInitializer class OmniauthInitializer
def self.enabled?
Gitlab.config.omniauth.enabled ||
Gitlab.config.omniauth.auto_sign_in_with_provider.present?
end
def initialize(devise_config) def initialize(devise_config)
@devise_config = devise_config @devise_config = devise_config
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment