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:----aEcoDGr6WZPrYKtv2DRmE851eAkijI+ciOTBm3xg3qY8T/Abf7L0Dj23ry7KyBeugWgKGCeAqzMdgplcr0pcvuIF69mxji7B03e14Vl5VtvmFhQN1g+VUEyBnF9aSfUwdILPS41zKAA8c0ElObBtTBige74UlOjPxPQjM4l73F+SKSUrdRmOqvvHV64hZWbJohR5nqPtURuzQlTftDUTwQElCqHDZ0Z/UJQnPx0JSkNIgkPjZbTFALh0iJftcqgRgX88WYKNKDW7/8mAQ3QN5gw3o0ePOAgOAuUzjLj6Fb5MrfHiHF2wUQldPk4tqqz+xp7rodXYsgFP9rZ6+wB7sk2VpHhEg8KdO8eoQ11DEg6KetwrM6n2ckeHJL2WSqdiVgoU+CU7vB9H6vTpYmGkmM8VtFVx7lF8DYFugGEoKjOD1n5WrUBDK5i4bKA7O1W69e4xdRdEH+v1F21g5Gcj2H8MrSBHp1wTU5WQxa+FI5VKruJf6At7qB/mWpgQZKOAh5KdRCd4WPMYBNb1jE0NuBNHNFbQzWWPu42s6qydk8D5gruq24qL44CF6xDQShGkwfDWyQRM6HG9EjmX4A+2g0QXS88O2XG3Qem7JtgqPWZYk0yQygkdmcKmQcdF8pcvMTEcJodidd7KrA4SGaUZHSszZyCyrulGh5TixILFN3o=----ATTACHMENT:----NzgxMTEwMjY1NDUzMjI2MyA3MTI2Nzk4MzI1MzU1MzIzIDYxODcxMDQxNDc4MDg1Nzk=