fix: [keycloak status] - handle gracefully if user not found in KC
- As reported by Matúš Mikuláš, Adam Gajdošík, Milan Pikula of SK-CERTdevelop-unstable
parent
a5eb016fc4
commit
13bb031167
|
@ -455,7 +455,17 @@ class AuthKeycloakBehavior extends Behavior
|
||||||
$user['meta_fields'] = $temp;
|
$user['meta_fields'] = $temp;
|
||||||
$differences = [];
|
$differences = [];
|
||||||
$keycloakUser = $keycloakUsersParsed[$username] ?? [];
|
$keycloakUser = $keycloakUsersParsed[$username] ?? [];
|
||||||
$requireUpdate = $this->checkKeycloakUserRequiresUpdate($keycloakUser, $user, $differences);
|
if (empty($keycloakUser)) {
|
||||||
|
$requireUpdate = true;
|
||||||
|
$differences = [
|
||||||
|
'user' => [
|
||||||
|
'keycloak' => 'USER NOT FOUND',
|
||||||
|
'cerebrate' => $user['username']
|
||||||
|
]
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$requireUpdate = $this->checkKeycloakUserRequiresUpdate($keycloakUser, $user, $differences);
|
||||||
|
}
|
||||||
$status[$user['id']] = [
|
$status[$user['id']] = [
|
||||||
'require_update' => $requireUpdate,
|
'require_update' => $requireUpdate,
|
||||||
'differences' => $differences,
|
'differences' => $differences,
|
||||||
|
|
Loading…
Reference in New Issue