Improved error message for SSO if REMOTE_USER is blank.

This commit is contained in:
Martin Edenhofer 2020-08-13 09:47:27 +02:00 committed by Thorsten Eckel
parent 806cd7def6
commit 8a3be0488d

View file

@ -146,11 +146,11 @@ module ApplicationController::Authenticates
login = request.env['REMOTE_USER'] || login = request.env['REMOTE_USER'] ||
request.env['HTTP_REMOTE_USER'] || request.env['HTTP_REMOTE_USER'] ||
request.headers['X-Forwarded-User'] request.headers['X-Forwarded-User']
User.lookup(login: login&.downcase) User.lookup(login: login&.downcase)
end 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) session.delete(:switched_from_user_id)
authentication_check_prerequesits(user, 'SSO', {}) authentication_check_prerequesits(user, 'SSO', {})