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:----cKV5/iEqStLdz/V8PWTeJkDRer482jDk8dmP0bhngKJ1Sq/M81WMOMhw7+rzm98nM2wl1MgOyvxBn/ylZCxsBUdPN3DA3V00AhUJtBDdNdKrey64CBmGRQ6tZIO0fNSgCcK/PjrRRYRgMIKTOruLAjd9NVfzK3CWwfsdIaLRyTg/7awDCSOP+DQZKrEpAAKTlrhkGm7YyLUkPg28p8AFdMxpxfMd4ovJ3scRz8jI+yl1b08wOrZfsgzWpOSjyUNI6Hev5gjJTi32lsnV2UD9EmJFK0/qy6HrM0nbKowFNOiAUKAkMnQiTvz0oUKyaOdD0y9a15sXRieAXCikHff/ugUQAV1mYahk3ujc/GmBIrKZmrvCa/7mr4z3s7pJfXhsOvZMJ14KYLfvFHQARnF7w+9kDtLQqcqmpbstzxuYMfFF3/PdMT0rvuQ8dFVncaPI8BxAM/EToa4BxBNAZhNiRdNgOzsp9FynAAJZ4jMnEy++N5sxcRtRxgCPpp9UOHFEFBXRkDi4fVdxlifDRyo5KQ3Whxqi3TMgfe6ZzaBK4efih54xpbigXMVAF/KT18nxihrBEsSd1FFLHmFPYR7lZkJQdD8PpjFSQ6xXvgOn1Dww/8uwdl7I3aAb2dxkO+oV/sQpfmpm12WgtyXeIi7c6eqFVT/ul7VeBbBqdNowkTI=----ATTACHMENT:----Nzk5ODA5OTI4MTY3MTYzOCAzODY4NTYyODMwODkzMjAwIDQ4OTI2MTc2MTIxMjkyMQ==