fix: [keycloak] fixed encoding issue with urlencoded usernames created in keycloak

cli-modification-summary
iglocska 2022-08-23 11:05:07 +02:00
parent d96353ee4f
commit 1077251f8b
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 10 additions and 1 deletions

View File

@ -409,7 +409,11 @@ class AuthKeycloakBehavior extends Behavior
]
]);
}
$newUser = $this->restApiRequest('%s/admin/realms/%s/users?username=' . urlencode($user['username']), [], 'get');
$newUser = $this->restApiRequest(
'%s/admin/realms/%s/users?username=' . $this->urlencodeEscapeForSprintf(urlencode($user['username'])),
[],
'get'
);
$users = json_decode($newUser->getStringBody(), true);
if (empty($users[0]['id'])) {
return false;
@ -527,4 +531,9 @@ class AuthKeycloakBehavior extends Behavior
}
return $changed;
}
private function urlencodeEscapeForSprintf(string $input): string
{
return str_replace('%', '%%', $input);
}
}