dimas-b commented on code in PR #3734:
URL: https://github.com/apache/polaris/pull/3734#discussion_r2941563341


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -600,26 +600,50 @@ public LoadTableResponse createTableStaged(
    *
    * @param namespace The namespace to register the table in
    * @param request the register table request
+   * @param delegationModes the access delegation modes to use
+   * @param refreshCredentialsEndpoint the refresh credentials endpoint to use
    * @return ETagged {@link LoadTableResponse} to uniquely identify the table 
metadata
    */
-  public LoadTableResponse registerTable(Namespace namespace, 
RegisterTableRequest request) {
+  public LoadTableResponse registerTable(
+      Namespace namespace,
+      RegisterTableRequest request,
+      EnumSet<AccessDelegationMode> delegationModes,
+      Optional<String> refreshCredentialsEndpoint) {
+
+    request.validate();
     TableIdentifier identifier = TableIdentifier.of(namespace, request.name());
     boolean overwrite = request.overwrite();
 
+    Set<PolarisStorageActions> actionsRequested =
+        authorizeRegisterTable(identifier, delegationModes, overwrite);
+
     if (overwrite) {
-      authorizeCreateTableLikeUnderNamespaceOperationOrThrow(
-          PolarisAuthorizableOperation.REGISTER_TABLE_OVERWRITE, identifier);
-      return registerTableWithOverwrite(identifier, request);
+      return registerTableWithOverwrite(
+          identifier, request, delegationModes, actionsRequested, 
refreshCredentialsEndpoint);
     }
 
-    // Creating new table requires REGISTER_TABLE privilege
-    PolarisAuthorizableOperation op = 
PolarisAuthorizableOperation.REGISTER_TABLE;
-    authorizeCreateTableLikeUnderNamespaceOperationOrThrow(op, identifier);
-    return catalogHandlerUtils().registerTable(baseCatalog, namespace, 
request);
+    Table table = baseCatalog.registerTable(identifier, 
request.metadataLocation());
+
+    if (table instanceof BaseTable baseTable) {
+      TableMetadata tableMetadata = baseTable.operations().current();
+      return buildLoadTableResponseWithDelegationCredentials(

Review Comment:
   Could you add/update an integration test to ensure `registerTable` responses 
contain vended credentials now?



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