Esempio n. 1
0
 def _handle_success(self, stanza):
     """SASL authentication succeeded. Restart the stream."""
     self.attempted_mechs = set()
     self.xmpp.authenticated = True
     self.xmpp.features.add('mechanisms')
     self.xmpp.event('auth_success', stanza, direct=True)
     raise RestartStream()
Esempio n. 2
0
    def _handle_tls_start(self, xml):
        """
        Handle encrypting the stream using TLS.

        Restarts the stream.
        """
        log.debug("Starting TLS")
        if self.start_tls():
            raise RestartStream()
Esempio n. 3
0
    def _handle_auth_success(self, xml):
        """
        SASL authentication succeeded. Restart the stream.

        Arguments:
            xml -- The SASL authentication success element.
        """
        self.authenticated = True
        self.features = []
        raise RestartStream()
Esempio n. 4
0
 def _handle_success(self, stanza):
     """SASL authentication succeeded. Restart the stream."""
     try:
         final = self.mech.process(stanza['value'])
     except sasl.SASLMutualAuthFailed:
         log.error("Mutual authentication failed! " + \
                   "A security breach is possible.")
         self.attempted_mechs.add(self.mech.name)
         self.xmpp.disconnect()
     else:
         self.attempted_mechs = set()
         self.xmpp.authenticated = True
         self.xmpp.features.add('mechanisms')
         self.xmpp.event('auth_success', stanza, direct=True)
         raise RestartStream()
Esempio n. 5
0
 def _handle_starttls_proceed(self, proceed):
     """Restart the XML stream when TLS is accepted."""
     log.debug("Starting TLS")
     if self.xmpp.start_tls():
         self.xmpp.features.add('starttls')
         raise RestartStream()
Esempio n. 6
0
 def _handle_success(self, stanza):
     """SASL authentication succeeded. Restart the stream."""
     self.xmpp.authenticated = True
     self.xmpp.features.add('mechanisms')
     raise RestartStream()
Esempio n. 7
0
 def _handle_compressed(self, stanza):
     self.xmpp.features.add('compression')
     log.debug('Stream Compressed!')
     compressed_socket = ZlibSocket(self.xmpp.socket)
     self.xmpp.set_socket(compressed_socket)
     raise RestartStream()