Commit 1e2b6cf5 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Introduce Gitlab::Auth.omniauth_setup_providers

Which could extend from EE
parent 39b6f31c
......@@ -19,11 +19,5 @@ end
if Gitlab.config.omniauth.enabled
provider_names = Gitlab.config.omniauth.providers.map(&:name)
require 'omniauth-kerberos' if provider_names.include?('kerberos')
Gitlab::Auth.omniauth_providers.each do |provider|
if provider_names.include?(provider)
require_dependency "omni_auth/strategies/#{provider}"
end
end
Gitlab::Auth.omniauth_setup_providers(provider_names)
end
......@@ -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:)
......
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