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


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -204,73 +185,51 @@ private AuthSession authSession() {
     String token = token().get();
     if (null != token) {
       return authSessionCache()
-          .get(
+          .cachedSession(
               token,
-              id ->
-                  AuthSession.fromAccessToken(
-                      httpClient(),
-                      tokenRefreshExecutor(),
-                      token,
-                      expiresAtMillis(properties()),
-                      new AuthSession(
-                          ImmutableMap.of(),
-                          AuthConfig.builder()
-                              .token(token)
-                              .credential(credential())
-                              .scope(SCOPE)
-                              .oauth2ServerUri(oauth2ServerUri())
-                              .optionalOAuthParams(optionalOAuthParams())
-                              .build())));
+              () -> {
+                Map<String, String> properties =
+                    ImmutableMap.<String, String>builder()
+                        .putAll(properties())
+                        .putAll(optionalOAuthParams())
+                        .put(OAuth2Properties.OAUTH2_SERVER_URI, 
oauth2ServerUri())
+                        .put(
+                            OAuth2Properties.TOKEN_REFRESH_ENABLED,
+                            String.valueOf(keepTokenRefreshed()))
+                        .put(OAuth2Properties.TOKEN, token)
+                        .put(OAuth2Properties.SCOPE, SCOPE)
+                        .buildKeepingLast();
+                return authManager().catalogSession(httpClient(), properties);

Review Comment:
   should there maybe be an override of this method that takes `AuthConfig` 
instead of `properties`? And `catalogSession(..., Map<String, String> 
properties)` could then always call `catalogSession(..., AuthConfig)`



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to