
sec:create-credential( $name as xs:string, $description as xs:string, $username as xs:string?, $password as xs:string?, $certificate as xs:string?, $private-key as xs:string?, $signing as xs:boolean, $targets as element(sec:credential-target)*, $permissions as element(sec:permission)* ) as xs:unsignedLong
This function creates a new security credential with the specified values.
http://marklogic.com/xdmp/privileges/create-credential
  This function must be executed against the security database.
xquery version "1.0-ml"; 
 
import module namespace sec = "http://marklogic.com/xdmp/security" 
      at "/MarkLogic/security.xqy";
 
sec:create-credential("my-secure-credential", "a secure credential", 
   "secure-user", "secure-password", (), (), fn:false(), (), 
   xdmp:permission("secure-role", "execute"))
    
  
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.