pvary commented on code in PR #13334:
URL: https://github.com/apache/iceberg/pull/13334#discussion_r2251666593


##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/PrefixedStorage.java:
##########
@@ -70,26 +71,12 @@ class PrefixedStorage implements AutoCloseable {
               // Explicitly allow "no credentials" for testing purposes
               builder.setCredentials(NoCredentials.getInstance());
             }
-            gcpProperties
-                .oauth2Token()
-                .ifPresent(
-                    token -> {
-                      // Explicitly configure an OAuth token
-                      AccessToken accessToken =
-                          new AccessToken(token, 
gcpProperties.oauth2TokenExpiresAt().orElse(null));
-                      if (gcpProperties.oauth2RefreshCredentialsEnabled()
-                          && 
gcpProperties.oauth2RefreshCredentialsEndpoint().isPresent()) {
-                        this.refreshHandler = 
OAuth2RefreshCredentialsHandler.create(properties);
-                        builder.setCredentials(
-                            OAuth2CredentialsWithRefresh.newBuilder()
-                                .setAccessToken(accessToken)
-                                .setRefreshHandler(refreshHandler)
-                                .build());
-                      } else {
-                        
builder.setCredentials(OAuth2Credentials.create(accessToken));
-                      }
-                    });
 
+            if (gcpProperties.oauth2Token().isPresent()) {
+              this.closeableGroup = new CloseableGroup();
+              builder.setCredentials(
+                  
GCPAuthUtils.oauth2CredentialsFromGcpProperties(gcpProperties, closeableGroup));
+            }

Review Comment:
   nit: newline after block



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