diff --git a/src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/Controller.php b/src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/Controller.php index 5fdf3efa5..35a6add70 100644 --- a/src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/Controller.php +++ b/src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/Controller.php @@ -44,8 +44,11 @@ public function __construct( */ protected function getIdentity(): Identity { - $user = $this->getUser(); - + $authenticatedIdentity = $this->getUser(); + // During authentication, an AuthenticatedIdentity is created, a decorated Identity. + // The app wants to work with the 'regular' Identity DTO from Middleware (client bundle) + // So we extract the entity here + $user = $authenticatedIdentity->getIdentity(); if (!$user instanceof Identity) { $actualType = get_debug_type($user); diff --git a/src/Surfnet/StepupSelfService/SelfServiceBundle/Security/Authentication/AuthenticatedIdentity.php b/src/Surfnet/StepupSelfService/SelfServiceBundle/Security/Authentication/AuthenticatedIdentity.php index 8e1243a45..59944ffdd 100644 --- a/src/Surfnet/StepupSelfService/SelfServiceBundle/Security/Authentication/AuthenticatedIdentity.php +++ b/src/Surfnet/StepupSelfService/SelfServiceBundle/Security/Authentication/AuthenticatedIdentity.php @@ -29,6 +29,11 @@ public function __construct(private readonly Identity $originalIdentity) { } + public function getIdentity(): Identity + { + return $this->originalIdentity; + } + public function getUsername(): string { return $this->originalIdentity->id ?: '';