Soup.AuthDomainDigest

g GObject.Object GObject.Object Soup.AuthDomain Soup.AuthDomain GObject.Object->Soup.AuthDomain Soup.AuthDomainDigest Soup.AuthDomainDigest Soup.AuthDomain->Soup.AuthDomainDigest

Subclasses:

None

Methods

Inherited:

Soup.AuthDomain (9), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

encode_password (username, realm, password)

set_auth_callback (callback, *user_data)

Virtual Methods

Inherited:

Soup.AuthDomain (3), GObject.Object (7)

Properties

Inherited:

Soup.AuthDomain (6)

Name

Type

Flags

Short Description

auth-callback

int

r/w

Password-finding callback

auth-data

int

r/w

Data to pass to authentication callback

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Soup.AuthDomainDigest(**kwargs)
Bases:

Soup.AuthDomain

Abstract:

No

Structure:

Soup.AuthDomainDigestClass

Server-side “Digest” authentication.

Soup.AuthDomainDigest handles the server side of HTTP “Digest” authentication.

classmethod encode_password(username, realm, password)
Parameters:
  • username (str) – a username

  • realm (str) – an auth realm name

  • password (str) – the password for username in realm

Returns:

the encoded password

Return type:

str

Encodes the username/realm/password triplet for Digest authentication.

That is, it returns a stringified MD5 hash of username, realm, and password concatenated together. This is the form that is needed as the return value of Soup.AuthDomainDigest'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.)

set_auth_callback(callback, *user_data)
Parameters:

Sets the callback that self will use to authenticate incoming requests.

For each request containing authorization, self will invoke the callback, and then either accept or reject the request based on callback's return value.

You can also set the auth callback by setting the [property`AuthDomainDigest`:py:data::auth-callback<Soup.AuthDomainDigest.props.auth_callback>] and [property`AuthDomainDigest`:py:data::auth-data<Soup.AuthDomainDigest.props.auth_data>] properties, which can also be used to set the callback at construct time.

Property Details

Soup.AuthDomainDigest.props.auth_callback
Name:

auth-callback

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE

The [callback`AuthDomainDigestAuthCallback`].

Soup.AuthDomainDigest.props.auth_data
Name:

auth-data

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE

The data to pass to the [callback`AuthDomainDigestAuthCallback`].