# ``twisted`.`words`.`protocols`.`jabber`.`client`.`XMPPAuthenticator``

class documentation

`class XMPPAuthenticator(xmlstream.ConnectAuthenticator): (source)`

View In Hierarchy

Initializes an XmlStream connecting to an XMPP server as a Client.

This authenticator performs the initialization steps needed to start exchanging XML stanzas with an XMPP server as an XMPP client. It checks if the server advertises XML stream version 1.0, negotiates TLS (when available), performs SASL authentication, binds a resource and establishes a session.

Upon successful stream initialization, the `xmlstream.STREAM_AUTHD_EVENT` event will be dispatched through the XML stream object. Otherwise, the `xmlstream.INIT_FAILED_EVENT` event will be dispatched with a failure object.

After inspection of the failure, initialization can then be restarted by calling `ConnectAuthenticator.initializeStream`. For example, in case of authentication failure, a user may be given the opportunity to input the correct password. By setting the `password` instance variable and restarting initialization, the stream authentication step is then retried, and subsequent steps are performed if successful.

Method | `__init__` | No summary
Method | `associateWithStream` | Register with the XML stream.
Class Variable | `namespace` | Undocumented
Instance Variable | `jid` | Jabber ID to authenticate with. This may contain a resource part, as a suggestion to the server for resource binding. A server may override this, though. If the resource part is left off, the server will generate a unique resource identifier. The server will always return the full Jabber ID in the resource binding step, and this is stored in this instance variable.
Instance Variable | `password` | password to be used during SASL authentication.
Instance Variable | `_configurationForTLS` | Undocumented

Inherited from `ConnectAuthenticator`:

Method | `connectionMade` | Called by the XmlStream when the underlying socket connection is in place.
Method | `initializeStream` | Perform stream initialization procedures.
Method | `streamStarted` | Called by the XmlStream when the stream has started.
Instance Variable | `otherHost` | Undocumented

Inherited from `Authenticator` (via `ConnectAuthenticator`):

Instance Variable | `xmlstream` | The XmlStream that needs authentication

def __init__(self, jid, password, configurationForTLS=None): (source)
overrides `twisted.words.protocols.jabber.xmlstream.ConnectAuthenticator.__init__`

Parameters
jid | Undocumented
password | Undocumented

configurationForTLS:`IOpenSSLClientConnectionCreator` or `None`

An object which creates appropriately configured TLS connections. This is passed to `startTLS` on the transport and is preferably created using `twisted.internet.ssl.optionsForClientTLS`. If `None`, the default is to verify the server certificate against the trust roots as provided by the platform. See `twisted.internet._sslverify.platformTrust`.

def associateWithStream(self, xs): (source)
overrides `twisted.words.protocols.jabber.xmlstream.Authenticator.associateWithStream`

Register with the XML stream.

Populates stream's list of initializers, along with their requiredness. This list is used by `ConnectAuthenticator.initializeStream` to perform the initialization steps.

namespace: `str` = (source)
overrides `twisted.words.protocols.jabber.xmlstream.ConnectAuthenticator.namespace`

Undocumented

jid: `jid.JID` = (source)
Jabber ID to authenticate with. This may contain a resource part, as a suggestion to the server for resource binding. A server may override this, though. If the resource part is left off, the server will generate a unique resource identifier. The server will always return the full Jabber ID in the resource binding step, and this is stored in this instance variable.
password: `unicode` = (source)
password to be used during SASL authentication.
_configurationForTLS = (source)

Undocumented