class documentation

Implements the DIGEST-MD5 SASL authentication mechanism.

The DIGEST-MD5 SASL authentication mechanism is defined in RFC 2831.

Method __init__ No summary
Method getInitialResponse Get the initial client response, if defined for this mechanism.
Method getResponse Get the response to a server challenge.
Class Variable name Common name for the SASL Mechanism.
Instance Variable defaultRealm Undocumented
Instance Variable digest_uri Undocumented
Instance Variable password Undocumented
Instance Variable username Undocumented
Method _calculateResponse Calculates response with given encoded parameters.
Method _gen_nonce Undocumented
Method _genResponse Generate response-value.
Method _parse Parses the server challenge.
Method _unparse Create message string from directives.
def __init__(self, serv_type, host, serv_name, username, password):
Parameters
serv_type:unicodeAn indication of what kind of server authentication is being attempted against. For example, u"xmpp".
host:unicodeThe authentication hostname. Also known as the realm. This is used as a scope to help select the right credentials.
serv_name:unicodeAn additional identifier for the server.
username:unicodeThe authentication username to use to respond to a challenge.
password:unicodeThe authentication password to use to respond to a challenge.
def getInitialResponse(self):

Get the initial client response, if defined for this mechanism.

Returns
str.initial client response string.
def getResponse(self, challenge):

Get the response to a server challenge.

Parameters
challenge:str.server challenge.
Returns
str.client response.
name: str =

Common name for the SASL Mechanism.

defaultRealm =

Undocumented

digest_uri =

Undocumented

password =

Undocumented

username =

Undocumented

def _calculateResponse(self, cnonce, nc, nonce, username, password, realm, uri):

Calculates response with given encoded parameters.

Returns
bytesThe response field of a response to a Digest-MD5 challenge of the given parameters.
def _gen_nonce(self):

Undocumented

def _genResponse(self, charset, realm, nonce):

Generate response-value.

Creates a response to a challenge according to section 2.1.2.1 of RFC 2831 using the charset, realm and nonce directives from the challenge.

def _parse(self, challenge):

Parses the server challenge.

Splits the challenge into a dictionary of directives with values.

Returns
dict of str to str.challenge directives and their values.
def _unparse(self, directives):

Create message string from directives.

Parameters
directives:dict of str to strdictionary of directives (names to their values). For certain directives, extra quotes are added, as needed.
Returns
str.message string.