adutra commented on code in PR #3729:
URL: https://github.com/apache/polaris/pull/3729#discussion_r2789518598
##########
spec/generated/bundled-polaris-catalog-service.yaml:
##########
@@ -168,7 +168,6 @@ paths:
parameters:
- $ref: '#/components/parameters/page-token'
- $ref: '#/components/parameters/page-size'
- - $ref: '#/components/parameters/prefix'
Review Comment:
Changes in this file seem unrelated. You probably re-generated it and it was
out of sync. I opened #3732 to fix this. But in any case, when changing the
management API spec only, you don't need to re-generate this file.
##########
polaris-core/src/main/java/org/apache/polaris/core/connection/GoogleAuthenticationParametersDpo.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.polaris.core.connection;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.annotation.Nonnull;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import org.apache.iceberg.CatalogProperties;
+import org.apache.iceberg.rest.auth.AuthProperties;
+import org.apache.polaris.core.admin.model.AuthenticationParameters;
+import org.apache.polaris.core.admin.model.GoogleAuthenticationParameters;
+import org.apache.polaris.core.credentials.PolarisCredentialManager;
+
+/**
+ * See {@link org.apache.iceberg.rest.RESTUtil#configHeaders(Map)} and {@link
+ * org.apache.iceberg.rest.auth.AuthManagers#loadAuthManager(String, Map)} for
why we do this.
+ */
+public class GoogleAuthenticationParametersDpo extends
AuthenticationParametersDpo {
+ private final String clientId;
+ private final String quotaProject;
+ private final String remoteWarehouseName;
+
+ public GoogleAuthenticationParametersDpo(
+ @JsonProperty(value = "clientId", required = true) @Nonnull String
clientId,
+ @JsonProperty(value = "quotaProject", required = true) @Nonnull String
quotaProject,
+ @JsonProperty(value = "remoteWarehouseName", required = true) @Nonnull
+ String remoteWarehouseName) {
+ super(AuthenticationType.GOOGLE.getCode());
+ this.clientId = clientId;
+ this.quotaProject = quotaProject;
+ this.remoteWarehouseName = remoteWarehouseName;
+ }
+
+ @Nonnull
+ @Override
+ public Map<String, String> asIcebergCatalogProperties(
+ PolarisCredentialManager credentialManager) {
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("header.x-goog-user-project", getQuotaProject());
+ properties.put("header.X-Iceberg-Access-Delegation", "vended-credentials");
Review Comment:
I'm not sure we should hard-code credentials vending here. This component
should focus solely on authentication parameters.
##########
polaris-core/src/main/java/org/apache/polaris/core/connection/ConnectionConfigInfoDpo.java:
##########
@@ -121,7 +121,7 @@ public AuthenticationParametersDpo
getAuthenticationParameters() {
return serviceIdentity;
}
- private static final ObjectMapper DEFAULT_MAPPER;
+ static final ObjectMapper DEFAULT_MAPPER;
Review Comment:
```suggestion
@VisibleForTesting static final ObjectMapper DEFAULT_MAPPER;
```
##########
spec/polaris-management-service.yml:
##########
@@ -977,6 +977,7 @@ components:
- BEARER
- SIGV4
- IMPLICIT
+ - GCP
Review Comment:
In `AuthenticationType` I see `GOOGLE` but here I see `GCP`. It would be
good to use one of these names consistently.
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergRESTExternalCatalogFactory.java:
##########
@@ -70,6 +78,18 @@ public Catalog createCatalog(
return federatedCatalog;
}
+ static Map<String, String> extraHeadersFrom(Map<String, String>
icebergCatalogProperties) {
Review Comment:
You can use `org.apache.iceberg.rest.RESTUtil#extractPrefixMap`
--
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]