<?php
namespace Platform\SecurityBundle\Listeners;
use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTCreatedEvent;
use Platform\SecurityBundle\Entity\Identity\Account;
use LogicException;
class JWTCreatedListener
{
/**
* @param JWTCreatedEvent $event
*
* @return void
*/
public function onJWTCreated(JWTCreatedEvent $event): void
{
$user = $event->getUser();
if ( ! $user instanceof Account) {
throw new LogicException();
}
$event->setData(['uid' => $user->getUid()]);
}
}