summaryrefslogtreecommitdiff
path: root/config/routes
diff options
context:
space:
mode:
authorDylan Griffith <dyl.griffith@gmail.com>2018-04-26 09:45:01 +0800
committerDylan Griffith <dyl.griffith@gmail.com>2018-04-26 09:45:01 +0800
commitc80e6b9c1229776cf5af065954b99c182cc046c2 (patch)
tree5b9d1ca0c9f0101fd663fd83d68012c49f0ab54b /config/routes
parent51cc01b6c9468056f40cdc8deb0e4b6414a3ccb9 (diff)
parent55f07cc32e7684b21e0c1662c70128df14c6abf7 (diff)
downloadgitlab-ce-c80e6b9c1229776cf5af065954b99c182cc046c2.tar.gz
Merge branch 'master' into siemens-runner-per-group
Diffstat (limited to 'config/routes')
-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,