public static function getSession(ServerRequestInterface $request):SessionDataHolder
    {
        $session = $request->getAttribute(static::REQ_ATTR);
        if (!$session instanceof SessionDataHolder) {
            throw new SessionMiddlewareException(
                "No session object is available in the request attributes"
            );
        }
        return $session;
    }