twisted.protocols.xmlstream.Authenticator

Package twisted :: Package protocols :: Module xmlstream :: Class Authenticator |
[frames | no frames]

## Class Authenticator

Known Subclasses:
  `ConnectAuthenticator`, `ListenComponentAuthenticator`

Base class for business logic of authenticating an XmlStream

Subclass this object to enable an XmlStream to authenticate to different types of stream hosts (such as clients, components, etc.).

Rules:

1. The Authenticator MUST dispatch a `STREAM_AUTHD_EVENT` when the stream has been completely authenticated.
2. The Authenticator SHOULD reset all state information when `associateWithStream` is called.
3. The Authenticator SHOULD override `streamStarted`, and start authentication there.

Method Summary
| `__init__(self, streamHost)`
| ``associateWithStream`(self, xmlstream)` Called by the XmlStreamFactory when a connection has been made to the requested peer, and an XmlStream object has been instantiated.
| ``connectionMade`(self)` Called by the XmlStream when the underlying socket connection is in place.
| ``streamStarted`(self, rootelem)` Called by the XmlStream when it has received a root element from the connected peer.

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

Class Variable Summary
`str` | `namespace`: Default namespace for the XmlStream
`int` | `version`: Version attribute for XmlStream.

Method Details

### associateWithStream(self, xmlstream) Called by the XmlStreamFactory when a connection has been made to the requested peer, and an XmlStream object has been instantiated. The default implementation just saves a handle to the new XmlStream. Parameters: `xmlstream` - The XmlStream that will be passing events to this Authenticator. (type=`XmlStream`)

### connectionMade(self) Called by the XmlStream when the underlying socket connection is in place. This allows the Authenticator to send an initial root element, if it's connecting, or wait for an inbound root from the peer if it's accepting the connection Subclasses can use self.xmlstream.send() with the provided xmlstream parameter to send any initial data to the peer

### 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`)

Instance Variable Details

### streamHost Target host for this stream (used as the 'to' attribute) Type: `str`

### xmlstream The XmlStream that needs authentication Type: `XmlStream`

Class Variable Details

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

    ### version Version attribute for XmlStream. 0.0 will cause the XmlStream to not include a `version` attribute in the header. Type: `int` Value:
        0.0

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