diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-04-23 02:15:48 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2018-04-30 19:32:23 +0300 |
commit | c741f95a3b599971aaf3dfc1ff3ca43a8ba938b8 (patch) | |
tree | 753c43562b26bd99f6f4d37de75fa3e40cb9f838 /app/helpers | |
parent | b51f6e2c214df34a94b9097355775f29b269524b (diff) |
Exclude LDAP from OmniauthCallbackController base methods
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/auth_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index c109954f3a3..d2daee22aba 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -1,6 +1,6 @@ module AuthHelper PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze - FORM_BASED_PROVIDERS = [/\Aldap/, 'crowd'].freeze + LDAP_PROVIDER = /\Aldap/ def ldap_enabled? Gitlab::Auth::LDAP::Config.enabled? @@ -23,7 +23,7 @@ module AuthHelper end def form_based_provider?(name) - FORM_BASED_PROVIDERS.any? { |pattern| pattern === name.to_s } + [LDAP_PROVIDER, 'crowd'].any? { |pattern| pattern === name.to_s } end def form_based_providers @@ -38,6 +38,10 @@ module AuthHelper auth_providers.reject { |provider| form_based_provider?(provider) } end + def providers_for_base_controller + auth_providers.reject { |provider| LDAP_PROVIDER === provider } + end + def enabled_button_based_providers disabled_providers = Gitlab::CurrentSettings.disabled_oauth_sign_in_sources || [] |