diff options
author | Rubén Dávila <ruben@gitlab.com> | 2017-07-27 02:12:20 +0300 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2017-07-27 16:45:16 +0300 |
commit | ef97cb54ae3c62e8bc9062c7f32901520865d754 (patch) | |
tree | c5dcd347bbc9ab20105984637433f089ab4ee9fc /config/initializers/omniauth.rb | |
parent | 4eebd8e1957a3fc3a3479331fde9f34aa8afa9d5 (diff) |
Backport some recent changes related to LDAP from EE
Diffstat (limited to 'config/initializers/omniauth.rb')
-rw-r--r-- | config/initializers/omniauth.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index a36e59c941a..56c279ffcf4 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,13 +1,16 @@ if Gitlab::LDAP::Config.enabled? module OmniAuth::Strategies - server = Gitlab.config.ldap.servers.values.first - klass = server['provider_class'] - const_set(klass, Class.new(LDAP)) unless klass == 'LDAP' + Gitlab::LDAP::Config.available_servers.each do |server| + # do not redeclare LDAP + next if server['provider_name'] == 'ldap' + const_set(server['provider_class'], Class.new(LDAP)) + end end OmniauthCallbacksController.class_eval do - server = Gitlab.config.ldap.servers.values.first - alias_method server['provider_name'], :ldap + Gitlab::LDAP::Config.available_servers.each do |server| + alias_method server['provider_name'], :ldap + end end end |