-
-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sasl configuration - refresh callback for runtime rediscovery #881
Conversation
I had actually completely forgot that I was involved in a similar effort a year back. I believe a good place to start is by reading https://cwiki.apache.org/confluence/display/KAFKA/KIP-368%3A+Allow+SASL+Connections+to+Periodically+Re-Authenticate, which was implemented in #496. Essentially, when we authenticate we get back a session lifetime in ms. If that amount of time (minus some threshold) has passed, In parallel, #445 tried to implement pretty much the same thing as this PR. In one of my comments from almost exactly a year ago, I mention the need to separate "getting the current credentials" and "renewing the credentials": #445 (comment) This is similar to how it's handled in the Java client (or in Java in general) through JAAS, where a The comment goes into the details of it, and I think it still stands. The reason being that with the current implementation, the credentials are only renewed when a new connection is created. If the connection already exists, the credentials will not be renewed. This means that it will not play nicely with KIP-368. So rather than evaluating |
Hi again, sorry for long delay. I've updated code so now the sasl update is evaluated in SASLAuthenticator.authenticate() method instead of only once inside connectionBuilder. I didn't go with the SASLProvider interface as having just refresh() callback function looked cleaner |
I see that the SASLOptions structure changes per authorization method... how should the rediscover API look like? Is it relevant for all methods or just scram/plain? |
I think lets close it for inactivity. Workaround is that you can keep reference to configuration .sasl data object and modify it on runtime. |
Hi,
This PR proposes to allow sasl credentials configuration parameter to be callback that returns same sasl options object.
The callback will be called every time a new
connection is establishedsasl authentication is executed, so it allows credentials to be changed during runtime and kafkajs will still reconnect.Same background as with #854
Example: