public function buildCookieToHeaderMiddleware(
        $cookieName = 'XSRF-TOKEN',
        $headerName = 'X-XSRF-TOKEN',
        callable $rejectMiddleware = null,
        callable $cookieModifier = null
    ) {
        return (new $this->middlewareClass($this->tokenService))
            ->withGuard($rejectMiddleware)
            ->withAcceptHeaderToken($headerName)
            ->withAcceptMethods(['GET', 'OPTIONS'])
            ->withRespondWithCookieToken($cookieName, $cookieModifier);
    }