diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-07-02 16:46:24 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-07-02 16:46:24 +0800 |
commit | 3b8b38fb0f6e8e6f73ac39c96a9338c5fc875f6f (patch) | |
tree | a8598ee32076663964f66463425dafe2ee1f464d | |
parent | 17a38b5a8b722db6f7ebf1c6eb801c63ad371880 (diff) | |
download | gitlab-ce-3b8b38fb0f6e8e6f73ac39c96a9338c5fc875f6f.tar.gz |
If `omniauth_auto_sign_in_with_provider` is set,
it also means we're using omniauth, so we need to set it up.
-rw-r--r-- | config/initializers/devise.rb | 2 | ||||
-rw-r--r-- | config/initializers/omniauth.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/omniauth_initializer.rb | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index d051b699102..e5772c33307 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -219,7 +219,7 @@ Devise.setup do |config| end end - if Gitlab.config.omniauth.enabled + if Gitlab::OmniauthInitializer.enabled? Gitlab::OmniauthInitializer.new(config).execute(Gitlab.config.omniauth.providers) end end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index a7fa926a853..c558eb28ced 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -17,7 +17,7 @@ OmniAuth.config.before_request_phase do |env| Gitlab::RequestForgeryProtection.call(env) end -if Gitlab.config.omniauth.enabled +if Gitlab::OmniauthInitializer.enabled? provider_names = Gitlab.config.omniauth.providers.map(&:name) Gitlab::Auth.omniauth_setup_providers(provider_names) end diff --git a/lib/gitlab/omniauth_initializer.rb b/lib/gitlab/omniauth_initializer.rb index 35ed3a5ac05..a71acda8701 100644 --- a/lib/gitlab/omniauth_initializer.rb +++ b/lib/gitlab/omniauth_initializer.rb @@ -1,5 +1,10 @@ module Gitlab class OmniauthInitializer + def self.enabled? + Gitlab.config.omniauth.enabled || + Gitlab.config.omniauth.auto_sign_in_with_provider.present? + end + def initialize(devise_config) @devise_config = devise_config end |