atoti.ClientCertificate#

final class atoti.ClientCertificate#

A client certificate to connect() to a session configured with ClientCertificateConfig.

Example

>>> certificate_authority = certificates_directory / "root-CA.crt"
>>> session_config = tt.SessionConfig(
...     security=tt.SecurityConfig(
...         client_certificate=tt.ClientCertificateConfig(
...             trust_store=certificates_directory / "truststore.jks",
...             trust_store_password="changeit",
...         ),
...         https=tt.HttpsConfig(
...             certificate=certificates_directory / "localhost.p12",
...             certificate_authority=certificate_authority,
...             password="changeit",
...         ),
...     )
... )
>>> session = tt.Session.start(session_config)
>>> session.security.individual_roles["atoti"] = {"ROLE_USER"}
>>> # The session requires authentication:
>>> tt.Session.connect(session.url, certificate_authority=certificate_authority)
Traceback (most recent call last):
    ...
atoti._activeviam_client.activeviam_client._JsonResponseError: Unauthorized
>>> connected_session = tt.Session.connect(
...     session.url,
...     authentication=tt.ClientCertificate(
...         certificates_directory / "client.pem",
...         keyfile=certificates_directory / "client.key",
...     ),
...     certificate_authority=certificate_authority,
... )
certificate: Path#

Path to the .pem file containing the client certificate.

keyfile: Path | None = None#

Path to the certificate .key file.

password: str | None = None#

The certificate password.