StandardCredentialsProvider - Scoped, Global
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- API reference
The StandardCredentialsProvider API provides methods to retrieve credential information.
You can use this API in scoped applications or within the global scope. In scoped scripts,
use the sn_cc
namespace identifier.
This API provides methods to retrieve credential information by sys_id and by specified credential attributes.
StandardCredentialsProvider - StandardCredentialsProvider()
Instantiates a credentials provider object.
Name | Type | Description |
---|---|---|
None |
Example
StandardCredentialsProvider - getCredentials(String types, String tags)
Returns an array of all credentials that match the specified types and tags.
Name | Type | Description |
---|---|---|
tags | String | Optional. Comma-separated list of tag names. For example, "ssh,
jdbc". Examples of valid calls:
|
types | Array | Optional. Credential type names. For example, ["ssh", "windows"] Note: If
types is null or empty, any match returns a credential. If
types is specified, the credentials whose type matches one
of the types is returned. |
Type | Description |
---|---|
StandardCredential | Credential record object. |
Example
This code example shows how to get the provider credentials for "ssh" credential types.
Example
This code example shows how to get the provider credentials for "ssh" and "windows" credential types that have tags of "admin".
StandardCredentialsProvider - getCredentialByAliasID(String sys_id)
Returns the credential record object through its credential alias (sys_alias).
This method is specifically for use with credential types. For information, see Credential aliases for Discovery.
Name | Type | Description |
---|---|---|
sys_id | String | Sys_id of the credential alias record in the Connection & Credential Aliases [sys_alias] table. |
Type | Description |
---|---|
StandardCredential | Credential record object. |
Example
The following example retrieves a credential using the alias ID and displays the user name.
Output for a credential record with a user name:
StandardCredentialsProvider - getCredentialByID(String sys_id)
Returns the credential record object identified by the specified sys_id.
Name | Type | Description |
---|---|---|
sys_id | String | Sys_id of the credential record. Table: Credentials [discovery_credentials] |
Type | Description |
---|---|
StandardCredential | Credential record object. |
Example
The following example retrieves a credential and displays the user name.
Output for a credential record with a user name: