collado-mike commented on code in PR #3409:
URL: https://github.com/apache/polaris/pull/3409#discussion_r2789333063


##########
runtime/service/src/main/java/org/apache/polaris/service/storage/StorageConfiguration.java:
##########
@@ -87,16 +121,25 @@ default Supplier<StsClient> stsClientSupplier(boolean 
withCredentials) {
   }
 
   default AwsCredentialsProvider stsCredentials() {
-    if (awsAccessKey().isPresent() && awsSecretKey().isPresent()) {
+    if (aws().accessKey().isPresent() && aws().secretKey().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()));
+          AwsBasicCredentials.create(aws().accessKey().get(), 
aws().secretKey().get()));
     } else {
       return DefaultCredentialsProvider.builder().build();
     }
   }
 
+  default AwsCredentialsProvider stsCredentials(String storageName) {
+    if (storageName != null && aws().storages().containsKey(storageName)) {
+      StorageConfig storageConfig = aws().storages().get(storageName);
+      return StaticCredentialsProvider.create(
+          AwsBasicCredentials.create(storageConfig.accessKey(), 
storageConfig.secretKey()));
+    }
+    return stsCredentials();

Review Comment:
   This seems wrong - if the storage name was passed explicitly, why do we fall 
back on the default credentials? Seems we should throw here.



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