XJDKC commented on code in PR #3729: URL: https://github.com/apache/polaris/pull/3729#discussion_r2885538900
########## polaris-core/src/main/java/org/apache/polaris/core/connection/GcpAuthenticationParametersDpo.java: ########## @@ -0,0 +1,102 @@ +/* + * 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.GcpAuthenticationParameters; +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 GcpAuthenticationParametersDpo extends AuthenticationParametersDpo { + private final String quotaProject; + private final String remoteWarehouseName; + + public GcpAuthenticationParametersDpo( + @JsonProperty(value = "quotaProject", required = true) @Nonnull String quotaProject, + @JsonProperty(value = "remoteWarehouseName", required = true) @Nonnull + String remoteWarehouseName) { + super(AuthenticationType.GCP.getCode()); + this.quotaProject = quotaProject; Review Comment: Right now, `ServiceIdentityInfo` is used to store polaris service identity info. This object is generated by polaris itself actually and it's not provided by end users. Personally, I'm leaning toward following the Iceberg catalog properties as they are today. In the Iceberg SDK, there isn't a first-class property for project id, it's currently passed through the `header.x-goog-user-project`, even biglake's public doc follows this pattern. I'd also prefer not to mix BigLake-specific properties with authentication parameters since authentication is more generic, e.g., even for AWS Glue, we don't introduce a special class for it but implement a generic SigV4AuthenticationParameters. As I mentioned earlier, the project id is a property required by the BigLake IRC, but it's not an authentication parameter. Given that, my proposal would be: * Add an additional headers field in `IcebergRestConnectionConfigInfo`. * I think it's okay not to enforce checking the existence of this property when the target catalog is GCP. IcebergRestConnectionConfigInfo is designed to connect to any Iceberg REST–compliant catalog, so if a property is only required by a specific catalog, it shouldn't be validated generically at this layer. * Introduce `GcpAuthenticationParametersDpo`, but limit it to two fields for now that follows *GoogleAuthManager*, and don't rely on env variables to get these info: * `GCP_CREDENTIALS_PATH_PROPERTY`: if this property is not provided, it means that we will rely on gcp auth sdk to detect the gcp credentials from env * `GCP_SCOPES_PROPERTY` -- 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]
