/** * Determine if a session driver has been configured. * * @return bool */ private function isSessionConfigured() : bool { return $this->manager->getConfig()->get('session::driver', null) !== null; }
/** * Add the CSRF token to the response cookies. * * @param \Psr\Http\Message\ResponseInterface $response * * @return \Psr\Http\Message\ResponseInterface */ protected function addCookieToResponse(ResponseInterface $response) : ResponseInterface { $config = $this->manager->getConfig(); $setCookie = new Cookie('XSRF-TOKEN', $this->tokenService->generate(), $config->get('session::csrf.livetime', Chronos::now()->getTimestamp() + 60 * 120), $config->get('path'), $config->get('domain'), $config->get('secure', false), false, $config->get('session::csrf.samesite', false)); return $response->withAddedHeader('Set-Cookie', (string) $setCookie); }