Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2018-03-15 18:58:18 +0300
committerMark Fletcher <mark@gitlab.com>2018-03-16 14:58:24 +0300
commit7dd97985d11369c62056a4b91b7a88c88443c641 (patch)
tree45b4bbf78f37572376d576abd1b2ae2281deef9a /app
parent4b55923402f75ce7651bc173f2c3b46b397b7c88 (diff)
Merge branch 'fix/auth0-unsafe-login-10-4' into 'security-10-4'
[10.4] Fix GitLab Auth0 integration signs in the wrong user See merge request gitlab/gitlabhq!2352
Diffstat (limited to 'app')
-rw-r--r--app/controllers/omniauth_callbacks_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index 54d8566cc77..0f86cfc98c0 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -93,6 +93,14 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
handle_omniauth
end
+ def auth0
+ if oauth['uid'].blank?
+ fail_auth0_login
+ else
+ handle_omniauth
+ end
+ end
+
private
def handle_omniauth
@@ -167,6 +175,12 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
redirect_to new_user_session_path
end
+ def fail_auth0_login
+ flash[:alert] = 'Wrong extern UID provided. Make sure Auth0 is configured correctly.'
+
+ redirect_to new_user_session_path
+ end
+
def handle_disabled_provider
label = Gitlab::OAuth::Provider.label_for(oauth['provider'])
flash[:alert] = "Signing in using #{label} has been disabled"