2018-02-23 07:10:39 -05:00
|
|
|
if Gitlab::Auth::LDAP::Config.enabled?
|
2014-10-15 03:53:16 -04:00
|
|
|
module OmniAuth::Strategies
|
2018-02-23 07:10:39 -05:00
|
|
|
Gitlab::Auth::LDAP::Config.available_servers.each do |server|
|
2017-07-26 19:12:20 -04:00
|
|
|
# do not redeclare LDAP
|
|
|
|
next if server['provider_name'] == 'ldap'
|
2017-11-14 04:02:39 -05:00
|
|
|
|
2017-07-26 19:12:20 -04:00
|
|
|
const_set(server['provider_class'], Class.new(LDAP))
|
|
|
|
end
|
2014-10-15 03:53:16 -04:00
|
|
|
end
|
2015-02-03 00:53:27 -05:00
|
|
|
end
|
2015-04-24 11:03:18 -04:00
|
|
|
|
2015-08-23 16:31:02 -04:00
|
|
|
OmniAuth.config.full_host = Settings.gitlab['base_url']
|
2015-04-24 11:03:18 -04:00
|
|
|
OmniAuth.config.allowed_request_methods = [:post]
|
2016-05-31 18:33:46 -04:00
|
|
|
# In case of auto sign-in, the GET method is used (users don't get to click on a button)
|
2015-05-27 11:40:21 -04:00
|
|
|
OmniAuth.config.allowed_request_methods << :get if Gitlab.config.omniauth.auto_sign_in_with_provider.present?
|
2015-04-24 11:03:18 -04:00
|
|
|
OmniAuth.config.before_request_phase do |env|
|
2017-06-22 01:19:14 -04:00
|
|
|
Gitlab::RequestForgeryProtection.call(env)
|
2015-04-24 11:03:18 -04:00
|
|
|
end
|
2015-06-15 12:04:30 -04:00
|
|
|
|
|
|
|
if Gitlab.config.omniauth.enabled
|
2017-03-13 09:07:38 -04:00
|
|
|
provider_names = Gitlab.config.omniauth.providers.map(&:name)
|
|
|
|
require 'omniauth-kerberos' if provider_names.include?('kerberos')
|
2015-06-15 12:04:30 -04:00
|
|
|
end
|
2016-08-22 14:36:41 -04:00
|
|
|
|
|
|
|
module OmniAuth
|
|
|
|
module Strategies
|
2017-03-13 09:07:38 -04:00
|
|
|
autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket')
|
2016-08-22 14:36:41 -04:00
|
|
|
end
|
|
|
|
end
|