alfresco-js-api
alfresco-js-api copied to clipboard
Basic auth fails for passwords which contain spaces
Type of issue:
- [x] Bug
Current behavior: When trying to log in in the ADF login component using basic authentication, the authentication fails when the password contains spaces (and most likely also for other escaped characters). It appears that the username and password strings are URI encoded before the authorization header is base64 encoded, which introduces additional characters to the Authorization header when username and/or password contain escaped characters:
https://github.com/Alfresco/alfresco-js-api/blob/5d1344e556f67ebb5b0c2e2aa297700c1307668f/src/alfrescoApiClient.ts#L244
Example ADF login:
username: admin
password: A strong password!
results in
Authorization: Basic YWRtaW46QSUyMHN0cm9uZyUyMHBhc3N3b3JkIQ==
which is the equivalent of
Authorization: Basic admin:A%20strong%20password!
instead of
Expected Behavior
Authorization: Basic YWRtaW46QSBzdHJvbmcgcGFzc3dvcmQh
which would be
Authorization: Basic admin:A strong password!