Veify Authorization Scheme

This commit is contained in:
Unrud 2016-05-26 12:21:09 +02:00
parent da1363f026
commit ecbffe69dc

View File

@ -251,8 +251,8 @@ class Application:
# Ask authentication backend to check rights # Ask authentication backend to check rights
authorization = environ.get("HTTP_AUTHORIZATION", None) authorization = environ.get("HTTP_AUTHORIZATION", None)
if authorization: if authorization and authorization.startswith("Basic"):
authorization = authorization.lstrip("Basic").strip() authorization = authorization[len("Basic"):].strip()
user, password = self.decode(base64.b64decode( user, password = self.decode(base64.b64decode(
authorization.encode("ascii")), environ).split(":", 1) authorization.encode("ascii")), environ).split(":", 1)
else: else: