/**
* Deletes given session.
*
* @param string $sessionId
*
* @return Values\DeletedUserSession
*
* @throws NotFoundException
*/
public function deleteSessionAction($sessionId, Request $request)
{
/** @var $session \Symfony\Component\HttpFoundation\Session\Session */
$session = $request->getSession();
if (!$session->isStarted() || $session->getId() != $sessionId || !$this->hasStoredCsrfToken()) {
$response = $this->authenticator->logout($request);
$response->setStatusCode(404);
return $response;
}
$this->checkCsrfToken($request);
return new Values\DeletedUserSession($this->authenticator->logout($request));
}