plugin XEP-0077: fixed "check_certificate" handling
This commit is contained in:
parent
5cc4890f0d
commit
4c5c6a081a
1 changed files with 9 additions and 4 deletions
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from twisted.words.protocols.jabber import jid, xmlstream, client, error as jabber_error
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.internet import defer, reactor, ssl
|
||||
from wokkel import data_form
|
||||
from sat.core.i18n import _
|
||||
from sat.core.constants import Const as C
|
||||
|
|
@ -64,9 +64,14 @@ class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
|
|||
xs.addObserver(xmlstream.STREAM_AUTHD_EVENT, self.register)
|
||||
|
||||
xs.initializers = [client.CheckVersionInitializer(xs)]
|
||||
tls_init = xmlstream.TLSInitiatingInitializer(xs)
|
||||
tls_init.required = False
|
||||
tls_init.check_certificate = self.check_certificate
|
||||
if self.check_certificate:
|
||||
tls_required, configurationForTLS = True, None
|
||||
else:
|
||||
tls_required = False
|
||||
configurationForTLS = ssl.CertificateOptions(trustRoot=None)
|
||||
tls_init = xmlstream.TLSInitiatingInitializer(
|
||||
xs, required=tls_required, configurationForTLS=configurationForTLS)
|
||||
|
||||
xs.initializers.append(tls_init)
|
||||
|
||||
def register(self, xmlstream):
|
||||
|
|
|
|||
Loading…
Reference in a new issue