summaryrefslogtreecommitdiff
path: root/config/routes/user.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-04-25 10:51:41 +0100
committerPhil Hughes <me@iamphill.com>2018-04-25 10:51:41 +0100
commit9990afb92c28c94e89a1c81c8b2f2c02c04dc86b (patch)
treeaecb679c6954c85b435b9fcad5c5199cde34b9b6 /config/routes/user.rb
parent10bba03843c155beb58b9d054029d2083776cc56 (diff)
parentb36941bdaad03eeb5ab23235b77f1bfad0348f18 (diff)
downloadgitlab-ce-9990afb92c28c94e89a1c81c8b2f2c02c04dc86b.tar.gz
Merge branch 'master' into ide-temp-file-folder-fixes
Diffstat (limited to 'config/routes/user.rb')
-rw-r--r--config/routes/user.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/routes/user.rb b/config/routes/user.rb
index 57fb37530bb..f8677693fab 100644
--- a/config/routes/user.rb
+++ b/config/routes/user.rb
@@ -1,3 +1,21 @@
+# Allows individual providers to be directed to a chosen controller
+# Call from inside devise_scope
+def override_omniauth(provider, controller, path_prefix = '/users/auth')
+ match "#{path_prefix}/#{provider}/callback",
+ to: "#{controller}##{provider}",
+ as: "#{provider}_omniauth_callback",
+ via: [:get, :post]
+end
+
+# Use custom controller for LDAP omniauth callback
+if Gitlab::Auth::LDAP::Config.enabled?
+ devise_scope :user do
+ Gitlab::Auth::LDAP::Config.available_servers.each do |server|
+ override_omniauth(server['provider_name'], 'ldap/omniauth_callbacks')
+ end
+ end
+end
+
devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks,
registrations: :registrations,
passwords: :passwords,