antimatter.session_mixins.identity_provider_mixin
#
Module Contents#
Classes#
This override provides a local way to pass domain identity principal details |
|
Session mixin defining identity provider CRUD functionality. |
- class antimatter.session_mixins.identity_provider_mixin.OverrideDomainIdentityPrincipalDetails(*args, **kwargs)#
Bases:
antimatter_api.DomainIdentityPrincipalDetails
This override provides a local way to pass domain identity principal details to the openapi generated client that mitigates the pydantic serializing error it produces due to a bug in the generator.
The code that the generator currently produces looks like: .. code-block:: python
one_of_schemas: List[str] = Literal[“APIKeyDomainIdentityProviderDetails”, “GoogleOAuthDomainIdentityProviderDetails”]
that will produce the error:
/Users/daniel/.pyenv/versions/pycapsule-3.11/lib/python3.11/site-packages/pydantic/main.py:308: UserWarning: Pydantic serializer warnings: Expected `list[str]` but got `_LiteralGenericAlias` - serialized value may not be as expected return self.__pydantic_serializer__.to_python(
- one_of_schemas: List[str] = ['DomainIdentityAPIKeyPrincipalParams', 'DomainIdentityEmailPrincipalParams',...#
- class antimatter.session_mixins.identity_provider_mixin.IdentityProviderMixin(authz: antimatter.authz.Authorization, **kwargs)#
Bases:
antimatter.session_mixins.base.BaseMixin
Session mixin defining identity provider CRUD functionality.
- upsert_identity_provider(provider_name: str, provider_type: str | antimatter.constants.identity_provider.ProviderType = ProviderType.ApiKey, client_id: str | None = None) antimatter_api.DomainIdentityProviderInfo #
Create or update an identity provider.
- Parameters:
provider_name – The name of a new or existing identity provider
provider_type – The provider type for identity management
client_id – If the provider type is ‘GoogleOAuth’ or ‘MicrosoftOAuth’, a client ID must be provided
- Returns:
The identity provider summary
- insert_identity_provider_principal(provider_name: str, capabilities: List[str | Dict[str, Any]], principal_type: str | antimatter.constants.identity_provider.PrincipalType, principal_value: str | None = None, comment: str | None = None) antimatter_api.DomainInsertIdentityProviderPrincipal200Response #
Creates a new principal for the provider. Note that the provider_name must refer to an existing identity provider. The principal_value is optional if the type is APIKey.
- Parameters:
provider_name – The name of an existing identity provider
capabilities – The capabilities to attach to the principal. These can be in one of the following forms: - A list of unary capabilities, like [‘admin’, ‘read_only’] - A list of key-value pairs, like [“admin=True”, “read_only=False”] - A list of dictionaries, like [{“admin”: “True”}, {“read_only”: “False”}] - A list of dictionaries as a name/value pair, like [{“name”: “admin”, “value”: “True”}, {“name”: “read_only”, “value”: “False”}] - Any combination of the above
principal_type – The type of principal to create. One of ‘APIKey’, ‘Email’, or ‘HostedDomain’
principal_value – The appropriate identifying value for the principal, depending on type
comment – An optional comment for the identity provider principal
- Returns:
The ID of the inserted principal and any additional metadata
- update_identity_provider_principal(provider_name: str, principal_id: str, capabilities: List[str | Dict[str, Any]]) None #
Update the capabilities for an identity provider principal.
- Parameters:
provider_name – The name of an existing identity provider
principal_id – The ID of the principal
capabilities – The capabilities to attach to the principal. These can be in one of the following forms: - A list of unary capabilities, like [‘admin’, ‘read_only’] - A list of key-value pairs, like [“admin=True”, “read_only=False”] - A list of dictionaries, like [{“admin”: “True”}, {“read_only”: “False”}] - A list of dictionaries as a name/value pair, like [{“name”: “admin”, “value”: “True”}, {“name”: “read_only”, “value”: “False”}] - Any combination of the above
- get_identity_provider(provider_name: str) antimatter_api.DomainIdentityProviderInfo #
Retrieve detailed information and configuration of an identity provider
- Parameters:
provider_name – The name of an existing identity provider
- Returns:
The identity provider details
- list_identity_providers() List[antimatter_api.DomainIdentityProviderInfo] #
Retrieve the domain’s identity providers and a brief overview of their configuration.
- get_identity_provider_principal(provider_name: str, principal_id: str | None = None) List[antimatter_api.PrincipalSummary] | antimatter_api.PrincipalSummary #
Get either a summary of all the principals for an identity provider, or detailed information about a single principal if a principal_id is provided
- Parameters:
provider_name – The name of an existing identity provider
principal_id – The ID of the principal; None to get all principals
- Returns:
The principal information
- delete_identity_provider(provider_name: str) None #
Delete an identity provider. All domain tokens created using this identity provider will be invalidated. Take care not to remove the identity provider that is providing you admin access to your domain, as you may lock yourself out.
- Parameters:
provider_name – The name of the identity provider to fully delete
- delete_identity_provider_principal(provider_name: str, principal_id: str) None #
Delete an identity provider principal.
- Parameters:
provider_name – The name of the identity provider to delete a principal from
principal_id – The ID of the principal to delete