@@ -40,6 +40,10 @@ def __init__(self, **config):
40
40
self ._next_token = self ._client_ctx .step (None )
41
41
42
42
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.
43
47
if self ._is_authenticated :
44
48
self ._is_done = True
45
49
return self ._next_token or b''
@@ -70,12 +74,12 @@ def receive(self, auth_bytes):
70
74
]
71
75
# add authorization identity to the response, and GSS-wrap
72
76
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 .
79
83
self ._is_authenticated = True
80
84
81
85
def is_done (self ):
0 commit comments