You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/02/16 09:59:39 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #6837: Core, AWS: Allow disabling token refresh

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


##########
core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java:
##########
@@ -355,62 +357,52 @@ public static class AuthSession {
     private static final long MAX_REFRESH_WINDOW_MILLIS = 300_000; // 5 minutes
     private static final long MIN_REFRESH_WAIT_MILLIS = 10;
     private volatile Map<String, String> headers;
-    private volatile String token;
-    private volatile String tokenType;
-    private volatile Long expiresAtMillis;
-    private final String credential;
-    private final String scope;
-    private volatile boolean keepRefreshed = true;
+    private volatile AuthConfig config;
 
     /**
-     * @deprecated will be removed in 1.3.0; use {@link AuthSession#AuthSession(Map, String, String,
-     *     String, String)} instead.
+     * @deprecated will be removed in 1.3.0; use {@link AuthSession#AuthSession(Map, AuthConfig)}
+     *     instead.
      */
     @Deprecated
     public AuthSession(Map<String, String> baseHeaders, String token, String tokenType) {
-      this(baseHeaders, token, tokenType, null, OAuth2Properties.CATALOG_SCOPE);
+      this(baseHeaders, ImmutableAuthConfig.builder().token(token).tokenType(tokenType).build());

Review Comment:
   I considered that, but `keepRefreshed` is not carried over from one AuthSession to the other, thus being more error prone and difficult to understand when exactly `keepRefreshed` would have to be set. 
   We would end up having to carry over the `keepRefreshed` flag from one AuthSession to the next and that would require updating the constructor params. 
   I think long term having an `AuthConfig` makes it easier to reason about the configuration that is set. 



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