Credential Providers¶
Submodules¶
cbc_sdk.credential_providers.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: CredentialProvider
-
-
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: CredentialProvider
cbc_sdk.credential_providers.environ_credential_provider module¶
Credentials provider that reads the credentials from the environment.
-
class
EnvironCredentialProvider
¶ Bases:
cbc_sdk.credentials.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: Credentials Raises: CredentialError
– If there is any error retrieving the credentials.
-
cbc_sdk.credential_providers.file_credential_provider module¶
Credentials provider that reads the credentials from a file.
-
class
FileCredentialProvider
(credential_file=None)¶ Bases:
cbc_sdk.credentials.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: Credentials Raises: CredentialError
– If there is any error retrieving the credentials.
-
cbc_sdk.credential_providers.keychain_credential_provider module¶
Credentials provider that reads the credentials from the macOS’s keychain.
-
class
KeychainCredentialProvider
(keychain_name, keychain_username)¶ Bases:
cbc_sdk.credentials.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
- satisfy the Signature of CredentialProvider (to) –
Returns: The credentials retrieved from that source.
Return type: Raises: CredentialError
– If there is any error retrieving the credentials.
cbc_sdk.credential_providers.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:
cbc_sdk.credentials.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: Credentials Raises: CredentialError
– If there is any error retrieving the credentials.