diff options
author | Imre Farkas <ifarkas@gitlab.com> | 2018-11-13 00:40:42 +0300 |
---|---|---|
committer | Imre Farkas <ifarkas@gitlab.com> | 2018-11-18 23:00:28 +0300 |
commit | 02326fa4b128c6272cc5c802cf5145f0fa6f6cc2 (patch) | |
tree | a17739647988e8f2c3e414cb9c91d76c09496f6a /app/helpers/auth_helper.rb | |
parent | 29d8179ba07be3ed111f939285eb4064d84cb7df (diff) |
Backport of ee/8120: Smartcard authentication
Diffstat (limited to 'app/helpers/auth_helper.rb')
-rw-r--r-- | app/helpers/auth_helper.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index c158cf20dd6..44f85e9c0f8 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -24,6 +24,23 @@ module AuthHelper Gitlab::Auth::OAuth::Provider.label_for(name) end + def form_based_provider_priority + ['crowd', /^ldap/, 'kerberos'] + end + + def form_based_provider_with_highest_priority + @form_based_provider_with_highest_priority ||= begin + form_based_provider_priority.each do |provider_regexp| + highest_priority = form_based_providers.find { |provider| provider.match?(provider_regexp) } + break highest_priority unless highest_priority.nil? + end + end + end + + def form_based_auth_provider_has_active_class?(provider) + form_based_provider_with_highest_priority == provider + end + def form_based_provider?(name) [LDAP_PROVIDER, 'crowd'].any? { |pattern| pattern === name.to_s } end |