twisted.protocols.jabber.client.BasicAuthenticator

Package twisted :: Package protocols :: Package jabber :: Module client :: Class BasicAuthenticator |
[frames | no frames]

## Class BasicAuthenticator

       Authenticator --+
                       |
    ConnectAuthenticator --+
                           |
                          BasicAuthenticator

Authenticates an XmlStream against a Jabber server as a Client

This only implements non-SASL authentication, per JEP 78. Additionally, this authenticator provides the ability to perform inline registration, per JEP 77.

Under normal circumstances, the BasicAuthenticator generates the `STREAM_AUTHD_EVENT` once the stream has authenticated. However, it can also generate other events, such as:

- `INVALID_USER_EVENT` : Authentication failed, due to invalid username
- `AUTH_FAILED_EVENT` : Authentication failed, due to invalid password
- `REGISTER_FAILED_EVENT` : Registration failed

If authentication fails for any reason, you can attempt to register by calling the `registerAccount` method. If the registration succeeds, a `STREAM_AUTHD_EVENT` will be fired. Otherwise, one of the above errors will be generated (again).

Method Summary
| `__init__(self, jid, password)`
| `_authQueryResultEvent(self, iq)`
| `_authResultEvent(self, iq)`
| `_registerResultEvent(self, iq)`
| `registerAccount(self, username, password)`
| ``streamStarted`(self, rootelem)` Called by the XmlStream when it has received a root element from the connected peer.
Inherited from ConnectAuthenticator
| ``connectionMade`(self)` Called by the XmlStream when the underlying socket connection is in place.
Inherited from Authenticator
| ``associateWithStream`(self, xmlstream)` Called by the XmlStreamFactory when a connection has been made to the requested peer, and an XmlStream object has been instantiated.

Instance Variable Summary
Inherited from Authenticator
`str` | `streamHost`: Target host for this stream (used as the 'to' attribute)
`XmlStream` | `xmlstream`: The XmlStream that needs authentication

Class Variable Summary
`str` | `AUTH_FAILED_EVENT` = `'//event/client/basicauth/authfailed...`
`str` | `INVALID_USER_EVENT` = `'//event/client/basicauth/invalidus...`
`str` | `namespace`: Default namespace for the XmlStream
`str` | `REGISTER_FAILED_EVENT` = `'//event/client/basicauth/regist...`
Inherited from Authenticator
`int` | `version`: Version attribute for XmlStream.

Method Details

### streamStarted(self, rootelem) Called by the XmlStream when it has received a root element from the connected peer. Parameters: `rootelem` - The root element of the XmlStream received from the streamHost (type=`Element`) Overrides: `twisted.protocols.xmlstream.Authenticator.streamStarted` (inherited documentation)

Class Variable Details

    ### AUTH_FAILED_EVENT Type: `str` Value:
        '//event/client/basicauth/authfailed'

    ### INVALID_USER_EVENT Type: `str` Value:
        '//event/client/basicauth/invaliduser'

    ### namespace Default namespace for the XmlStream Type: `str` Value:
        'jabber:client'

    ### REGISTER_FAILED_EVENT Type: `str` Value:
        '//event/client/basicauth/registerfailed'

Generated by Epydoc 2.0 on Sat May 15 20:08:48 2004 | http://epydoc.sf.net