XJDKC commented on code in PR #1629:
URL: https://github.com/apache/polaris/pull/1629#discussion_r2105193191


##########
service/common/src/main/java/org/apache/polaris/service/storage/StorageConfiguration.java:
##########
@@ -61,21 +63,31 @@ public interface StorageConfiguration {
   Optional<Duration> gcpAccessTokenLifespan();
 
   default Supplier<StsClient> stsClientSupplier() {
+    return stsClientSupplier(true);
+  }
+
+  default Supplier<StsClient> stsClientSupplier(boolean withCredentials) {
     return Suppliers.memoize(
         () -> {
           StsClientBuilder stsClientBuilder = StsClient.builder();
-          if (awsAccessKey().isPresent() && awsSecretKey().isPresent()) {
-            LoggerFactory.getLogger(StorageConfiguration.class)
-                .warn("Using hard-coded AWS credentials - this is not 
recommended for production");
-            StaticCredentialsProvider awsCredentialsProvider =
-                StaticCredentialsProvider.create(
-                    AwsBasicCredentials.create(awsAccessKey().get(), 
awsSecretKey().get()));
-            stsClientBuilder.credentialsProvider(awsCredentialsProvider);
+          if (withCredentials) {
+            stsClientBuilder.credentialsProvider(stsCredentials());
           }
           return stsClientBuilder.build();
         });
   }
 
+  default AwsCredentialsProvider stsCredentials() {
+    if (awsAccessKey().isPresent() && awsSecretKey().isPresent()) {
+      LoggerFactory.getLogger(StorageConfiguration.class)
+          .warn("Using hard-coded AWS credentials - this is not recommended 
for production");
+      return StaticCredentialsProvider.create(
+          AwsBasicCredentials.create(awsAccessKey().get(), 
awsSecretKey().get()));
+    } else {
+      return DefaultCredentialsProvider.create();

Review Comment:
   Yes, I have a branch that's based on the proposal, and it's working. I'm 
trying to clean it and add more tests, then I will open a PR. Welcome to review 
the PR and leave your comments!
   https://github.com/XJDKC/polaris/tree/rxing-catalog-federation-sigv4-poc



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

Reply via email to