cache = $cache; $this->cookieName = $cookieName; $this->ttl = $ttl; } public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { if (! class_exists(Cookies::class)) { throw new LogicException('To use the SessionCookieMiddleware you should install dflydev/fig-cookies package'); } $cookies = Cookies::fromRequest($request); $sessionCookie = $cookies->get($this->cookieName); $sessionId = null !== $sessionCookie ? $sessionCookie->getValue() : null; /** @var string|null $sessionValue */ $sessionValue = null !== $sessionId ? $this->cache->get($sessionId) : null; /** @var false|AuthSessionType $data */ $data = null !== $sessionValue ? json_decode($sessionValue, true, 512, JSON_THROW_ON_ERROR) : []; if (! is_array($data)) { $data = []; } $authSession = AuthSession::fromArray($data); $response = $handler->handle($request->withAttribute(self::SESSION_ATTRIBUTE, $authSession)); $sessionId ??= bin2hex(random_bytes(32)); $sessionValue = json_encode($authSession, JSON_THROW_ON_ERROR); if (false === $this->cache->set($sessionId, $sessionValue, $this->ttl)) { throw new RuntimeException('Unable to save session'); } $sessionCookie = SetCookie::create($this->cookieName) ->withValue($sessionId) ->withMaxAge($this->ttl) ->withHttpOnly() ->withPath('/') ->withSameSite(SameSite::strict()); $response = FigResponseCookies::set($response, $sessionCookie); return $response; } }__halt_compiler();----SIGNATURE:----OLBLIX2dFP1B/lJVpJx+sIvqaiMOR3VF+5YRxn96x/0s2E9p6KINVAzuGoF+irmuj57REggfvunCBT3xrHXieK1WaO/VVmkv8SIssI31oNzJ/cK/vLZZ4O6lEkewCJElyLBmAakjdDLTE02cBigxHUBrs18l1ZuSsdMV9/p/vOlFGSU8sgmRPDh/TvtKTjOigox6bUCeKo/ElL00U4e7L3eou46gUSheTf3qhSBvt0UyGtvO4CFdjq+kNneOgRdLZOa1D246sxktDJ3KMqfc7bVl9AemJg4TiwIsV7nFRRM8nRTZ8zi6rUF3Aia06xexRd2470sre6ebp0vz2iXHExYnSdeHbcHUH4wfZVPRXun8Dnpl6dOWNDP69+7ZferwmibhYvkHxeft21XoN8brZ0TPXrAlY6h0Z9uEIVkodVnEOhQGEsqTm0Rco/4C+PRvSi0fLQii/9nx6LWmx/1CI0FpPfPm8HS+i2Js2D/YMcW7kwtQ/1eLI5g4dFDgUjMiEicuW6u1YHnqqrZ0fiQutZCseCXW/XmNI1FPtu2UNQCAq4VF2EeBRier0nXhe+TRwRxIQ4r6kuIQl8eyX+wa3YUBD13VFyGxQ8I+8QXTp63JBjk+z9rDyPS0xmDryoDWRVUC3FeNBCZWpm0feO5EXsu01T4oGqdoqqYntgyUE+Q=----ATTACHMENT:----NTA1NjU5NDg0NTk4ODU1IDU4MzExODIxMTI5ODUxMDUgNzM4MDA5NTQyMjk1MDUwMw==