private function isSessionValid(SessionDataHolder $session, ServerRequestInterface $request):bool
    {
        // if the session is expired
        if (($lastReq = $session->getLastRequestTime())
            && ($lastReq + $this->getExpire() * 60) < time())
        {
            return false;
        }

        // if the client IP changed
        if ($this->getValidateClientIp()
            && ($clientIp = $session->getClientIp())
            && isset($request->getServerParams()['REMOTE_ADDR'])
            && $clientIp != $request->getServerParams()['REMOTE_ADDR'])
        {
            return false;
        }

        return true;
    }