AuthDomainDigest#
Superclasses: AuthDomain, Object
Server-side “Digest” authentication.
SoupAuthDomainDigest handles the server side of HTTP “Digest”
authentication.
Methods#
- class AuthDomainDigest
- classmethod encode_password(realm: str, password: str) str#
Encodes the username/realm/password triplet for Digest authentication.
That is, it returns a stringified MD5 hash of
username,realm, andpasswordconcatenated together. This is the form that is needed as the return value ofSoupAuthDomainDigest’s auth handler.For security reasons, you should store the encoded hash, rather than storing the cleartext password itself and calling this method only when you need to verify it. This way, if your server is compromised, the attackers will not gain access to cleartext passwords which might also be usable at other sites. (Note also that the encoded password returned by this method is identical to the encoded password stored in an Apache .htdigest file.)
- Parameters:
realm – an auth realm name
password – the password for
usernameinrealm
- set_auth_callback(callback: Callable[[AuthDomainDigest, ServerMessage, str, Any], str | None], user_data: Any = None) None#
Sets the callback that
domainwill use to authenticate incoming requests.For each request containing authorization,
domainwill invoke the callback, and then either accept or reject the request based oncallback's return value.You can also set the auth callback by setting the
auth_callbackandauth_dataproperties, which can also be used to set the callback at construct time.- Parameters:
callback – the callback
user_data – data to pass to
auth_callback
Properties#
- class AuthDomainDigest
- props.auth_callback: Callable[[AuthDomainDigest, ServerMessage, str, Any], str | None]#
The type of the None singleton.