Introduced in Syntasa 6.3, the credentials store enables you to create, save, and share credentials as an object so that other users can use them without the details being revealed. This sample demonstrates how to create and utilize credentials within a notebook.
from syn_utils import synutils
Create Credential
- Ability to create credentials in vault for specific user.
- By default login user has **create** permissions within his/her user space .
synutils.credentials.create("test_credentials", {
"test-key": "test-value",
"test-key-1": "test-value-1"
})
Update Multiple Key-Value in Credentials Object
- Ability to update multiple key-value in a Credentials Object
- By default, the logged-in user has 'update' permissions for all credential objects created by him
response = synutils.credentials.update("test_credentials", {
"test-key": "test-value10001"
})
Update Single Key-Value in Credentials Object
- Ability to update a Single key value in the credentials object
- The credential object must belong to the login user
synutils.credentials.update(credential_store_name="test_credentials", key="test-key10000", value="test-value10002")
List Credentials
- List credentials for the login user.
- By default, the logged-in user has read permissions on all credential objects created by him.
synutils.credentials.list()
Read Credentials
- Ability to read the value from the given key from the credentials object
synutils.credentials.read("test_credentials", "test-key-1")
Share credentials with other users
- Ability to share credentials with other users
synutils.credentials.share("syntasaadmin", permissions=['read'], credential_name="test_credentials")
Revoke permission for other users
- Ability to remove permission for other users
synutils.credentials.revoke("syntasaadmin", permissions=['read'], credential_name="test_credentials")
The best way to understand and learn how to perform this function is through hands-on experience. Follow the steps below to create the sample notebook in your Syntasa environment:
- Download the sample notebook .ipynb file from this article.
- Create a new notebook in your Syntasa environment using the import notebook option.