singhpk234 commented on code in PR #2341: URL: https://github.com/apache/polaris/pull/2341#discussion_r2273916299
########## runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java: ########## @@ -420,16 +423,45 @@ public Response loadTable( .loadTableIfStale(tableIdentifier, ifNoneMatch, snapshots) .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_MODIFIED)); } else { - response = + LoadTableResponse originalResponse = catalog .loadTableWithAccessDelegationIfStale(tableIdentifier, ifNoneMatch, snapshots) .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_MODIFIED)); + + if (delegationModes.contains(VENDED_CREDENTIALS)) { + response = + injectRefreshVendedCredentialProperties( + originalResponse, + new PolarisResourcePaths(prefix).credentialsPath(tableIdentifier)); + } 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( Review Comment: what about azure ? do we want to do it in follow-up ? also should we only inject this when creds are for aws ? ########## runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java: ########## @@ -420,16 +423,45 @@ public Response loadTable( .loadTableIfStale(tableIdentifier, ifNoneMatch, snapshots) .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_MODIFIED)); } else { - response = + LoadTableResponse originalResponse = catalog .loadTableWithAccessDelegationIfStale(tableIdentifier, ifNoneMatch, snapshots) .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_MODIFIED)); + + if (delegationModes.contains(VENDED_CREDENTIALS)) { + response = + injectRefreshVendedCredentialProperties( + originalResponse, + new PolarisResourcePaths(prefix).credentialsPath(tableIdentifier)); + } 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()); Review Comment: do we need to update metadata-location too ? -- 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