From 3d9874be698d46041ba5124fe945dbb8765e584e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 13 Apr 2021 21:41:26 +0200 Subject: [PATCH 1/2] api: fix error when authorization is empty Signed-off-by: Jens Langhammer --- authentik/api/auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/authentik/api/auth.py b/authentik/api/auth.py index a2f36c208..f0baa6ed8 100644 --- a/authentik/api/auth.py +++ b/authentik/api/auth.py @@ -15,6 +15,8 @@ LOGGER = get_logger() def token_from_header(raw_header: bytes) -> Optional[Token]: """raw_header in the Format of `Basic dGVzdDp0ZXN0`""" auth_credentials = raw_header.decode() + if auth_credentials == "": + return None # Legacy, accept basic auth thats fully encoded (2021.3 outposts) if " " not in auth_credentials: try: From 85c9fbe7631f3c92406bfde7e83f34b140725a64 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 13 Apr 2021 21:49:41 +0200 Subject: [PATCH 2/2] api: fix linting error Signed-off-by: Jens Langhammer --- authentik/api/auth.py | 1 + 1 file changed, 1 insertion(+) diff --git a/authentik/api/auth.py b/authentik/api/auth.py index f0baa6ed8..da6a154bf 100644 --- a/authentik/api/auth.py +++ b/authentik/api/auth.py @@ -12,6 +12,7 @@ from authentik.core.models import Token, TokenIntents, User LOGGER = get_logger() +# pylint: disable=too-many-return-statements def token_from_header(raw_header: bytes) -> Optional[Token]: """raw_header in the Format of `Basic dGVzdDp0ZXN0`""" auth_credentials = raw_header.decode()