summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-11-14 10:23:21 +0000
committerRémy Coutable <remy@rymai.me>2016-11-14 10:23:21 +0000
commit2a90b69a8d968dc22ef630a948ae6f77fd927f23 (patch)
tree2c96b404a545456d4a9fa213f9bcd6c654e2167c /config
parentd67932923f3faf4c8b5a466b511a39bb91b709ef (diff)
parentc50b98da723dab9a35ddb2cde0258d141cf92495 (diff)
downloadgitlab-ce-2a90b69a8d968dc22ef630a948ae6f77fd927f23.tar.gz
Merge branch 'user_filter_auth' into 'master'
Centralized all LDAP config logic in to `Gitlab::LDAP::Config`. We had varying configuration for devise/omniauth and other things. For example, `user_filter` was never taken in to account for devise/omniauth so a user object would always be created, even if the user did not match the user_filter. Fixes gitlab-org/gitlab-ce#21195, https://gitlab.com/gitlab-org/gitlab-ce/issues/15396 and gitlab-org/gitlab-ce#13296 See merge request !6606
Diffstat (limited to 'config')
-rw-r--r--config/initializers/devise.rb19
1 files changed, 3 insertions, 16 deletions
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index a0a8f88584c..f06c4d4ecf2 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -213,22 +213,9 @@ Devise.setup do |config|
end
if Gitlab::LDAP::Config.enabled?
- Gitlab.config.ldap.servers.values.each do |server|
- if server['allow_username_or_email_login']
- email_stripping_proc = ->(name) {name.gsub(/@.*\z/, '')}
- else
- email_stripping_proc = ->(name) {name}
- end
-
- config.omniauth server['provider_name'],
- host: server['host'],
- base: server['base'],
- uid: server['uid'],
- port: server['port'],
- method: server['method'],
- bind_dn: server['bind_dn'],
- password: server['password'],
- name_proc: email_stripping_proc
+ Gitlab::LDAP::Config.providers.each do |provider|
+ ldap_config = Gitlab::LDAP::Config.new(provider)
+ config.omniauth(provider, ldap_config.omniauth_options)
end
end