You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/10/02 00:39:28 UTC

[GitHub] [geode] jchen21 commented on a change in pull request #6927: GEODE-9663: throw and handle AuthenticationExpiredException at login time

jchen21 commented on a change in pull request #6927:
URL: https://github.com/apache/geode/pull/6927#discussion_r720596318



##########
File path: geode-core/src/main/java/org/apache/geode/cache/client/internal/AuthenticateUserOp.java
##########
@@ -176,13 +177,29 @@ protected InternalDistributedSystem getConnectedSystem() {
 
     @Override
     public Object attempt(Connection connection) throws Exception {
-      if (connection.getServer().getRequiresCredentials()) {
-        return super.attempt(connection);
-      } else {
+      if (!connection.getServer().getRequiresCredentials()) {
         return null;
       }
+
+      try {
+        return parentAttempt(connection);
+      }
+      // if login failed for auth expired reason, try again once more
+      catch (AuthenticationExpiredException first) {
+        getMessage().clear();
+        try {
+          return parentAttempt(connection);
+        } catch (AuthenticationExpiredException second) {
+          throw new AuthenticationFailedException(second.getMessage(), second);
+        }
+      }
+    }
+
+    Object parentAttempt(Connection connection) throws Exception {

Review comment:
       `@VisibleForTesting`




-- 
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: notifications-unsubscribe@geode.apache.org

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