Skip to content

Commit e0104cb

Browse files
committed
Fix sasl gssapi plugin: set _is_done after generating final message
1 parent 30d839f commit e0104cb

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
@@ -40,12 +40,7 @@ def __init__(self, **config):
4040
self._next_token = self._client_ctx.step(None)
4141

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

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

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

0 commit comments

Comments
 (0)