You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/12/23 13:44:18 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #6489: Core: Improve token exchange handling when token expires

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


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -159,22 +158,26 @@ public void initialize(String name, Map<String, String> unresolved) {
     // build the final configuration and set up the catalog's auth
     Map<String, String> mergedProps = config.merge(props);
     Map<String, String> baseHeaders = configHeaders(mergedProps);
-    this.catalogAuth = new AuthSession(baseHeaders, null, null);
-    if (authResponse != null) {
-      this.catalogAuth = newSession(authResponse, startTimeMillis, catalogAuth);
-    } else if (initToken != null) {
-      this.catalogAuth = newSession(initToken, expiresInMs(mergedProps), catalogAuth);
-    }
-
+    this.client = clientBuilder.apply(mergedProps);
     this.sessions = newSessionCache(mergedProps);
     this.refreshAuthByDefault =
         PropertyUtil.propertyAsBoolean(
             mergedProps,
             CatalogProperties.AUTH_DEFAULT_REFRESH_ENABLED,
             CatalogProperties.AUTH_DEFAULT_REFRESH_ENABLED_DEFAULT);
-    this.client = clientBuilder.apply(mergedProps);
     this.paths = ResourcePaths.forCatalogProperties(mergedProps);
 
+    this.catalogAuth = new AuthSession(baseHeaders, null, null);

Review Comment:
   these are mainly all refactorings that have been already done in https://github.com/apache/iceberg/pull/6169. This is so that the token refresh mechanism can be used both for the `RESTSessionCatalog` and the Signer client



-- 
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: issues-unsubscribe@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org