Backend tweaks to make authorization work (#14339)

* Backend tweaks to make authorization work

* Lint

* Add test

* Validate redirect uris

* Fix tests

* Fix tests

* Lint
This commit is contained in:
Paulus Schoutsen 2018-05-10 04:38:11 -04:00 committed by Pascal Vizeli
parent 0f3ec94fba
commit 5ec7fc7ddb
17 changed files with 176 additions and 58 deletions

View file

@ -81,7 +81,12 @@ async def async_validate_auth_header(api_password, request):
if hdrs.AUTHORIZATION not in request.headers:
return False
auth_type, auth_val = request.headers.get(hdrs.AUTHORIZATION).split(' ', 1)
try:
auth_type, auth_val = \
request.headers.get(hdrs.AUTHORIZATION).split(' ', 1)
except ValueError:
# If no space in authorization header
return False
if auth_type == 'Basic':
decoded = base64.b64decode(auth_val).decode('utf-8')