trnguyencflt opened a new pull request, #24202: URL: https://github.com/apache/kafka/pull/24202
When a SASL re-authentication is rejected because it changes the principal, `SaslServerAuthenticator` sets its state to `FAILED`, and the `Selector` delays closing the connection by `connection.failed.authentication.delay.ms`. Its `SaslServer` still reports itself complete, though. If the client sends more data before the close, `authenticate()` takes the `saslServer.isComplete()` shortcut and moves the state from `FAILED` to `COMPLETE`. This change skips that shortcut once the authentication has failed, so the connection stays failed until it is closed. Testing: added `SaslAuthenticatorTest#testDataAfterRejectedReauthenticationIsNotProcessed`. It fails without the change and passes with it. `testCannotReauthenticateWithDifferentPrincipal` still passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
