/**
  * Test loaded value into FlashBagCookie.
  */
 public function testLoadValue()
 {
     $messages = ['message 1', 'message 2'];
     $cookie = new JsonCookie('test');
     $cookie->load(json_encode($messages));
     $this->assertEquals($messages, $cookie->getValue());
 }
 /**
  * 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;
 }