Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pyAMQP] Remove duplicate sasl #25321

Merged
Merged
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
26 changes: 0 additions & 26 deletions sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/sasl.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,6 @@ def _negotiate(self):
else:
raise ValueError("SASL negotiation failed.\nOutcome: {}\nDetails: {}".format(*fields))

class SASLTransportMixin():
def _negotiate(self):
self.write(SASL_HEADER_FRAME)
_, returned_header = self.receive_frame()
if returned_header[1] != SASL_HEADER_FRAME:
raise ValueError("Mismatching AMQP header protocol. Expected: {}, received: {}".format(
SASL_HEADER_FRAME, returned_header[1]))

_, supported_mechansisms = self.receive_frame(verify_frame_type=1)
if self.credential.mechanism not in supported_mechansisms[1][0]: # sasl_server_mechanisms
raise ValueError("Unsupported SASL credential type: {}".format(self.credential.mechanism))
sasl_init = SASLInit(
mechanism=self.credential.mechanism,
initial_response=self.credential.start(),
hostname=self.host)
self.send_frame(0, sasl_init, frame_type=_SASL_FRAME_TYPE)

_, next_frame = self.receive_frame(verify_frame_type=1)
frame_type, fields = next_frame
if frame_type != 0x00000044: # SASLOutcome
raise NotImplementedError("Unsupported SASL challenge")
if fields[0] == SASLCode.Ok: # code
return
else:
raise ValueError("SASL negotiation failed.\nOutcome: {}\nDetails: {}".format(*fields))


class SASLTransport(SSLTransport, SASLTransportMixin):

Expand Down