22 lines
554 B
PHP
22 lines
554 B
PHP
<?php
|
|
|
|
namespace App\Security;
|
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Security\Http\Event\LogoutEvent;
|
|
|
|
final class LogoutSubscriber implements EventSubscriberInterface
|
|
{
|
|
public static function getSubscribedEvents(): array
|
|
{
|
|
return [
|
|
LogoutEvent::class => 'onLogout',
|
|
];
|
|
}
|
|
|
|
public function onLogout(LogoutEvent $event): void
|
|
{
|
|
$event->setResponse(new Response(null, Response::HTTP_NO_CONTENT));
|
|
}
|
|
}
|