Authentication

class couchbase.auth.AuthDomain(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Where a user is managed.

Local users are managed by Couchbase Server, and External users by an outside service such as LDAP.

External = 1
Local = 0
class couchbase.auth.Authenticator

The credentials a cluster connects with.

Each subclass is one authentication mechanism. An instance is a dict of the settings the connection takes, and its repr hides the password, the token and the key path.

class couchbase.auth.CertificateAuthenticator(cert_path: str | None = None, key_path: str | None = None, trust_store_path: str | None = None)

Certificate authentication mechanism.

Parameters:
  • cert_path (str) – Path to the client certificate. Defaults to None.

  • key_path (str) – Path to the client key. Defaults to None.

  • trust_store_path (str, optional) – Path of the certificate trust store. Defaults to None.

class couchbase.auth.JwtAuthenticator(token: str)

JWT (JSON Web Token) authentication mechanism.

Uses OAUTHBEARER SASL mechanism for KV connections and Bearer token for HTTP services.

Parameters:

token (str) – The JWT token to use for authentication.

Raises:

InvalidArgumentException – If token is not a string.

class couchbase.auth.PasswordAuthenticator(username: str, password: str, cert_path: str | None = None, **kwargs: Any)

Password authentication mechanism.

Parameters:
  • username (str) – Username to use for authentication.

  • password (str) – Password to use for authentication.

  • cert_path (str, optional) – Path of the certificate trust store. Defaults to None.

static ldap_compatible(username: str, password: str) → PasswordAuthenticator

A password authenticator that sends the password with SASL PLAIN, which LDAP users need.

PLAIN sends the password as it is, so use it over TLS.

Parameters:
  • username (str) – The name of the user.

  • password (str) – The user’s password.

Returns:

An authenticator allowing only the PLAIN mechanism.

Return type:

PasswordAuthenticator