diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-06-01 09:05:07 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-06-01 09:30:10 +0300 |
commit | 1e2b6cf514bcefd21520fef63b3fee5a29d334cd (patch) | |
tree | 462fc79ea4dd3b80af793f35a69ee0c5bf8bbc1e /lib/gitlab/auth.rb | |
parent | 39b6f31c66ff51451033ff84a2832731065cd28d (diff) |
Introduce Gitlab::Auth.omniauth_setup_providers
Which could extend from EE
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r-- | lib/gitlab/auth.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 7047724cfe1..0f7a7b0ce8d 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -14,8 +14,23 @@ module Gitlab DEFAULT_SCOPES = [:api].freeze class << self - def omniauth_providers - %w[bitbucket jwt] + def omniauth_customized_providers + @omniauth_customized_providers ||= %w[bitbucket jwt] + end + + def omniauth_setup_providers(provider_names) + provider_names.each do |provider| + omniauth_setup_a_provider(provider) + end + end + + def omniauth_setup_a_provider(provider) + case provider + when 'kerberos' + require 'omniauth-kerberos' + when *omniauth_customized_providers + require_dependency "omni_auth/strategies/#{provider}" + end end def find_for_git_client(login, password, project:, ip:) |