/**
  * Performs authentication if cookie is present.
  *
  * @param GetResponseEvent $event
  *
  * @return bool|\ONGR\SettingsBundle\Security\Authentication\Token\SessionlessToken
  */
 private function authenticateCookie(GetResponseEvent $event)
 {
     $cookieData = $this->authCookie->getValue();
     if ($cookieData !== null) {
         if (!$this->authCookieService->validateCookie($cookieData)) {
             return false;
         }
         $token = new SessionlessToken($cookieData['username'], $cookieData['expiration'], $event->getRequest()->getClientIp(), $cookieData['signature']);
         try {
             $authenticatedToken = $this->authenticationProvider->authenticate($token);
         } catch (AuthenticationException $e) {
             return false;
         }
         return $authenticatedToken;
     }
     return false;
 }
 /**
  * Test supports method.
  */
 public function testSupports()
 {
     $this->assertFalse($this->provider->supports(new AnonymousToken('', '')));
     $this->assertTrue($this->provider->supports(new SessionlessToken('', 0, '', '')));
 }