Marklogic 如何在运行时通过http:put方法中的身份验证?

Marklogic 如何在运行时通过http:put方法中的身份验证?,marklogic,http-put,usernametoken,Marklogic,Http Put,Usernametoken,我使用调度任务运行下面的xqy代码,在这个xqy代码中,我在put调用中使用method=“digest”username=admin password=admin手动传递身份验证节点的值, 有什么方法可以让我在运行时使用传递它吗 1.用户名和密码的加密令牌 2.在运行时获取服务器的值username和password,并将其传递给http put函数以访问8000端口的rest服务扩展(/v1/resources/example) xquery version "1.0-ml&quo

我使用调度任务运行下面的xqy代码,在这个xqy代码中,我在put调用中使用method=“digest”username=admin password=admin手动传递身份验证节点的值, 有什么方法可以让我在运行时使用
传递它吗 1.用户名和密码的加密令牌
2.在运行时获取服务器的值username和password,并将其传递给http put函数以访问8000端口的rest服务扩展(/v1/resources/example)

xquery version "1.0-ml";
    
    declare namespace hst = 'http://marklogic.com/xdmp/status/host';   
    declare namespace c = 'http://example.com/abc';  
    declare variable $Collection := 'collection';
    
    let $query :=    
         cts:and-query((   
            cts:collection-query($Collection),  
            cts:element-range-query(xs:QName('c:element'), '<=', fn:current-dateTime())  
        ))
          
    let $uris := cts:uris('',(), $query)   
    let $total-uri := count($uris)  
    return   
        if ($total-uri) then  
        let $PORT := '8000'   
        let $database := xdmp:database()  
        let $host-list := xdmp:hosts()    
        let $hosts :=     
                for $hosts-online in $host-list      
                where xdmp:host-status($hosts-online)/hst:hosts/hst:host[.//hst:online/fn:string() = 'true']    
                return $hosts-online                        
        let $cluster-size := fn:count($hosts)     
        return
            for $host at $index in $hosts       
            let $page-size := fn:ceiling($total-uri div $cluster-size)       
            let $start-index := ($index - 1) * $page-size + 1       
            let $end-index :=       
                if ($cluster-size eq $index)  then      
                    $total-uri       
                else         
                    ($index - 1) * $page-size +$page-size        
            let $urisforHost := string-join($uris[$start-index to $end-index],',')        
    
            let $url  := fn:concat('http://',xdmp:host-name($host),':',$PORT,'/v1/resources/example?rs:uris=',$urisforHost,'&amp;rs:db=',$database)
            return
                xdmp:spawn-function(function()
                    {xdmp:http-put($url,
                        <options xmlns="xdmp:http">
                           <authentication method="digest">
                             <username>admin</username>
                             <password>admin</password>
                           </authentication>
                     </options>
                    )
                    }
                )
    
xquery版本“1.0-ml”;
声明命名空间hst=http://marklogic.com/xdmp/status/host';   
声明命名空间c=http://example.com/abc';  
声明变量$Collection:=“Collection”;
let$query:=
cts:和查询((
cts:集合查询($collection),

cts:element范围查询(xs:QName('c:element'),“这可以通过以下方式使用安全凭据实现

例如,然后在HTTP请求中引用凭据id

xdmp:http-get("http://ml-node-1:8002/manage",
  <options xmlns="xdmp:http">
    <credential-id>{xdmp:credential-id("my-credential-name)}</credential-id>
  </options>)
xdmp:httpget(“http://ml-node-1:8002/manage",
{xdmp:credential id(“我的凭证名称)}
)

要创建凭据,我们需要用户名和密码,但我们无法访问用户名和密码,因为它将在更高的环境中运行。是否有任何方法,我们可以动态获取端口8000的密码和用户名的详细信息,以便在http put中传递