yuqi1129 commented on code in PR #14755:
URL: https://github.com/apache/gravitino/pull/14755#discussion_r4560360884
##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/plugin/restcatalog/lance/LanceRESTCatalogProvider.java:
##########
@@ -63,6 +63,12 @@ public List<String> listCatalogs(String uri, Map<String,
String> catalogProperti
ApiClient apiClient = new ApiClient().setBasePath(normalizeUri(uri));
try (Closeable httpClient = getHttpClient(apiClient)) {
+ catalogProperties.forEach(
+ (key, value) -> {
+ if (StringUtils.startsWithIgnoreCase(key, "headers.")) {
+ apiClient.addDefaultHeader(key.substring("headers.".length()),
value);
Review Comment:
[Important] This also needs handling in the registration path. I reproduced
both duplicate Authorization headers on the discovery request with the pinned
ApiClient 0.7.5, and both global property keys surviving into the generated
SparkConf. `applyRegistrations` only checks the original per-catalog overrides;
it does not deduplicate global keys. `AuthenticationFilter` consumes the first
Authorization value, so conflicting values make the selected identity depend on
ordering.
Please normalize/validate header names consistently for discovery and
registration: collapse identical duplicates and reject conflicting values
without including credentials in the error. Preserve per-catalog override
priority, and cover both paths in tests. Fixing only this HTTP call would leave
the generated catalog configuration ambiguous.
##########
docs/spark-connector/spark-rest-catalog-discovery.md:
##########
@@ -79,6 +79,25 @@ Set
`spark.sql.gravitino.lanceREST.catalogProperties.namespaceDelimiter` when th
server uses a namespace delimiter other than the default `$`. The property is
used for the
discovery request and is also copied to each discovered catalog.
+### User identity
+
+When `spark.sql.gravitino.authType` is `simple` (the default), the discovery
plugin reuses
Review Comment:
[Important] An upgrade note should also cover the intended identity change
in auxiliary mode: requests that previously fell back to the Lance service user
can now run as `SparkContext.sparkUser()`. Existing default-simple jobs may
fail discovery or subsequent operations with 403 unless the Spark user is
registered and has the required grants; applicable create operations may also
have a different creator/owner.
The PR description already mentions identity propagation, but please
explicitly document permission preparation and how an explicit Authorization
header preserves the intended identity during migration. Keep the deployment
distinction clear: standalone mode still uses configured service credentials
for its Gravitino backend, so the owner/permission impact is not universal.
##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/plugin/restcatalog/GravitinoLakehouseRESTDiscoveryDriverPlugin.java:
##########
@@ -105,6 +116,18 @@ void initialize(SparkConf sparkConf, Map<String, String>
providerClassNames) {
validateProviderRuntime(provider, classLoader);
Map<String, String> globalProperties =
extractCatalogProperties(userConf, format);
+ if ("lance".equals(format)
+ && AuthProperties.isSimple(
Review Comment:
[Question] Please clarify whether the intended alignment with the connector
covers only the username source or also its Kerberos/simple policy, and add a
test for that choice. The regular connector rejects this combination, whereas
this branch generates a simple header when UGI security is enabled.
I would avoid copying the UGI guard unconditionally: a Kerberos-enabled
Spark application may legitimately call an independently configured simple-auth
Lance endpoint. Either document/test that supported combination, or guard
automatic simple-header generation according to the intended policy while
preserving explicit credentials. The placeholder password spelling itself does
not affect simple authentication; reusing the Basic prefix constant is
sufficient for that part.
--
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]