Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion aioxmpp/security_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
import OpenSSL.SSL

import aiosasl
import aiosasl.channel_binding_methods

from . import errors, sasl, nonza, xso, protocol
from .utils import namespaces
Expand Down Expand Up @@ -964,6 +965,18 @@ def credential_provider():
classes = [
aiosasl.SCRAM
]

cb_provider = None
if hasattr(aiosasl, "SCRAMPLUS"):
if tls_transport is not None:
cb_provider = aiosasl.channel_binding_methods.TLSUnique(
tls_transport.get_extra_info("ssl_object")
)
classes.insert(
0,
aiosasl.SCRAMPLUS,
)

if tls_transport is not None:
classes.append(aiosasl.PLAIN)

Expand All @@ -975,7 +988,10 @@ def credential_provider():
if mechanism_class is None:
return False

mechanism = mechanism_class(credential_provider)
if issubclass(mechanism_class, aiosasl.SCRAMPLUS):
mechanism = mechanism_class(credential_provider, cb_provider)
else:
mechanism = mechanism_class(credential_provider)
last_auth_error = None
for nattempt in range(self._max_auth_attempts):
try:
Expand Down