Skip to content

Commit

Permalink
removing duplicate (#25321)
Browse files Browse the repository at this point in the history
  • Loading branch information
l0lawrence authored Jul 20, 2022
1 parent edfbb30 commit 4b20768
Showing 1 changed file with 0 additions and 26 deletions.
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

0 comments on commit 4b20768

Please sign in to comment.