From 6db2bf2a21bc4f4b6b15c910d5980119a72b3a6b Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 25 May 2021 11:40:49 +0200 Subject: [PATCH] api: fix error when authorization header has no spaces Signed-off-by: Jens Langhammer --- authentik/api/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authentik/api/authentication.py b/authentik/api/authentication.py index 82a4c1b01..c3a760141 100644 --- a/authentik/api/authentication.py +++ b/authentik/api/authentication.py @@ -18,7 +18,7 @@ LOGGER = get_logger() def token_from_header(raw_header: bytes) -> Optional[Token]: """raw_header in the Format of `Bearer dGVzdDp0ZXN0`""" auth_credentials = raw_header.decode() - if auth_credentials == "": + if auth_credentials == "" or " " not in auth_credentials: return None auth_type, auth_credentials = auth_credentials.split() if auth_type.lower() not in ["basic", "bearer"]: