alfresco-js-api icon indicating copy to clipboard operation
alfresco-js-api copied to clipboard

Basic auth fails for passwords which contain spaces

Open syankov opened this issue 6 years ago • 0 comments

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!

syankov avatar May 23 '19 19:05 syankov