I have defined get Keycloak method on my Symfony project.
I am getting excepted results in the matter of array where I am extracting the list of password policies. Currently it's set just 'not username' rule:
I could not find any other endpoint within keycloak in a documentation where I can pass my password string as parameter and see if it's meeting the requirements defined in password policies
.
I will provide GET
function which is returning the thing I just described. I think it will do the work if it could be modified to provide password string.
public function validateKeycloakPassword()
{
$options = [
'headers' => $this->getAuthJsonHeaders()
];
try {
$endpoint = sprintf('auth/admin/realms/%s/', $this->realm);
return $this->request('GET', $endpoint, $options);
} catch (\Exception $e) {
$this->exception('Can`t get password policy information on Keycloak. ' . $e->getMessage());
}
}
and in my controller, endpoint:
/**
* @Route("/check", name="check")
*/
public function validatePassword()
{
$violations = $this->service->validateKeycloakPassword();
return $violations['passwordPolicy'];
}
To summerize:
Is there any endpoint in keycloak where I can pass my password variable and check if it meets requirements defined in password policies
Probably with PUT
method.