pysasl.creds Package¶
pysasl.creds Module¶
- class pysasl.creds.Credentials(*args, **kwargs)[source]¶
SASL authentication credentials consist of an authentication identity and an authorization identity, the identity to be assumed.
Consider a UNIX system where
rootis the superuser and only it may assume the identity of other users. With an authentication identity ofrootand an authorization identity ofterry, the authorization would succeed because the authentication identity has sufficient privileges to assume the authorization identity. If the authentication identity weregreg, authorization would fail becausegregdoes not have superuser privileges to assume the identity ofterry.- See:
Identity, RFC 4422 2.
pysasl.creds.server Module¶
- class pysasl.creds.server.ServerCredentials(*args, **kwargs)[source]¶
Bases:
Credentials,ProtocolCredentials that are received from a client and should be authenticated against a known secret value.
- abstract verify(identity)[source]¶
Authenticates the credentials against the given identity.
- Parameters:
identity (Identity | None) – The identity being authenticated.
- Raises:
MechanismUnusable – The mechanism is not capable of verifying identity.
- Return type:
pysasl.creds.client Module¶
- class pysasl.creds.client.ClientCredentials(authcid, secret, authzid=None)[source]¶
Bases:
CredentialsCredentials that are provided by the user and transmitted to the server for authentication..
- Parameters:
pysasl.creds.plain Module¶
- class pysasl.creds.plain.PlainCredentials(authcid, secret, authzid='')[source]¶
Bases:
ServerCredentialsImplementation of
ServerCredentialsfor typical SASL mechanisms likePlainMechanismwhere the mechanism operates on the secret string in cleartext.- Parameters:
- property authzid: str¶
The authorization identity. The
authcididentity must have sufficient privileges to assume this identity for the authentication attempt to succeed.
- verify(identity)[source]¶
Authenticates the credentials against the given identity.
- Parameters:
identity (Identity | None) – The identity being authenticated.
- Raises:
MechanismUnusable – The mechanism is not capable of verifying identity.
- Return type:
pysasl.creds.external Module¶
- exception pysasl.creds.external.ExternalVerificationRequired(identity, token=None)[source]¶
Bases:
AuthenticationErrorThe credentials are structurally valid but require external verification.
If token is
None, the credentials provided no additional information for verification. Otherwise, token should be verified and authorized for identity.
- class pysasl.creds.external.ExternalCredentials(authzid, token=None)[source]¶
Bases:
ServerCredentialsCredentials that require external verification, rather than by a traditional hashing algorithm.
- Parameters:
- property authzid: str¶
The authorization identity. The
authcididentity must have sufficient privileges to assume this identity for the authentication attempt to succeed.
- verify(identity)[source]¶
This method always throws
ExternalVerificationRequired. For applications to support these types of credentials, they must catch this exception and use it to authenticate and authorize the request.- Parameters:
identity (Identity | None) – The identity being authenticated.
- Raises:
ExternalVerificationRequired – Always thrown.
- Return type: