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