pyxmpp.jabber.clientstream.LegacyClientStream

Package pyxmpp :: Package jabber :: Module clientstream :: Class LegacyClientStream |
[hide private]

# Class LegacyClientStream

source code

               streamtls.StreamTLSMixIn --+
                                          |
          sasl.core.PasswordManager --+   |
                                      |   |
             streamsasl.StreamSASLMixIn --+
                                          |
    stanzaprocessor.StanzaProcessor --+   |
                                      |   |
             xmlextra.StreamHandler --+   |
                                      |   |
                  streambase.StreamBase --+
                                          |
                              stream.Stream --+
                                              |
                      clientstream.ClientStream --+
                                                  |
                                                 LegacyClientStream

Handles Jabber (both XMPP and legacy protocol) client connection stream.

Both client and server side of the connection is supported. This class handles client SASL and legacy authentication, authorisation and XMPP resource binding.

Instance Methods | [hide private]
__init__(self, jid, password=None, server=None, port=5222, auth_methods=`(``'``sasl:DIGEST-MD5``'``,` `'``digest``'``)`, tls_settings=None, keepalive=0, owner=None) Initialize a LegacyClientStream object. | source code
_reset(self) Reset the LegacyClientStream object state, making the object ready to handle new connections. | source code
_post_connect(self) Initialize authentication when the connection is established and we are the initiator. | source code
_post_auth(self) Unregister legacy authentication handlers after successfull authentication. | source code
_try_auth(self) Try to authenticate using the first one of allowed authentication methods left. | source code
auth_in_stage1(self, stanza) Handle the first stage (<iq type='get'/>) of legacy ("plain" or "digest") authentication. | source code
auth_in_stage2(self, stanza) Handle the second stage (<iq type='set'/>) of legacy ("plain" or "digest") authentication. | source code
_auth_stage1(self) Do the first stage (<iq type='get'/>) of legacy ("plain" or "digest") authentication. | source code
auth_timeout(self) Handle legacy authentication timeout. | source code
auth_error(self, stanza) Handle legacy authentication error. | source code
auth_stage2(self, stanza) Handle the first stage authentication response (result of the <iq type="get"/>). | source code
_plain_auth_stage2(self, _unused) Do the second stage (<iq type='set'/>) of legacy "plain" authentication. | source code
_plain_auth_in_stage2(self, username, _unused, stanza) Handle the second stage (<iq type='set'/>) of legacy "plain" authentication. | source code
_digest_auth_stage2(self, _unused) Do the second stage (<iq type='set'/>) of legacy "digest" authentication. | source code
_digest_auth_in_stage2(self, username, _unused, stanza) Handle the second stage (<iq type='set'/>) of legacy "digest" authentication. | source code
auth_finish(self, _unused) Handle success of the legacy authentication. | source code
registration_error(self, stanza) Handle in-band registration error. | source code
registration_form_received(self, stanza) Handle registration form received. | source code
submit_registration_form(self, form) Submit a registration form. | source code
registration_success(self, stanza) Handle registration success. | source code
Inherited from `clientstream.ClientStream`: `accept`, `check_authzid`, `choose_realm`, `connect`, `do_bind`, `fix_in_stanza`, `fix_out_stanza`, `get_password`, `get_realms`, `get_serv_host`, `get_serv_name`, `get_serv_type` Inherited from `clientstream.ClientStream` (private): `_connect`, `_get_stream_features` Inherited from `stream.Stream` (private): `_got_features`, `_make_stream_features`, `_process_node` Inherited from `streamtls.StreamTLSMixIn`: `get_tls_connection`, `tls_is_certificate_valid` Inherited from `streamtls.StreamTLSMixIn` (private): `_handle_tls_features`, `_make_stream_tls_features`, `_make_tls_connection`, `_process`, `_process_node_tls`, `_process_tls_node`, `_read`, `_read_tls`, `_request_tls`, `_reset_tls`, `_write_raw` Inherited from `streamsasl.StreamSASLMixIn` (private): `_handle_sasl_features`, `_make_stream_sasl_features`, `_process_node_sasl`, `_process_sasl_abort`, `_process_sasl_auth`, `_process_sasl_challenge`, `_process_sasl_failure`, `_process_sasl_node`, `_process_sasl_response`, `_process_sasl_success`, `_reset_sasl`, `_sasl_authenticate` Inherited from `sasl.core.PasswordManager`: `check_password`, `generate_nonce` Inherited from `streambase.StreamBase`: `__del__`, `bind`, `check_to`, `close`, `connected`, `disconnect`, `error`, `fileno`, `generate_id`, `idle`, `loop`, `loop_iter`, `process`, `process_stream_error`, `send`, `stanza`, `stanza_start`, `state_change`, `stream_end`, `stream_start`, `write_raw` Inherited from `streambase.StreamBase` (private): `_accept`, `_bind_error`, `_bind_success`, `_close`, `_connect_socket`, `_disconnect`, `_feed_reader`, `_idle`, `_loop_iter`, `_make_reader`, `_process_stream_node`, `_restart_stream`, `_send`, `_send_stream_end`, `_send_stream_error`, `_send_stream_features`, `_send_stream_start`, `_write_node` Inherited from `stanzaprocessor.StanzaProcessor`: `process_iq`, `process_message`, `process_presence`, `process_response`, `process_stanza`, `route_stanza`, `set_iq_get_handler`, `set_iq_set_handler`, `set_message_handler`, `set_presence_handler`, `set_response_handlers`, `unset_iq_get_handler`, `unset_iq_set_handler` Inherited from `stanzaprocessor.StanzaProcessor` (private): `_set_response_handlers` Inherited from `xmlextra.StreamHandler`: `warning` Inherited from `xmlextra.StreamHandler` (private): `_stanza`, `_stream_end`, `_stream_start`

