Package pyxmpp :: Package sasl :: Module digest_md5 :: Class DigestMD5ClientAuthenticator

[hide private]

# Class DigestMD5ClientAuthenticator

source code

    core.ClientAuthenticator --+
                               |
                              DigestMD5ClientAuthenticator

Provides PLAIN SASL authentication for a client.

Instance Methods | [hide private]

__init__(self, password_manager) Initialize a DigestMD5ClientAuthenticator object. | source code

sasl.Response or sasl.Failure

start(self, username, authzid) Start the authentication process initializing client state. | source code

sasl.Response or sasl.Failure

challenge(self, challenge) Process a challenge and return the response. | source code

_get_password(self) Retrieve user's password from the password manager. | source code

sasl.Response or sasl.Failure

_make_response(self, charset, realms, nonce) Make a response for the first challenge from the server. | source code

`str` or Failure

_get_realm(self, realms, charset) Choose a realm from the list specified by the server. | source code

sasl.Response or sasl.Failure

_final_challenge(self, challenge) Process the second challenge from the server and return the response. | source code

sasl.Success or sasl.Failure

finish(self, data) Process success indicator from the server. | source code

Instance Variables | [hide private]

| password current authentication password
| pformat current authentication password format
| realm current authentication realm

Method Details | [hide private]

### __init__(self, password_manager)
(Constructor)

source code

Initialize a DigestMD5ClientAuthenticator object.

Parameters:
  - `password_manager` (PasswordManager) - name of the password manager object providing authentication credentials.
Overrides: core.ClientAuthenticator.__init__

### start(self, username, authzid)

source code

Start the authentication process initializing client state.

Parameters:
  - `username` (`unicode`) - username (authentication id).
  - `authzid` (`unicode`) - authorization id.
Returns: sasl.Response or sasl.Failure
  the (empty) initial response
Overrides: core.ClientAuthenticator.start

### challenge(self, challenge)

source code

Process a challenge and return the response.

Parameters:
  - `challenge` (`str`) - the challenge from server.
Returns: sasl.Response or sasl.Failure
  the response or a failure indicator.
Overrides: core.ClientAuthenticator.challenge

### _get_password(self)

source code

Retrieve user's password from the password manager.

Set self.password to the password and self.pformat to its format name ('plain' or 'md5:user:realm:pass').

### _make_response(self, charset, realms, nonce)

source code

Make a response for the first challenge from the server.

Parameters:
  - `charset` (`str`) - charset name from the challenge.
  - `realms` (`str`) - realms list from the challenge.
  - `nonce` (`str`) - nonce value from the challenge.
Returns: sasl.Response or sasl.Failure
  the response or a failure indicator.

### _get_realm(self, realms, charset)

source code

Choose a realm from the list specified by the server.

Parameters:
  - `realms` (`list` of `str`) - the realm list.
  - `charset` (`str`) - encoding of realms on the list.
Returns: `str` or Failure
  the realm chosen or a failure indicator.

### _final_challenge(self, challenge)

source code

Process the second challenge from the server and return the response.

Parameters:
  - `challenge` (`str`) - the challenge from server.
Returns: sasl.Response or sasl.Failure
  the response or a failure indicator.

### finish(self, data)

source code

Process success indicator from the server.

Process any addiitional data passed with the success. Fail if the server was not authenticated.

Parameters:
  - `data` (`str`) - an optional additional data with success.
Returns: sasl.Success or sasl.Failure
  success or failure indicator.
Overrides: core.ClientAuthenticator.finish