Credential

Note

Refer to Authentication for ways to authenticate to the TPP WebSDK.

Credential Types

Refer to Credentials for the available credential feature types. Please note that, though the available feature type may not be listed, it doesn not mean that it cannot be used with the API layer, which is a pure interface with the TPP WebSDK API.

Creating & Deleting A Credential

from pytpp import Authenticate, Features

api = Authenticate(...)
features = Features(api)

#### CREATE ####
credential = features.credential.username_password.create(
    name='Awesome Credential',
    parent_folder=r'\VED\Policy\Administration\Credentials',
    username=r'AD+AwesomeAD:user123',
    password=r'SomePasword123!!!'
)

#### DELETE ####
features.credential.username_password.delete(credential=credential)

Creating A Google Credential

{
    "type"                       : "service_account",
    "project_id"                 : "********",
    "private_key_id"             : "********",
    "private_key"                : "-----BEGIN PRIVATE KEY-----\n********-----END PRIVATE KEY-----\n",
    "client_email"               : "service@********.iam.gserviceaccount.com",
    "client_id"                  : "********",
    "auth_uri"                   : "https://accounts.google.com/o/oauth2/auth",
    "token_uri"                  : "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url"       : "https://www.googleapis.com/robot/v1/metadata/x509/********.iam.gserviceaccount.com"
}
from pytpp import Authenticate, Features

api = Authenticate(...)
features = Features(api)

with open('google_credential.json', 'r') as f:
    json_content = f.read()

credential = features.credential.google.create(
    name='Awesome Credential',
    parent_folder=r'\VED\Policy\Administration\Credentials',
    description='Google credential description.',
    contacts=['local:AwesomeUser', 'AD+AwesomeAD:user123'],
    json_content=json_content
)