@@ -40,6 +40,10 @@ 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.
4347 if self ._is_authenticated :
4448 self ._is_done = True
4549 return self ._next_token or b''
@@ -70,12 +74,12 @@ def receive(self, auth_bytes):
7074 ]
7175 # add authorization identity to the response, and GSS-wrap
7276 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 we need to be able to identify when the final token is generated
75- # here we set _is_authenticated after receiving the final response,
76- # but wait until the final send (auth_bytes() call) to set _is_done.
77- # in practice we'll still receive a response when using SaslAuthenticate
78- # but not when using the prior unframed approach .
77+ # We need to identify the last token in auth_bytes();
78+ # we can't rely on client_ctx.complete because it becomes True after generating
79+ # the second-to-last token ( after calling .step(auth_bytes) for the final time)
80+ # We could introduce an additional state variable (i.e., self._final_token),
81+ # but instead we just set _is_authenticated. Since the plugin interface does
82+ # not read is_authenticated() until after is_done() is True, this should be fine .
7983 self ._is_authenticated = True
8084
8185 def is_done (self ):
0 commit comments