antimatter.utils
#
Subpackages#
Submodules#
Package Contents#
Classes#
This is a wrapper around the real client which checks for the security scope of the client |
Functions#
|
Get the base client for the API. |
|
Authenticate a domain with the given domain_id and domain_authenticate object. |
|
Decode a domain identity token and return the NotValidBefore and NotValidAfter timestamps. |
|
Check if the token is valid based on the NotValidBefore and NotValidAfter timestamps. |
Attributes#
- class antimatter.utils.ClientWrapper(real_client: antimatter_api.ApiClient, supported_auth_type: str = None)#
This is a wrapper around the real client which checks for the security scope of the client It is checking the auth_settings in the kwargs of the param_serialize method and verifying the permissions of the client. If the permissions are not valid, it will raise a PermissionError.
- antimatter.utils.get_base_client(enable_retries: bool = True) antimatter_api.ApiClient #
Get the base client for the API.
- Parameters:
enable_retries – If True, retry gateway, DNS, and general connection errors
- antimatter.utils.authenticate(client: antimatter_api.ApiClient, domain_authenticate: antimatter_api.DomainAuthenticate, domain_id: str, identity_provider_name: str = None, token_lifetime: int | None = None) str #
Authenticate a domain with the given domain_id and domain_authenticate object. This function will return the token for the authenticated domain. It will try to catch a few specific exceptions and raise a SessionError with a more user-friendly message.
- Parameters:
client – The client to use for the request.
domain_authenticate – The domain authenticate object to use for the request.
domain_id – The domain ID to authenticate.
identity_provider_name – The identity provider name to authenticate with.
token_lifetime – How long the token should last for, in seconds.
- Returns:
The token for the authenticated domain.
- antimatter.utils.decode_token(t)#
Decode a domain identity token and return the NotValidBefore and NotValidAfter timestamps.
- antimatter.utils.is_token_valid(not_before, not_after)#
Check if the token is valid based on the NotValidBefore and NotValidAfter timestamps.
- antimatter.utils.API_TARGET_VERSION = 'v2'#
- antimatter.utils.ADMIN_VERIFICATION_PROMPT = 'domain not authenticated - check email to verify account; verification email can be sent again...'#