<?php
namespace App\Services\Security;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use App\Services\LogTools;
class SecurityTools
{
public function __construct(LogTools $logTools, TokenStorageInterface $tokenStorage)
{
$this->logTools = $logTools;
$this->tokenStorage = $tokenStorage;
}
// In futur version, this code is handled properly in Symfony security class
public function logout(SessionInterface $session)
{
// Invalidate the session
$session->invalidate();
// Clear the security token (logout the user)
$this->tokenStorage->setToken(null);
}
}