Home | Trees | Index | Help |
|
---|
Package pyxmpp :: Module clientstream :: Class ClientStream |
|
StanzaProcessor
--+ |StreamHandler
--+ |StreamBase
--+ |PasswordManager
--+ | | |StreamSASLMixIn
--+ |StreamTLSMixIn
--+ |Stream
--+ | ClientStream
LegacyClientStream
Handles XMPP-IM client connection stream. Both client and server side of the connection is supported. This class handles client SASL authentication, authorisation and resource binding. This class is not ready for handling of legacy Jabber servers, as it doesn't provide legacy authentication. :Ivariables: - `my_jid`: requested local JID. Please notice that this may differ from `me`, which is actual authorized JID after the resource binding. - `server`: server to use. - `port`: port number to use. - `password`: user's password. - `auth_methods`: allowed authentication methods. :Types: - `my_jid`: `pyxmpp.JID` - `server`: `str` - `port`: `int` - `password`: `str` - `auth_methods`: `list` of `str`
Method Summary | |
---|---|
Initialize the ClientStream object. | |
Accept an incoming client connection. | |
Check authorization id provided by the client. | |
Choose authentication realm from the list provided by the server. | |
Establish a client connection to a server. | |
Do the resource binding requested by a client connected. | |
Fix an incoming stanza. | |
Fix outgoing stanza. | |
Get a user password for the SASL authentication. | |
Get realms available for client authentication. | |
Get the service host name for SASL authentication. | |
Get the service name for SASL authentication. | |
Get the server name for SASL authentication. | |
Same as `ClientStream.connect` but assume `self.lock` is acquired. | |
Include resource binding feature in the stream features list. | |
Initialize authentication when the connection is established and we are the initiator. | |
Reset `ClientStream` object state, making the object ready to handle new connections. | |
Try to authenticate using the first one of allowed authentication methods left. | |
Inherited from Stream | |
Process incoming <stream:features/> element. | |
Create the <features/> element for the stream. | |
Process first level element of the stream. | |
Inherited from StreamTLSMixIn | |
Get the TLS connection object for the stream. | |
Process incoming StartTLS related element of <stream:features/>. | |
Update the <features/> with StartTLS feature. | |
Initiate TLS connection. | |
Same as `Stream.process` but assume `self.lock` is acquired. | |
Process incoming stream element. | |
Process stream element in the TLS namespace. | |
Read data pending on the stream socket and pass it to the parser. | |
Read data pending on the stream socket and pass it to the parser. | |
Request a TLS-encrypted connection. | |
Reset `StreamTLSMixIn` object state making it ready to handle new connections. | |
Certificate verification callback for TLS connections. | |
Same as `Stream.write_raw` but assume `self.lock` is acquired. | |
Inherited from StreamSASLMixIn | |
Process incoming <stream:features/> element. | |
Add SASL features to the <features/> element of the stream. | |
Process incoming stream element. | |
Process incoming <sasl:abort/> element. | |
Process incoming <sasl:auth/> element. | |
Process incoming <sasl:challenge/> element. | |
Process incoming <sasl:failure/> element. | |
Process stream element in the SASL namespace. | |
Process incoming <sasl:response/> element. | |
Process incoming <sasl:success/> element. | |
Reset `StreamSASLMixIn` object state making it ready to handle new connections. | |
Start SASL authentication process. | |
Inherited from PasswordManager | |
Check the password validity. | |
Generate a random string for digest authentication challenges. | |
Inherited from StreamBase | |
| |
Bind to a resource. | |
Check "to" attribute of received stream header. | |
Forcibly close the connection and clear the stream state. | |
Check if stream is connected. | |
Gracefully close the connection. | |
Handle stream XML parse error. | |
Return filedescriptor of the stream socket. | |
Generate a random and unique stream ID. | |
Do some housekeeping (cache expiration, timeout handling). | |
Simple "main loop" for the stream. | |
Single iteration of a simple "main loop" for the stream. | |
Process stream's pending events. | |
Process stream error element received. | |
Write stanza to the stream. | |
Process stanza (first level child element of the stream). | |
Process stanza (first level child element of the stream) start tag -- do nothing. | |
Called when connection state is changed. | |
Process </stream:stream> (stream end) tag received from peer. | |
Process <stream:stream> (stream start) tag received from peer. | |
Write raw data to the stream socket. | |
Same as `Stream.accept` but assume `self.lock` is acquired. | |
Handle resource binding success. | |
Handle resource binding success. | |
Same as `Stream.close` but assume `self.lock` is acquired. | |
Initialize stream on outgoing connection. | |
Same as `Stream.disconnect` but assume `self.lock` is acquired. | |
Feed the stream reader with data received. | |
Same as `Stream.idle` but assume `self.lock` is acquired. | |
Same as `Stream.loop_iter` but assume `self.lock` is acquired. | |
Create ne `xmlextra.StreamReader` instace as `self._reader`. | |
Called when connection is authenticated. | |
Process first level stream-namespaced element of the stream. | |
Restart the stream as needed after SASL and StartTLS negotiation. | |
Same as `Stream.send` but assume `self.lock` is acquired. | |
Send stream end tag. | |
Send stream error element. | |
Send stream <features/>. | |
Send stream start tag. | |
Write XML `xmlnode` to the stream. | |
Inherited from StanzaProcessor | |
Process IQ stanza received. | |
Process message stanza. | |
Process presence stanza. | |
Process stanza received from the stream. | |
Process stanza not addressed to us. | |
Set <iq type="get"/> handler. | |
Set <iq type="set"/> handler. | |
Set a handler for <message/> stanzas. | |
Set a handler for <presence/> stanzas. | |
Set response handler for an IQ "get" or "set" stanza. | |
Remove <iq type="get"/> handler. | |
Remove <iq type="set"/> handler. | |
Same as `Stream.set_response_handlers` but assume `self.lock` is acquired. | |
Inherited from StreamHandler | |
Process complete stanza. | |
Process stream end. | |
Process stream start. |
Method Details |
---|
__init__(self,
jid,
password=None,
server=None,
port=None,
auth_methods=('sasl:DIGEST-MD5',),
tls_settings=None,
keepalive=0)
|
accept(self, sock)Accept an incoming client connection. [server only] :Parameters: - `sock`: a listening socket.
|
check_authzid(self, authzid, extra_info=None)Check authorization id provided by the client. [server only] :Parameters: - `authzid`: authorization id provided. - `extra_info`: additional information about the user from the authentication backend. This mapping will usually contain at least 'username' item. :Types: - `authzid`: unicode - `extra_info`: mapping :return: `True` if user is authorized to use that `authzid`. :returntype: `bool` |
choose_realm(self, realm_list)Choose authentication realm from the list provided by the server. [client only] Use domain of the own JID if no realm list was provided or the domain is on the list or the first realm on the list otherwise. :Parameters: - `realm_list`: realm list provided by the server. :Types: - `realm_list`: `list` of `unicode` :return: the realm chosen. :returntype: `unicode` |
connect(self, server=None, port=None)Establish a client connection to a server. [client only] :Parameters: - `server`: name or address of the server to use. Not recommended -- proper value should be derived automatically from the JID. - `port`: port number of the server to use. Not recommended -- proper value should be derived automatically from the JID. :Types: - `server`: `unicode` - `port`: `int`
|
do_bind(self, stanza)Do the resource binding requested by a client connected. [server only] :Parameters: - `stanza`: resource binding request stanza. :Types: - `stanza`: `pyxmpp.Iq` |
fix_in_stanza(self, stanza)Fix an incoming stanza. Ona server replace the sender address with authorized client JID. |
fix_out_stanza(self, stanza)Fix outgoing stanza. On a client clear the sender JID. On a server set the sender address to the own JID if the address is not set yet. |
get_password(self, username, realm=None, acceptable_formats=('plain',))Get a user password for the SASL authentication. :Parameters: - `username`: username used for authentication. - `realm`: realm used for authentication. - `acceptable_formats`: acceptable password encoding formats requested. :Types: - `username`: `unicode` - `realm`: `unicode` - `acceptable_formats`: `list` of `str` :return: The password and the format name ('plain'). :returntype: (`unicode`,`str`) |
get_realms(self)Get realms available for client authentication. [server only] :return: list of realms. :returntype: `list` of `unicode`
|
get_serv_host(self)Get the service host name for SASL authentication. :return: domain of the own JID. |
get_serv_name(self)Get the service name for SASL authentication. :return: domain of the own JID. |
get_serv_type(self)Get the server name for SASL authentication. :return: 'xmpp'. |
_connect(self, server=None, port=None)Same as `ClientStream.connect` but assume `self.lock` is acquired.
|
_get_stream_features(self)Include resource binding feature in the stream features list. [server only] |
_post_connect(self)Initialize authentication when the connection is established and we are the initiator.
|
_reset(self)Reset `ClientStream` object state, making the object ready to handle new connections.
|
_try_auth(self)Try to authenticate using the first one of allowed authentication methods left. [client only] |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Wed May 31 22:37:04 2006 | http://epydoc.sf.net |