trnguyencflt commented on code in PR #20258: URL: https://github.com/apache/kafka/pull/20258#discussion_r2278705352
########## clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslAuthenticatorTest.java: ########## @@ -1856,6 +1858,69 @@ public void testSslClientAuthRequiredOverriddenForSaslSslListener() throws Excep verifySslClientAuthForSaslSslListener(false, SslClientAuth.REQUIRED); } + @Test + public void testServerSidePendingSendDuringReauthentication() throws Exception { + SecurityProtocol securityProtocol = SecurityProtocol.SASL_PLAINTEXT; + TestJaasConfig jaasConfig = configureMechanisms("PLAIN", Collections.singletonList("PLAIN")); + jaasConfig.createOrUpdateEntry(TestJaasConfig.LOGIN_CONTEXT_SERVER, PlainLoginModule.class.getName(), new HashMap<>()); + jaasConfig.setClientOptions("PLAIN", TestServerCallbackHandler.USERNAME, TestServerCallbackHandler.PASSWORD); + String callbackPrefix = ListenerName.forSecurityProtocol(securityProtocol).saslMechanismConfigPrefix("PLAIN"); + saslServerConfigs.put(callbackPrefix + BrokerSecurityConfigs.SASL_SERVER_CALLBACK_HANDLER_CLASS_CONFIG, + TestServerCallbackHandler.class.getName()); + server = createEchoServer(securityProtocol); + + String node = "node1"; + try { + createClientConnection(securityProtocol, node); + NetworkTestUtils.waitForChannelReady(selector, node); + server.verifyAuthenticationMetrics(1, 0); + + /* + * Now start the reauthentication on the connection. First, we have to sleep long enough so + * that the next write will cause re-authentication + */ + delay((long) (CONNECTIONS_MAX_REAUTH_MS_VALUE * 1.1)); + server.verifyReauthenticationMetrics(0, 0); + + // block reauthentication to complete + TestServerCallbackHandler.sem.acquire(); + + String prefix = TestUtils.randomString(100); + // send a client request to start a reauthentication. + selector.send(new NetworkSend(node, ByteBufferSend.sizePrefixed(ByteBuffer.wrap((prefix + "-0").getBytes(StandardCharsets.UTF_8))))); Review Comment: do we expect to receive a response from server for this request? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org