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:----S/fibQ9CyDaEWpXrVuxMmPZjwE5hkLTD/SyKNkXUTlo1AqXtxMarxniVwAtBu5C00S12tP7cRy4ZYqTwGIwDjLb74429MHyFqi/1BGt3DonqVihD5ERo9WKF0ElnS3p+jYgESCW8oA7MU9IG5I7VeJvIsN99Unn+8YzSgBb9zdacK6JYf6s2rTWdOBeowKDyRdeB1FP68sT3/oUYz+KIiF0lJTWOI+2uT2tLPfuZAqDKGCiXBKaPmmIbUZRkQbzxYeeTO0dSmhTCmuENZNZQy+yk1yr7xsf58v0FejfP0zA2+hQD3v4XTjf0LkFhOo4P84wWrG/VgFQuo3OHOEcCkyqlA3TwhAjeAV9/UuE/FTWY5mhm2SXI1xIlN/Y3GmXcElhsxzwRKJdUKBPFnb4qrsslgAP+1M8sbBNXh2ekSKRre6tjl0xXzKUJpEBnHLQRxlq+xLcuhhF67NvrJesqEkPkg6IeRxMtjRug76vyK26tXAUlN9BC8Gdlk+kuzVBSFV+txLwMwhDwRBqK6vWtVfNPfx2s89d2of+8ogX29EWt7SrbuIjOLpXzBTC3oL5he6Sl5zQ7f+sZ0qARoLHNM2/gryXOaZ/H4qTO8Wr+oxRmQxQV0KeEAhw4R9XZPOx72McHjrj5SicTYiQFZK/W0UjwsM1CYN5KM3yQvvf3Rgo=----ATTACHMENT:----MTgwNDUwNTY1Njg5MjQzOCAxNDg5MjM5NTUxMTQ2NDMwIDg5ODY4MDAwNjI4MjI3NDI=