def test_initRequired(self): """ Passing required sets the instance variable. """ self.init = xmlstream.TLSInitiatingInitializer(self.xmlstream, required=True) self.assertTrue(self.init.required)
def associateWithStream(self, xs): xmlstream.ConnectAuthenticator.associateWithStream(self, xs) tlsInit = xmlstream.TLSInitiatingInitializer(xs) xs.initializers = [client.CheckVersionInitializer(xs), tlsInit, CheckAuthInitializer(xs)]
def associateWithStream(self, xs): xs.version = (0, 0) xmlstream.ConnectAuthenticator.associateWithStream(self, xs) xs.initializers = [ xmlstream.TLSInitiatingInitializer(xs, required=False), IQAuthInitializer(xs), ]
def setUp(self): self.output = [] self.done = [] self.savedSSL = xmlstream.ssl self.authenticator = xmlstream.Authenticator() self.xmlstream = xmlstream.XmlStream(self.authenticator) self.xmlstream.send = self.output.append self.xmlstream.connectionMade() self.xmlstream.dataReceived("<stream:stream xmlns='jabber:client' " "xmlns:stream='http://etherx.jabber.org/streams' " "from='example.com' id='12345' version='1.0'>") self.init = xmlstream.TLSInitiatingInitializer(self.xmlstream)
def associateWithStream(self, xs): """ Register with the XML stream. Populates stream's list of initializers, along with their requiredness. This list is used by L{ConnectAuthenticator.initializeStream} to perform the initialization steps. """ xmlstream.ConnectAuthenticator.associateWithStream(self, xs) xs.initializers = [ CheckVersionInitializer(xs), xmlstream.TLSInitiatingInitializer( xs, required=True, configurationForTLS=self._configurationForTLS), sasl.SASLInitiatingInitializer(xs, required=True), BindInitializer(xs, required=True), SessionInitializer(xs, required=False), ]
def test_certificateVerifyContext(self): """ A custom contextFactory is passed through to startTLS. """ ctx = CertificateOptions() self.init = xmlstream.TLSInitiatingInitializer(self.xmlstream, configurationForTLS=ctx) self.init.contextFactory = ctx def fakeStartTLS(contextFactory): self.assertIs(ctx, contextFactory) self.done.append("TLS") self.xmlstream.transport = proto_helpers.StringTransport() self.xmlstream.transport.startTLS = fakeStartTLS self.xmlstream.reset = lambda: self.done.append("reset") self.xmlstream.sendHeader = lambda: self.done.append("header") d = self.init.start() self.xmlstream.dataReceived("<proceed xmlns='%s'/>" % NS_XMPP_TLS) self.assertEqual(["TLS", "reset", "header"], self.done) return d
def associateWithStream(self, xs): xmlstream.ConnectAuthenticator.associateWithStream(self, xs) xs.initializers = [ xmlstream.TLSInitiatingInitializer(xs), RegisterInitializer(xs, self._jid_obj, self._password), ]