api: add fallback for proxies < 0.12 which send authorization without b64

This commit is contained in:
Jens Langhammer 2020-10-18 15:14:00 +02:00
parent ee670d5e19
commit 152b2d863d
2 changed files with 8 additions and 1 deletions

View File

@ -248,6 +248,7 @@ stages:
inputs:
script: |
docker stop $(docker ps -aq)
docker container prune -f
- task: CmdLine@2
displayName: Prepare unittests and coverage for upload
inputs:

View File

@ -22,7 +22,13 @@ def token_from_header(raw_header: bytes) -> Optional[Token]:
"Unsupported authentication type, denying", type=auth_type.lower()
)
return None
try:
auth_credentials = b64decode(auth_credentials.encode()).decode()
except UnicodeDecodeError:
# TODO: Remove this workaround
# temporary fallback for 0.11 to 0.12 upgrade
# 0.11 and below proxy sends authorization header not base64 encoded
auth_credentials = auth_credentials
# Accept credentials with username and without
if ":" in auth_credentials:
_, password = auth_credentials.split(":")