From 996bd05ba6e0e63d684b86291f3098007e4c5d01 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 31 Mar 2022 00:06:01 +0200 Subject: [PATCH] api: fix API header auth not passing to next auth method Signed-off-by: Jens Langhammer --- authentik/api/authentication.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/authentik/api/authentication.py b/authentik/api/authentication.py index 3e7faaf85..5e95fab1d 100644 --- a/authentik/api/authentication.py +++ b/authentik/api/authentication.py @@ -32,6 +32,8 @@ def validate_auth(header: bytes) -> str: def bearer_auth(raw_header: bytes) -> Optional[User]: """raw_header in the Format of `Bearer ....`""" auth_credentials = validate_auth(raw_header) + if not auth_credentials: + return None # first, check traditional tokens token = Token.filter_not_expired(key=auth_credentials, intent=TokenIntents.INTENT_API).first() if hasattr(LOCAL, "authentik"):