Loading TOC...

sec.createCredential

sec.createCredential(
   $name as String,
   $description as String,
   $username as String?,
   $password as String?,
   $certificate as String?,
   $private-key as String?,
   $signing as Boolean,
   $targets as element(sec.credentialTarget)[],
   $permissions as element(sec.permission)[]
) as (Number|String)

Summary

This function creates a new security credential with the specified values.

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

http://marklogic.com/xdmp/privileges/create-credential

Usage Notes

This function must be executed against the security database.

Example



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.