Skip to content

cmem_client.models.credentials¤

Models for the OAuth2 credentials.

These models carry the credentials of an OAuth2 flow as a validated object, instead of a set of loose strings. The marketplace operations of client.marketplace take one of them to authenticate against a marketplace server. The secrets are held as SecretStr, so they are masked when a model is printed or logged.

Classes:

BaseCredentials¤

Bases: Model

Base class for OAuth2 credential types

Attributes:

  • client_id (str) – Keycloak client the credentials authenticate with. The default suits the password flow; the client credentials flow needs the ID of the service account instead.

client_id¤

client_id: str = 'cmemc'

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

ClientCredentials¤

Bases: BaseCredentials

The client credentials class

Attributes:

  • client_secret (SecretStr) – Secret of the Keycloak client named by client_id.

client_id¤

client_id: str = 'cmemc'

client_secret¤

client_secret: SecretStr

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

PasswordCredentials¤

Bases: BaseCredentials

The password credentials class

Attributes:

  • username (str) – Name of the Keycloak user.
  • password (SecretStr) – Password of the Keycloak user.

client_id¤

client_id: str = 'cmemc'

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

password¤

password: SecretStr

username¤

username: str

Comments