/** * {@inheritdoc} */ public function handle(GetResponseEvent $event) { $cookieData = $this->cookie->getValue(); if (!$this->authCookieService->validateCookie($cookieData)) { $this->tokenStorage->setToken(null); return false; } $token = new SessionlessToken($cookieData['username'], $cookieData['expiration'], $event->getRequest()->getClientIp(), $cookieData['signature']); try { $regeneratedToken = $this->authenticationManager->authenticate($token); $this->tokenStorage->setToken($regeneratedToken); } catch (AuthenticationException $e) { $this->cookie->setClear(true); $this->tokenStorage->setToken(null); return false; } return $regeneratedToken; }