Credential Providers Package
Default Module
Function which gives us the default credentials handler for use by CBCloudAPI.
- class DefaultProvider
Bases:
object
Intermediate class defined to allow insertion of a “test point” into default_credential_provider().
- get_default_provider(credential_file)
Return the default credential provider that CBCloudAPI should use.
- Parameters:
credential_file (str) – Credential file as specified to the initialization of the API.
- Returns:
The default credential provider that CBCloudAPI should use.
- Return type:
- default_credential_provider(credential_file)
Return the default credential provider that CBCloudAPI should use.
- Parameters:
credential_file (str) – Credential file as specified to the initialization of the API.
- Returns:
The default credential provider that CBCloudAPI should use.
- Return type:
AWS SM Credential Provider Module
Credentials provider that reads the credentials from the AWS Secrets Manager
- class AWSCredentialProvider(secret_arn, region_name='us-east-2', profile_name=None)
Bases:
CredentialProvider
This credential provider reads from the AWS Secrets Manager
Initialize the AWSCredentialProvider.
- Parameters:
secret_arn (str) – The name of the secret in the AWS Secrets Manager.
region_name (str) – The region name
profile_name (str) – The credentials profile
- get_credentials(section=None)
Return a Credentials object containing the configured credentials.
- Parameters:
section (None) – Since AWS deosn’t support sections it is left
CredentialProvider (to satisfy the Signature of) –
- Returns:
The credentials retrieved from that source.
- Return type:
Environ Credential Provider Module
Credentials provider that reads the credentials from the environment.
- class EnvironCredentialProvider
Bases:
CredentialProvider
The object which provides credentials based on variables in the environment.
Initializes the EnvironCredentialProvider.
- get_credentials(section=None)
Return a Credentials object containing the configured credentials.
- Parameters:
section (str) – The credential section to retrieve (not used in this provider).
- Returns:
The credentials retrieved from that source.
- Return type:
- Raises:
CredentialError – If there is any error retrieving the credentials.
File Credential Provider Module
Credentials provider that reads the credentials from a file.
- class FileCredentialProvider(credential_file=None)
Bases:
CredentialProvider
The object which provides credentials based on a credential file.
Initialize the FileCredentialProvider.
- Parameters:
credential_file (object) – A string or path-like object representing the credentials file, or a list of strings or path-like objects representing the search path for the credentials file.
- get_credentials(section=None)
Return a Credentials object containing the configured credentials.
- Parameters:
section (str) – The credential section to retrieve.
- Returns:
The credentials retrieved from that source.
- Return type:
- Raises:
CredentialError – If there is any error retrieving the credentials.
Keychain Credential Provider Module
Credentials provider that reads the credentials from the macOS’s keychain.
- class KeychainCredentialProvider(keychain_name, keychain_username)
Bases:
CredentialProvider
This credential provider reads from the macOS’s Keychain.
Initialize the KeychainCredentialProvider.
- Parameters:
keychain_name (str) – The name of the entry in the Keychain.
keychain_username (str) – The username which you’ve set in the Keychain.
- Raises:
CredentialError – If we attempt to instantiate this provider on a non-macOS system.
- get_credentials(section=None)
Return a Credentials object containing the configured credentials.
- Parameters:
section (None) – Since Keychain doesn’t support sections it is left
CredentialProvider (to satisfy the Signature of) –
- Returns:
The credentials retrieved from that source.
- Return type:
- Raises:
CredentialError – If there is any error retrieving the credentials.
Registry Credential Provider Module
Credentials provider that reads the credentials from the environment.
- OpenKey(base, path)
Stub to maintain source compatibility
- QueryValueEx(key, name)
Stub to maintain source compatibility
- class RegistryCredentialProvider(keypath=None, userkey=True)
Bases:
CredentialProvider
The credentials provider that reads from the Windows Registry.
Initialize the RegistryCredentialProvider.
- Parameters:
keypath (str) – Path from the selected base key to the key that will contain individual sections.
userkey (bool) – True if the keypath starts at HKEY_CURRENT_USER, False if at HKEY_LOCAL_MACHINE.
- Raises:
CredentialError – If we attempt to instantiate this provider on a non-Windows system.
- get_credentials(section=None)
Return a Credentials object containing the configured credentials.
- Parameters:
section (str) – The credential section to retrieve.
- Returns:
The credentials retrieved from that source.
- Return type:
- Raises:
CredentialError – If there is any error retrieving the credentials.