Writes the session cookie to the Response.

@param \Brick\Http\Response $response

@return void
346708
public function handleResponse(Response $response) : void
    {
        if ($this->id === null) {
            // The request was not associated with an existing session, and no session writes occurred.
            // Sending a session cookie is unnecessary.
            return;
        }

        // Note: we re-send the session cookie even if it was part of the request, to refresh the expiration time.

        $this->writeSessionId($response);
        $this->reset();
    }
843939
public function format($response)
    {
        if (stripos($this->contentType, 'charset') === false) {
            $this->contentType .= '; charset=' . $response->encoding;
        }
        $response->setHeader('Content-Type', $this->contentType);
        if ($response->data !== null) {
            $response->content = $response->data;
        }
    }
1323045
protected function writeSession(Response $response)
    {
        $this->session->ageFlashData();
        $this->sessionHandler->write($this->session->getId(), serialize($this->session->getAll()));
        $this->writeToResponse($response);
    }
630712
public function setSession($session)
    {
        if (is_object($session)) {
            $this->session = $session;
        } elseif (is_string($session) || is_array($session)) {
            $this->session = new Session($session);
        }
    }
1196453
public function record(Request $request, Response $response)
    {
        if ($this->hasResponse($request)) {
            return;
        }

        $recording = array(
            'request'  => $request->toArray(),
            'response' => $response->toArray()
        );

        $this->storage->storeRecording($recording);
    }
697066
public function send(Response $response = null)
    {
        if ($response) {
            $this->response = $response;
        }
        $this->response->prepare($this->request);
        $this->response->send();

        // If a cacheWrite callback exists execute
        // it now to write the image to the cache
        if (is_callable($this->cacheWrite)) {
            call_user_func_array(
                $this->cacheWrite,
                array($this->cache, $this->getCachePath())
            );
        }
    }
67666
public function parseResponse($response)
    {
        // Parse the response and set the last response and headers.
        $info = curl_getinfo($this->ch);
        $this->__last_response_headers = substr(
            $response,
            0,
            $info['header_size']
        );
        $this->__last_response = substr($response, $info['header_size']);
    }
1159223
protected function addCookieToResponse($request, $response)
    {
        $config = config('session');

        $response->headers->setCookie(
            new Cookie(
                'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']),
                $config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null
            )
        );

        return $response;
    }
820865
public function deleteCookie(Cookie $cookie)
    {
        $cookie->setValue('');
        $cookie->setMaxAge(-1);
        $this->cookies[$cookie->getName()] = $cookie;
    }
916898
public function response() {
        if (count($this->_header)) {
            foreach ($this->_header as $header) {
                header(...$header);
            }
        }

        if (count($this->_cookie)) {
            foreach ($this->_cookie as $cookie) {
                setcookie(...$cookie);
            }
        }

        echo $this->_body;
    }
1022270
private function storeCachedResponse(Response $response, $method, $url, array $data, array $headers, $minutes)
    {
        if ($this->cache and $minutes > 0)
        {
            $this->cache->storeResponse($response, $method, $url, $data, $headers, $this->basicAuthCredentials, $minutes);
        }
    }
214571
public function format($response)
	{
		$response->getHeaders()->set('Content-Type', 'application/pdf');
		$response->content = $this->formatPdf($response);
	}
512901
public function validateLogoutResponse(LogoutResponse $response)
    {
        $this->validateIssuer($response);

        if ($this->hasSignature($response)) {
            $this->validateSignature(
                $response,
                KeyHelper::createPublicKey(
                    $this->getMetadata()->getFirstIdpSsoDescriptor()
                        ->getFirstKeyDescriptor(KeyDescriptor::USE_SIGNING)
                        ->getCertificate()
                )
            );
        }
    }
479386
protected function addCookieToResponse( Response $response, SessionInterface $session )
	{
		if ( $this->usingHandler( CookieSessionHandler::class ) )
			$this->driver()->save();

		if ( $this->sessionIsPersistent() )
			$response->headers->setCookie( new Cookie( $session->getName(), $session->getId(), $this->getCookieExpirationDate(), Config::get( $this->configPrefix . '.path' ), Config::get( $this->configPrefix . '.domain' ), Config::get( $this->configPrefix . '.secure', false ), Config::get( $this->configPrefix . '.http_only', true ) ) );
	}
218388
private function sendResponse($response)
    {
        if ($response instanceof ResponseInterface) {
            $response->sendContent();
        } else {
            echo $this->response->send($response);
        }
    }
636390
protected function setCookieInResponse(Cookie $cookie)
    {
        $method = $cookie->isRaw() ? 'rawcookie' : 'cookie';

        $this->response->$method(
            $cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(),
            $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()
        );
    }
999029
protected function addCookieToResponse( $request, $response )
	{
		$config = Config::get( 'session' );
		$response->headers->setCookie( new Cookie( 'XSRF-TOKEN', $request->session()->token(), time() + 60 * 120, $config['path'], $config['domain'], $config['secure'], false ) );

		return $response;
	}