pysasl Package

class pysasl.SASLAuth(mechanisms)[source]

Manages the mechanisms available for authentication attempts.

Parameters:

mechanisms (Sequence[ServerMechanism | ClientMechanism]) – List of available SASL mechanism objects.

classmethod defaults()[source]

Uses the default built-in authentication mechanisms, PLAIN and LOGIN.

Returns:

A new SASLAuth object.

Return type:

Self

classmethod named(names)[source]

Uses the built-in authentication mechanisms that match a provided name.

Parameters:

names (Iterable[bytes]) – The authentication mechanism names.

Returns:

A new SASLAuth object.

Raises:

KeyError – A mechanism name was not recognized.

Return type:

Self

property server_mechanisms: Sequence[ServerMechanism]

List of available ServerMechanism objects.

property client_mechanisms: Sequence[ClientMechanism]

List of available ClientMechanism objects.

get_server(name)[source]

Get a ClientMechanism by name.

Parameters:

name (bytes) – The SASL mechanism name.

Returns:

The mechanism object or None

Return type:

ServerMechanism | None

get_client(name)[source]

Get a ClientMechanism by name.

Parameters:

name (bytes) – The SASL mechanism name.

Returns:

The mechanism object or None

Return type:

ClientMechanism | None