fix: [keycloak] fixed encoding issue with urlencoded usernames created in keycloak
parent
d96353ee4f
commit
1077251f8b
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue