-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reauthenticate SASL connections based on session lifetime
The broker response to a SASL authentication request can contain a maximum session lifetime (see the [KIP][kip]). Session lifetime is returned by the broker in [Version 1 SaslAuthenticate Response][sasl_authenticate_protocol]. When a SASL authentication callback returns `{ok, ServerResponse}` and the ServerResponse contains a larger than 0 session lifetime, kpro_connection automatically sets a timer to re-authenticate in half the session lifetime. As kpro_sasl mechanisms are synchronous, in-flight requests must first be drained to ensure that kpro_sasl receives a response to its own SASL request. The draining algorithm behaves as follows: * `sasl_authenticate` message handler adds the message onto the backlog and immediately flush the backlog if there are no in-flight requests. * `{From, {send, Request}}` handler adds the request onto the backlog if the backlog has any items to allow in-flight requests to drain. * Inbound message handler flushes the backlog if in-flight requests are empty. [kip]: https://cwiki.apache.org/confluence/display/KAFKA/KIP-368%3A+Allow+SASL+Connections+to+Periodically+Re-Authenticate [sasl_authenticate_protocol]: https://kafka.apache.org/protocol#The_Messages_SaslAuthenticate
- Loading branch information
1 parent
ca0bf49
commit 9f1e8cf
Showing
3 changed files
with
109 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters