nastra commented on code in PR #6489:
URL: https://github.com/apache/iceberg/pull/6489#discussion_r1072469640


##########
core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java:
##########
@@ -376,5 +450,201 @@ public Pair<Integer, TimeUnit> refresh(RESTClient client) 
{
 
       return null;
     }
+
+    private OAuthTokenResponse refreshCurrentToken(RESTClient client) {
+      if (isExpired(expiresAtMillis, System.currentTimeMillis())) {
+        // the token has already expired, attempt to refresh using the 
credential
+        return refreshExpiredToken(client);
+      } else {
+        // attempt a normal refresh
+        return refreshToken(client, headers(), token, tokenType, 
OAuth2Properties.CATALOG_SCOPE);
+      }
+    }
+
+    static boolean isExpired(Long expiresAtMillis, long now) {

Review Comment:
   thanks for bringing this up. I'll look into that as part of 
https://github.com/apache/iceberg/pull/6562



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to