atoti.ClientCertificate#

final class atoti.ClientCertificate#

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

Example

>>> certificate_authority = directory / "root-CA.crt"
>>> session_config = tt.SessionConfig(
...     security=tt.SecurityConfig(
...         client_certificate=tt.ClientCertificateConfig(
...             trust_store=directory / "truststore.jks",
...             trust_store_password="changeit",
...         ),
...         https=tt.HttpsConfig(
...             certificate=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(
...         directory / "client.pem",
...         keyfile=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.