singhpk234 commented on code in PR #1164:
URL: https://github.com/apache/polaris/pull/1164#discussion_r2252203674


##########
service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java:
##########
@@ -397,16 +398,38 @@ public Response loadTable(
                     .loadTableIfStale(tableIdentifier, ifNoneMatch, snapshots)
                     .orElseThrow(() -> new 
WebApplicationException(Response.Status.NOT_MODIFIED));
           } else {
-            response =
+            String credentialsEndpoint =
+                String.format(
+                    "/v1/%s/namespaces/%s/tables/%s/credentials",
+                    prefix, tableIdentifier.namespace().toString(), 
tableIdentifier.name());
+            LoadTableResponse originalResponse =
                 catalog
                     .loadTableWithAccessDelegationIfStale(tableIdentifier, 
ifNoneMatch, snapshots)
                     .orElseThrow(() -> new 
WebApplicationException(Response.Status.NOT_MODIFIED));
+            if (delegationModes.contains(VENDED_CREDENTIALS)) {
+              response =
+                  injectRefreshVendedCredentialProperties(originalResponse, 
credentialsEndpoint);
+            } else {
+              response = originalResponse;
+            }
           }
 
           return tryInsertETagHeader(Response.ok(response), response, 
namespace, table).build();
         });
   }
 
+  private LoadTableResponse injectRefreshVendedCredentialProperties(
+      LoadTableResponse originalResponse, String credentialsEndpoint) {
+    LoadTableResponse.Builder loadResponseBuilder =
+        
LoadTableResponse.builder().withTableMetadata(originalResponse.tableMetadata());
+    loadResponseBuilder.addAllConfig(originalResponse.config());
+    loadResponseBuilder.addAllCredentials(originalResponse.credentials());
+    loadResponseBuilder.addConfig(
+        AwsClientProperties.REFRESH_CREDENTIALS_ENDPOINT, credentialsEndpoint);
+    
loadResponseBuilder.addConfig(AwsClientProperties.REFRESH_CREDENTIALS_ENABLED, 
"true");

Review Comment:
   ADLS also now supports creds refresh 



##########
service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java:
##########
@@ -397,16 +398,38 @@ public Response loadTable(
                     .loadTableIfStale(tableIdentifier, ifNoneMatch, snapshots)
                     .orElseThrow(() -> new 
WebApplicationException(Response.Status.NOT_MODIFIED));
           } else {
-            response =
+            String credentialsEndpoint =
+                String.format(
+                    "/v1/%s/namespaces/%s/tables/%s/credentials",
+                    prefix, tableIdentifier.namespace().toString(), 
tableIdentifier.name());

Review Comment:
   Agree the uri should be : 
   
   ```
     public String tableCredentials(TableIdentifier ident) {
       return SLASH.join(
           "v1",
           prefix,
           "namespaces",
           RESTUtil.encodeNamespace(ident.namespace()),
           "tables",
           RESTUtil.encodeString(ident.name()),
           "credentials");
     }
     ```



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

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

Reply via email to