Loading TOC...


   $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.

name A name for this credential.
description A description for this credential.
username An optional username for this credential.
password An optional password for this credential.
certificate An optional PEM encoded certificate for this credential.
private-key An optional PEM encoded private key for this credential.
signing Whether this credential may be used for signing certificates.
targets Any targets that this credential may be used to access.
permissions Permissions for who can access this credential. Read allows viewing of the credential, including encrypted keys. Execute only allows use of the credential. Read implies execute.

Required Privileges


Usage Notes

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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.