Allow colon in password

- It was disallowed because of a too strict intepretation of RFC2617
This commit is contained in:
Hypolite Petovan 2023-01-18 20:33:39 -05:00
parent 81cd334664
commit d2033d4c92
4 changed files with 9 additions and 6 deletions

View file

@ -61,7 +61,10 @@ class Token extends BaseApi
}
if (empty($request['client_id']) && substr($authorization, 0, 6) == 'Basic ') {
$datapair = explode(':', base64_decode(trim(substr($authorization, 6))));
// Per RFC2617, usernames can't contain a colon but password can,
// so we cut on the first colon to obtain the username and the password
// @see https://www.rfc-editor.org/rfc/rfc2617#section-2
$datapair = explode(':', base64_decode(trim(substr($authorization, 6))), 2);
if (count($datapair) == 2) {
$request['client_id'] = $datapair[0];
$request['client_secret'] = $datapair[1];