showuon commented on code in PR #12179:
URL: https://github.com/apache/kafka/pull/12179#discussion_r881686465


##########
clients/src/main/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticator.java:
##########
@@ -681,8 +681,8 @@ else if (connectionsMaxReauthMs == null)
                 else
                     retvalSessionLifetimeMs = zeroIfNegative(
                             Math.min(credentialExpirationMs - 
authenticationEndMs, connectionsMaxReauthMs));
-                if (retvalSessionLifetimeMs > 0L)
-                    sessionExpirationTimeNanos = authenticationEndNanos + 1000 
* 1000 * retvalSessionLifetimeMs;
+
+                sessionExpirationTimeNanos = authenticationEndNanos + 1000 * 
1000 * retvalSessionLifetimeMs;

Review Comment:
   After some investigation, I found the `null` value is indicating the re-auth 
is disabled:
   
https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java#L535-L543
   
   So, maybe here, we should make sure we need re-auth (that is, we did have 
expiration time, if it's 0, which means it's expired, not re-auth disabled). ex:
   
   ```java
   if (retvalSessionLifetimeMs > 0L || credentialExpirationMs || 
connectionsMaxReauthMs)
                       sessionExpirationTimeNanos = authenticationEndNanos + 
1000 * 1000 * retvalSessionLifetimeMs;
   ```
   
   Does that make sense?



-- 
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]

Reply via email to