diff --git a/src/Service/LDAPApi.php b/src/Service/LDAPApi.php index 4197f4ee0b68589a893c6fd86a02c42d05acea2d..a6148946bd4320658e6ae75863cc8a335a87c269 100644 --- a/src/Service/LDAPApi.php +++ b/src/Service/LDAPApi.php @@ -238,7 +238,7 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface return $persons; } - private function getPersonUserItem(string $identifier): ?User + private function getPersonUserItem(string $identifier): User { $preEvent = new PersonUserItemPreEvent($identifier); $this->dispatcher->dispatch($preEvent, PersonUserItemPreEvent::NAME); @@ -258,6 +258,8 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface throw new NotFoundHttpException(sprintf("Person with id '%s' could not be found!", $identifier)); } + assert($identifier === $user->getFirstAttribute($this->identifierAttributeName)); + /* @var User $user */ return $user; } catch (\Adldap\Auth\BindException $e) {