Skip to content

Commit 86c9080

Browse files
committed
Fix sasl gssapi plugin: set _is_done after generating final message
1 parent 78b9ee1 commit 86c9080

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kafka/sasl/gssapi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ def __init__(self, **config):
3939
self._next_token = self._client_ctx.step(None)
4040

4141
def auth_bytes(self):
42-
# GSSAPI Auth does not have a final broker->client message
43-
# so mark is_done after the final auth_bytes are provided
44-
# in practice we'll still receive a response when using SaslAuthenticate
45-
# but not when using the prior unframed approach.
46-
if self._client_ctx.complete:
47-
self._is_done = True
42+
if self._is_done:
4843
self._is_authenticated = True
4944
return self._next_token or b''
5045

@@ -74,6 +69,11 @@ def receive(self, auth_bytes):
7469
]
7570
# add authorization identity to the response, and GSS-wrap
7671
self._next_token = self._client_ctx.wrap(b''.join(message_parts), False).message
72+
# GSSAPI Auth does not have a final broker->client message
73+
# so mark is_done after the final token is generated
74+
# in practice we'll still receive a response when using SaslAuthenticate
75+
# but not when using the prior unframed approach.
76+
self._is_done = True
7777

7878
def is_done(self):
7979
return self._is_done

0 commit comments

Comments
 (0)