BigW Consortium Gitlab

omniauth.rb 958 Bytes
Newer Older
1 2 3
if Gitlab::LDAP::Config.enabled?
  module OmniAuth::Strategies
    server = Gitlab.config.ldap.servers.values.first
4 5
    klass = server['provider_class']
    const_set(klass, Class.new(LDAP)) unless klass == 'LDAP'
6
  end
7

8 9 10 11
  OmniauthCallbacksController.class_eval do
    server = Gitlab.config.ldap.servers.values.first
    alias_method server['provider_name'], :ldap
  end
12
end
13

14
OmniAuth.config.full_host = Settings.gitlab['base_url']
15
OmniAuth.config.allowed_request_methods = [:post]
16
# In case of auto sign-in, the GET method is used (users don't get to click on a button)
17
OmniAuth.config.allowed_request_methods << :get if Gitlab.config.omniauth.auto_sign_in_with_provider.present?
18
OmniAuth.config.before_request_phase do |env|
19
  OmniAuth::RequestForgeryProtection.call(env)
20
end
21 22 23

if Gitlab.config.omniauth.enabled
  Gitlab.config.omniauth.providers.each do |provider|
Marin Jankovski committed
24 25 26
    if provider['name'] == 'kerberos'
      require 'omniauth-kerberos'
    end
27 28
  end
end