Skip to content

cmem_client.repositories.client_accounts¤

Repository for the Keycloak OpenID Connect client accounts of a deployment.

Provides ClientAccountRepository for listing the client accounts (service accounts) which can authenticate against Corporate Memory, and for reading or rotating their secret.

Examples:

List the client accounts and inspect one:

>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> list(client.client_accounts)
>>> account = client.client_accounts["cmem-service-account"]

Read the current secret of an account:

>>> client.client_accounts.get_secret(account.id)

generate_secret() rotates it and returns the new one. It is described rather than shown running, because it invalidates the secret in use: rotating the account a deployment authenticates with locks out everything configured with the old value, and unlike the workspace and the store, Keycloak is not restored afterwards.

Classes:

ClientAccountRepository¤

Bases: PlainListRepository

Repository for Keycloak OpenID Connect client accounts.

Lists clients in the Corporate Memory Keycloak realm that use the openid-connect protocol and have a client secret configured. Clients are keyed by their clientId.

Functions:

  • fetch_data – Fetch simple list from a JSON endpoint via a type adapter
  • generate_secret – Generate and return a new secret for a client.
  • get_secret – Get the current secret for a client.
  • items – Get the items of the repository
  • keys – Get the keys of the repository
  • values – Get the values of the repository

Attributes:

  • logger (Logger) – Gets the client logger

fetch_data¤

fetch_data()

Fetch simple list from a JSON endpoint via a type adapter

Use this method to fetch data when your result set is an array of objects.

generate_secret¤

generate_secret(client_uuid)

Generate and return a new secret for a client.

Parameters:

  • client_uuid (str) – The Keycloak UUID of the client (not the clientId).

Returns:

  • str – The newly generated client secret value.

get_secret¤

get_secret(client_uuid)

Get the current secret for a client.

Parameters:

  • client_uuid (str) – The Keycloak UUID of the client (not the clientId).

Returns:

  • str – The current client secret value.

items¤

items()

Get the items of the repository

keys¤

keys()

Get the keys of the repository

logger¤

logger: logging.Logger

Gets the client logger

values¤

values()

Get the values of the repository

Comments