Exemplo n.º 1
0
 /**
  * Send Vary cookie
  *
  * @return void
  */
 public function sendVary()
 {
     $varyString = $this->context->getVaryString();
     if ($varyString) {
         $sensitiveCookMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata()->setPath('/');
         $this->cookieManager->setSensitiveCookie(self::COOKIE_VARY_STRING, $varyString, $sensitiveCookMetadata);
     } elseif ($this->request->get(self::COOKIE_VARY_STRING)) {
         $cookieMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata()->setPath('/');
         $this->cookieManager->deleteCookie(self::COOKIE_VARY_STRING, $cookieMetadata);
     }
 }
Exemplo n.º 2
0
 /**
  * Send Vary cookie
  *
  * @return void
  */
 public function sendVary()
 {
     $data = $this->context->getData();
     if (!empty($data)) {
         ksort($data);
         $cookieValue = sha1(serialize($data));
         $sensitiveCookMetadata = $this->cookieMetadataFactory->createSensitiveCookieMetadata()->setPath('/');
         $this->cookieManager->setSensitiveCookie(self::COOKIE_VARY_STRING, $cookieValue, $sensitiveCookMetadata);
     } else {
         $cookieMetadata = $this->cookieMetadataFactory->createCookieMetadata()->setPath('/');
         $this->cookieManager->deleteCookie(self::COOKIE_VARY_STRING, $cookieMetadata);
     }
 }
Exemplo n.º 3
0
 /**
  * Expire the session cookie
  *
  * Sends a session cookie with no value, and with an expiry in the past.
  *
  * @return void
  */
 public function expireSessionCookie()
 {
     if (!$this->sessionConfig->getUseCookies()) {
         return;
     }
     $metadata = $this->cookieMetadataFactory->createPublicCookieMetadata();
     $metadata->setPath($this->sessionConfig->getCookiePath());
     $metadata->setDomain($this->sessionConfig->getCookieDomain());
     $metadata->setSecure($this->sessionConfig->getCookieSecure());
     $metadata->setHttpOnly($this->sessionConfig->getCookieHttpOnly());
     $this->cookieManager->deleteCookie($this->getName(), $metadata);
     $this->clearSubDomainSessionCookie();
 }
Exemplo n.º 4
0
 /**
  * Remove persistent cookie
  *
  * @return $this
  * @api
  */
 public function removePersistentCookie()
 {
     $cookieMetadata = $this->_cookieMetadataFactory->createCookieMetadata()->setPath($this->sessionConfig->getCookiePath());
     $this->_cookieManager->deleteCookie(self::COOKIE_NAME, $cookieMetadata);
     return $this;
 }
Exemplo n.º 5
0
 /**
  * Delete store cookie.
  *
  * @return $this
  */
 public function deleteCookie()
 {
     $cookieMetadata = $this->_cookieMetadataFactory->createPublicCookieMetadata()->setPath($this->getStorePath());
     $this->_cookieManager->deleteCookie(self::COOKIE_NAME, $cookieMetadata);
     return $this;
 }
 /**
  * {@inheritdoc}
  */
 public function deleteStoreCookie(StoreInterface $store)
 {
     $cookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setPath($store->getStorePath());
     $this->cookieManager->deleteCookie(self::COOKIE_NAME, $cookieMetadata);
 }
Exemplo n.º 7
0
 /**
  * @return void
  */
 public function delete()
 {
     $this->cookieManager->deleteCookie(self::COOKIE_NAME, $this->cookieMetadataFactory->createCookieMetadata()->setPath($this->sessionManager->getCookiePath())->setDomain($this->sessionManager->getCookieDomain()));
 }
 /**
  * Delete debug cookie.
  *
  * @return $this
  */
 public function deleteDebugCookie()
 {
     $cookieMetadata = $this->_cookieMetadataFactory->createPublicCookieMetadata();
     $this->_cookieManager->deleteCookie(self::COOKIE_NAME, $cookieMetadata);
     return $this;
 }