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 != null || 
connectionsMaxReauthMs != null)
                       sessionExpirationTimeNanos = authenticationEndNanos + 
1000 * 1000 * retvalSessionLifetimeMs;
   ```
   So, if the `retvalSessionLifetimeMs==0`, and we don't have  credential 
expiration ms and connection max reauth ms, we should keep it as `null`
   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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to