From 262a8b5ae8205b73f8f0cf413a4b34283903c2d7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 28 Jun 2021 20:13:08 +0200 Subject: [PATCH] api: use partition instead of split for token 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 1d38fc9e5..ee423bf59 100644 --- a/authentik/api/authentication.py +++ b/authentik/api/authentication.py @@ -19,7 +19,7 @@ def token_from_header(raw_header: bytes) -> Optional[Token]: auth_credentials = raw_header.decode() if auth_credentials == "" or " " not in auth_credentials: return None - auth_type, auth_credentials = auth_credentials.split() + auth_type, _, auth_credentials = auth_credentials.partition(" ") if auth_type.lower() not in ["basic", "bearer"]: LOGGER.debug("Unsupported authentication type, denying", type=auth_type.lower()) raise AuthenticationFailed("Unsupported authentication type")