api: add fallback for proxies < 0.12 which send authorization without b64
This commit is contained in:
parent
ee670d5e19
commit
152b2d863d
|
@ -248,6 +248,7 @@ stages:
|
||||||
inputs:
|
inputs:
|
||||||
script: |
|
script: |
|
||||||
docker stop $(docker ps -aq)
|
docker stop $(docker ps -aq)
|
||||||
|
docker container prune -f
|
||||||
- task: CmdLine@2
|
- task: CmdLine@2
|
||||||
displayName: Prepare unittests and coverage for upload
|
displayName: Prepare unittests and coverage for upload
|
||||||
inputs:
|
inputs:
|
||||||
|
|
|
@ -22,7 +22,13 @@ def token_from_header(raw_header: bytes) -> Optional[Token]:
|
||||||
"Unsupported authentication type, denying", type=auth_type.lower()
|
"Unsupported authentication type, denying", type=auth_type.lower()
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
try:
|
||||||
auth_credentials = b64decode(auth_credentials.encode()).decode()
|
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
|
# Accept credentials with username and without
|
||||||
if ":" in auth_credentials:
|
if ":" in auth_credentials:
|
||||||
_, password = auth_credentials.split(":")
|
_, password = auth_credentials.split(":")
|
||||||
|
|
Reference in a new issue