Authenticator for accepting components.

Present Since8.2
Instance Variable secret The shared secret used to authorized incoming component connections. (type: unicode.)
Method __init__ Undocumented
Method associateWithStream Associate the authenticator with a stream.
Method streamStarted Called by the stream when it has started.
Method onElement Called on incoming XML Stanzas.
Method onHandshake Called upon receiving the handshake request.

Inherited from Authenticator (via ListenAuthenticator):

Instance Variable xmlstream The XmlStream that needs authentication (type: XmlStream)
Method connectionMade Called by the XmlStream when the underlying socket connection is in place.
secret =
The shared secret used to authorized incoming component connections. (type: unicode.)
def __init__(self, secret):
def associateWithStream(self, xs):

Associate the authenticator with a stream.

This sets the stream's version to 0.0, because the XEP-0114 component protocol was not designed for XMPP 1.0.

def streamStarted(self, rootElement):

Called by the stream when it has started.

This examines the default namespace of the incoming stream and whether there is a requested hostname for the component. Then it generates a stream identifier, sends a response header and adds an observer for the first incoming element, triggering onElement.

def onElement(self, element):

Called on incoming XML Stanzas.

The very first element received should be a request for handshake. Otherwise, the stream is dropped with a 'not-authorized' error. If a handshake request was received, the hash is extracted and passed to onHandshake.

def onHandshake(self, handshake):

Called upon receiving the handshake request.

This checks that the given hash in handshake is equal to a calculated hash, responding with a handshake reply or a stream error. If the handshake was ok, the stream is authorized, and XML Stanzas may be exchanged.

API Documentation for twisted, generated by pydoctor at 2020-03-25 17:34:30.