Package pyxmpp :: Module streamsasl :: Class StreamSASLMixIn
[show private | hide private]
[frames | no frames]

Class StreamSASLMixIn

PasswordManager --+
                  |
                 StreamSASLMixIn

Known Subclasses:
Stream

SASL authentication mix-in class for XMPP stream.
Method Summary
  __init__(self, sasl_mechanisms)
Initialize Stream object
  _handle_sasl_features(self)
Process incoming <stream:features/> element.
  _make_stream_sasl_features(self, features)
Add SASL features to the <features/> element of the stream.
bool _process_node_sasl(self, xmlnode)
Process incoming stream element.
  _process_sasl_abort(self)
Process incoming <sasl:abort/> element.
  _process_sasl_auth(self, mechanism, content)
Process incoming <sasl:auth/> element.
  _process_sasl_challenge(self, content)
Process incoming <sasl:challenge/> element.
  _process_sasl_failure(self, xmlnode)
Process incoming <sasl:failure/> element.
  _process_sasl_node(self, xmlnode)
Process stream element in the SASL namespace.
  _process_sasl_response(self, content)
Process incoming <sasl:response/> element.
  _process_sasl_success(self, content)
Process incoming <sasl:success/> element.
  _reset_sasl(self)
Reset StreamSASLMixIn object state making it ready to handle new connections.
  _sasl_authenticate(self, username, authzid, mechanism)
Start SASL authentication process.
    Inherited from PasswordManager
bool check_authzid(self, authzid, extra_info)
Check if the authenticated entity is allowed to use given authorization id.
bool check_password(self, username, password, realm)
Check the password validity.
unicode choose_realm(self, realm_list)
Choose an authentication realm from the list provided by the server.
str generate_nonce(self)
Generate a random string for digest authentication challenges.
unicode,`str` tuple. get_password(self, username, realm, acceptable_formats)
Get the password for user authentication.
list of unicode get_realms(self)
Get available realms list.
  get_serv_host(self)
Return the host name for DIGEST-MD5 'digest-uri' field.
  get_serv_name(self)
Return the service name for DIGEST-MD5 'digest-uri' field.
  get_serv_type(self)
Return the service type for DIGEST-MD5 'digest-uri' field.

Method Details

__init__(self, sasl_mechanisms=())
(Constructor)

Initialize Stream object
Parameters:
sasl_mechanisms - sequence of SASL mechanisms allowed for authentication. Currently "PLAIN" and "DIGEST-MD5" are supported.
Overrides:
pyxmpp.sasl.core.PasswordManager.__init__

_handle_sasl_features(self)

Process incoming <stream:features/> element.

[initiating entity only]

The received features node is available in self.features.

_make_stream_sasl_features(self, features)

Add SASL features to the <features/> element of the stream.

[receving entity only]

Returns:
update <features/> element node.

_process_node_sasl(self, xmlnode)

Process incoming stream element. Pass it to _process_sasl_node if it is in the SASL namespace.
Returns:
True when the node was recognized as a SASL element.
           (type=bool)

_process_sasl_abort(self)

Process incoming <sasl:abort/> element.

[receiving entity only]

_process_sasl_auth(self, mechanism, content)

Process incoming <sasl:auth/> element.

[receiving entity only]

Parameters:
mechanism - mechanism choosen by the peer.
content - optional "initial response" included in the element.

_process_sasl_challenge(self, content)

Process incoming <sasl:challenge/> element.

[initiating entity only]

Parameters:
content - the challenge data received (Base64-encoded).

_process_sasl_failure(self, xmlnode)

Process incoming <sasl:failure/> element.

[initiating entity only]

Parameters:
xmlnode - the XML node received.

_process_sasl_node(self, xmlnode)

Process stream element in the SASL namespace.
Parameters:
xmlnode - the XML node received

_process_sasl_response(self, content)

Process incoming <sasl:response/> element.

[receiving entity only]

Parameters:
content - the response data received (Base64-encoded).

_process_sasl_success(self, content)

Process incoming <sasl:success/> element.

[initiating entity only]

Parameters:
content - the "additional data with success" received (Base64-encoded).

_reset_sasl(self)

Reset StreamSASLMixIn object state making it ready to handle new connections.

_sasl_authenticate(self, username, authzid, mechanism=None)

Start SASL authentication process.

[initiating entity only]

Parameters:
username - user name.
authzid - authorization ID.
mechanism - SASL mechanism to use.