Instance Variables | [hide private]
Inherited from `clientstream.ClientStream`: `auth_methods`, `my_jid`, `password`, `port`, `server` Inherited from `stream.Stream`: `features`, `initiator`, `lock`, `me`, `peer`, `process_all_stanzas`, `tls` Inherited from `stream.Stream` (private): `_reader` Inherited from `streambase.StreamBase`: `owner`

Method Details | [hide private]

### __init__(self, jid, password=None, server=None, port=5222, auth_methods=`(``'``sasl:DIGEST-MD5``'``,` `'``digest``'``)`, tls_settings=None, keepalive=0, owner=None) (Constructor) | source code
Initialize a LegacyClientStream object. Parameters: `jid` (: pyxmpp.JID) - : local JID. `password` (: `unicode`) - : user's password. `server` (: `unicode`) - : server to use. If not given then address will be derived form the JID. `port` (: `int`) - : port number to use. If not given then address will be derived form the JID. `auth_methods` (: sequence of `str`) - : sallowed authentication methods. SASL authentication mechanisms in the list should be prefixed with "sasl:" string. `tls_settings` (: pyxmpp.TLSSettings) - : settings for StartTLS -- TLSSettings instance. `keepalive` (: `int`) - : keepalive output interval. 0 to disable. `owner` - : Client, Component or similar object "owning" this stream. Overrides: xmlextra.StreamHandler.__init__

### _reset(self) | source code
Reset the LegacyClientStream object state, making the object ready to handle new connections. Overrides: streambase.StreamBase._reset

### _post_connect(self) | source code
Initialize authentication when the connection is established and we are the initiator. Overrides: streambase.StreamBase._post_connect

### _post_auth(self) | source code
Unregister legacy authentication handlers after successfull authentication. Overrides: streambase.StreamBase._post_auth

### _try_auth(self) | source code
Try to authenticate using the first one of allowed authentication methods left. [client only] Overrides: clientstream.ClientStream._try_auth

### auth_in_stage1(self, stanza) | source code
Handle the first stage (<iq type='get'/>) of legacy ("plain" or "digest") authentication. [server only]

### auth_in_stage2(self, stanza) | source code
Handle the second stage (<iq type='set'/>) of legacy ("plain" or "digest") authentication. [server only]

### _auth_stage1(self) | source code
Do the first stage (<iq type='get'/>) of legacy ("plain" or "digest") authentication. [client only]

### auth_timeout(self) | source code
Handle legacy authentication timeout. [client only]

### auth_error(self, stanza) | source code
Handle legacy authentication error. [client only]

### auth_stage2(self, stanza) | source code
Handle the first stage authentication response (result of the <iq type="get"/>). [client only]

### _plain_auth_stage2(self, _unused) | source code
Do the second stage (<iq type='set'/>) of legacy "plain" authentication. [client only]

### _plain_auth_in_stage2(self, username, _unused, stanza) | source code
Handle the second stage (<iq type='set'/>) of legacy "plain" authentication. [server only]

### _digest_auth_stage2(self, _unused) | source code
Do the second stage (<iq type='set'/>) of legacy "digest" authentication. [client only]

### _digest_auth_in_stage2(self, username, _unused, stanza) | source code
Handle the second stage (<iq type='set'/>) of legacy "digest" authentication. [server only]

### registration_error(self, stanza) | source code
Handle in-band registration error. [client only] Parameters: `stanza` (: pyxmpp.stanza.Stanza) - : the error stanza received or `None` on timeout.

### registration_form_received(self, stanza) | source code
Handle registration form received. [client only] Call self.registration_callback with the registration form received as the argument. Use the value returned by the callback will be a filled-in form. Parameters: `stanza` (: pyxmpp.iq.Iq) - : the stanza received.

### submit_registration_form(self, form) | source code
Submit a registration form. [client only] Parameters: `form` (: pyxmpp.jabber.dataforms.Form) - : the filled-in form. When form is `None` or its type is "cancel" the registration is to be canceled.

### registration_success(self, stanza) | source code
Handle registration success. [client only] Clean up registration stuff, change state to "registered" and initialize authentication. Parameters: `stanza` (: pyxmpp.iq.Iq) - : the stanza received.