From 8a3be0488d923ba11d838d22e58398c83191b881 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 13 Aug 2020 09:47:27 +0200 Subject: [PATCH] Improved error message for SSO if REMOTE_USER is blank. --- app/controllers/application_controller/authenticates.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller/authenticates.rb b/app/controllers/application_controller/authenticates.rb index af92d076e..0810eb9b4 100644 --- a/app/controllers/application_controller/authenticates.rb +++ b/app/controllers/application_controller/authenticates.rb @@ -146,11 +146,11 @@ module ApplicationController::Authenticates login = request.env['REMOTE_USER'] || request.env['HTTP_REMOTE_USER'] || request.headers['X-Forwarded-User'] - User.lookup(login: login&.downcase) end - raise Exceptions::NotAuthorized, 'Missing SSO ENV REMOTE_USER' if !user + raise Exceptions::NotAuthorized, 'Missing SSO ENV REMOTE_USER' if login.blank? + raise Exceptions::NotAuthorized, "No such user #{login} from ENV REMOTE_USER" if !user session.delete(:switched_from_user_id) authentication_check_prerequesits(user, 'SSO', {})