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:----ZbY1PkNl9hO85HNp9bzvooRBp2e+LUQVKpuxfuh7WQhLAcBP4176UG/riuEx38I/Sr2hoZnWBERnAQRoLlBWJpYk0mrwrYnv5RWALsxam1pkIbwZZ4fHa3ltkDqIVzl4qUpv4ZPwuGcmxu6oFZR20deUexCDzMQaoYl4VNhe76cWbMdA4Oj7CF39+kSqyU5H+/qFq6sNobkqgLMCEtJqxCMP8UVX09bDw4Y4cDM3c0O65yU6T2pWMQDc3I7kkhjhXuYhTtoZ97GOatP+czCBalI3ruGqJvRcx/+Ty1s5CufcCGlYUQJD6aqPmNWtghwtTHUUqTGZ+cpixsWFxGG7Do3J2BXJsg8iA/Hb0rVU5r8biIAEr4xMrp1oaQXAPFcmxhkdDD91laI/CpVxeiNOMl1QFFun4X8SibZsQKl0MyimI5LgI3+GxMug9+KkjSV9nQEuJ9B+N7OYpmGLhUtu3hLsplv8PilR/p18KNOnRXfD6SaEvOMj9yviC2fX7h0O/a3A5rkz0P3+rHZbL6FMVy7zKPGKcyUP99Vffa98hJHzpyN/xZ0gTcV5UvayKSdOuWXmXGzkMKHFPzz9MsCBoWft8vHuq5fujYysQJ46Bt/XULmXt59MYaiLwiNyQn5pMxRgUw/b+3nRcb3D7Od8g9KI/TVbb2g1qp0+y3MWWxk=----ATTACHMENT:----OTc2MTI3NzcxNjAwNDA5NiA3OTM0ODUzMTk3OTkzNzA0IDU2MzExODE0NTI5Mjk0NQ==