/** * Add the session cookie to the application response. * * @param \Symfony\Component\HttpFoundation\Response $response * @param \Illuminate\Session\SessionInterface $session * @return void */ protected function addCookieToResponse(Response $response, SessionInterface $session) { if ($this->usingCookieSessions()) { $this->manager->driver()->save(); } if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { $response->headers->setCookie(new Cookie($session->getName(), $session->getId(), $this->getCookieExpirationDate(), $config['path'], $config['domain'], array_get($config, 'secure', false))); } }
/** * {@inheritdoc} */ protected function addIdentifierToResponse(Response $response, SessionInterface $session) { if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) { $response->headers->set("X-Session-Token", $session->getId()); } }