|
|
|
@@ -8,16 +8,22 @@ |
|
|
|
namespace App\EventListener; |
|
|
|
|
|
|
|
|
|
|
|
use ApiPlatform\Api\IriConverterInterface; |
|
|
|
use App\Entity\User; |
|
|
|
use Lexik\Bundle\JWTAuthenticationBundle\Event\AuthenticationSuccessEvent; |
|
|
|
use Symfony\Component\Security\Core\User\UserInterface; |
|
|
|
|
|
|
|
class AuthenticationSuccessListener |
|
|
|
{ |
|
|
|
public function __construct(private IriConverterInterface $iriConverter) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param AuthenticationSuccessEvent $event |
|
|
|
*/ |
|
|
|
public function onAuthenticationSuccessResponse(AuthenticationSuccessEvent $event): void |
|
|
|
public function onAuthenticationSuccessResponse( |
|
|
|
AuthenticationSuccessEvent $event |
|
|
|
): void |
|
|
|
{ |
|
|
|
$data = $event->getData(); |
|
|
|
$user = $event->getUser(); |
|
|
|
@@ -26,6 +32,7 @@ class AuthenticationSuccessListener |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
$data['id'] = $this->iriConverter->getIriFromResource($user); |
|
|
|
$data['email'] = $user->getEmail(); |
|
|
|
$data['firstName'] = $user->getFirstName(); |
|
|
|
$data['lastName'] = $user->getLastName(); |
|
|
|
|