diff --git a/cps/web.py b/cps/web.py index ab38f3d4..a98cb6e1 100644 --- a/cps/web.py +++ b/cps/web.py @@ -123,13 +123,7 @@ def load_user(user_id): @lm.request_loader -def load_user_from_request(request): - auth_header = request.headers.get("Authorization") - if auth_header: - user = load_user_from_auth_header(auth_header) - if user: - return user - +def load_user_from_request(request): if config.config_allow_reverse_proxy_header_login: rp_header_name = config.config_reverse_proxy_login_header_name if rp_header_name: @@ -138,6 +132,12 @@ def load_user_from_request(request): user = _fetch_user_by_name(rp_header_username) if user: return user + + auth_header = request.headers.get("Authorization") + if auth_header: + user = load_user_from_auth_header(auth_header) + if user: + return user return