From af2e85cb2b3774ff20bc367c53a0faaae1b301ff Mon Sep 17 00:00:00 2001
From: Markus Scheidgen <markus.scheidgen@gmail.com>
Date: Thu, 30 May 2024 00:35:58 +0200
Subject: [PATCH] Only use test assumed auth when no actual auth is given.

---
 nomad/app/v1/routers/auth.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nomad/app/v1/routers/auth.py b/nomad/app/v1/routers/auth.py
index e0a149b72c..f758d6e80c 100644
--- a/nomad/app/v1/routers/auth.py
+++ b/nomad/app/v1/routers/auth.py
@@ -92,7 +92,7 @@ def create_user_dependency(
             user = _get_user_signature_token_auth(
                 kwargs.get('signature_token'), kwargs.get('request')
             )
-        if config.tests.assume_auth_for_username:
+        if user is None and config.tests.assume_auth_for_username:
             user = datamodel.User.get(username=config.tests.assume_auth_for_username)
 
         if required and not user:
-- 
GitLab