Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
657433e
[#11263] feat(authz): Support credential vending for PostgreSQL, Dori…
diqiu50 May 27, 2026
8cf62b9
Remove redundant catalog credential ITs, covered by unit tests
diqiu50 May 27, 2026
5038385
Remove redundant TestPostgreSQLConnectorAdapter
diqiu50 May 27, 2026
6e1acd5
Remove redundant CREDENTIAL_PROVIDERS from SparkJdbcPostgreSqlCatalogIT
diqiu50 May 27, 2026
7623eb3
feat(authz): Support credential vending for Iceberg and Hive catalogs
diqiu50 May 28, 2026
6780c8c
refactor(authz): Extract shared cloud storage PropertyEntry definitio…
diqiu50 May 28, 2026
404e5b9
refactor(authz): Move credential vending logic to BaseCatalog templat…
diqiu50 May 28, 2026
e890843
refactor(authz): Use PropertiesMetadata hidden flag for credential ba…
diqiu50 May 28, 2026
ab7fbd8
fix(authz): Restore hiddenCredentialKeys() for targeted credential ba…
diqiu50 May 28, 2026
98ad634
refactor(authz): Implement credential backfill by merging properties(…
diqiu50 May 28, 2026
1048c25
refactor(authz): Simplify credential backfill and remove design doc
diqiu50 May 28, 2026
e942326
feat(authz): Add credential vending support for Glue catalog
diqiu50 May 28, 2026
a1e713a
fix(authz): Return empty credential for blank JDBC password instead o…
diqiu50 May 28, 2026
5f9cdc1
fix(authz): Use isBlank to guard empty JDBC password in credential pr…
diqiu50 May 28, 2026
31c3522
fix(authz): Allow empty string JDBC password in credential vending
diqiu50 May 28, 2026
80f14ca
refactor(authz): Migrate PaimonCatalog to addCatalogSpecificCredentia…
diqiu50 May 28, 2026
fe4017f
fix(authz): Use propertiesWithCredentialProviders in DynamicIcebergCo…
diqiu50 May 29, 2026
23e35cc
docs(authz): Add comment explaining propertiesWithCredentialProviders…
diqiu50 May 29, 2026
1215ac4
fix(authz): Enrich catalog properties with JDBC credentials in standa…
diqiu50 May 29, 2026
1de69dc
docs(authz): Improve comment in DynamicIcebergConfigProvider explaini…
diqiu50 May 29, 2026
cea3c9a
feat(authz): Add credential vending support to Flink, Spark, and Trin…
diqiu50 Jun 1, 2026
1ef9b0f
Merge origin/main into cv-pg, resolve import conflicts in Flink Hive …
diqiu50 Jun 2, 2026
e088ba1
fix(authz): Ensure PROPERTY_IN_USE default is preserved when credenti…
diqiu50 Jun 2, 2026
fee54ad
Fix trino iceberg issues
diqiu50 Jun 9, 2026
d700a9c
Merge remote-tracking branch 'origin/main' into cv-pg
diqiu50 Jun 9, 2026
fd10936
feat(authz): Add credential vending support to Glue catalog and Spark…
diqiu50 Jun 9, 2026
15e215b
improvement(authz): Hide credential key IDs and extract string consta…
diqiu50 Jun 9, 2026
ac6166e
test(authz): Add unit tests for GravitinoGlueCatalog credential vending
diqiu50 Jun 9, 2026
d14dd97
Merge remote-tracking branch 'origin/main' into cv-pg
diqiu50 Jun 9, 2026
018a35f
fix(flink): Remove duplicate open() in GravitinoPaimonCatalog after m…
diqiu50 Jun 9, 2026
2f19361
fix(core): Restore null check for GravitinoEnv.config() in shouldBack…
diqiu50 Jun 9, 2026
cc3034c
Merge remote-tracking branch 'upstream/main' into cv-pg
diqiu50 Jun 9, 2026
ee7376d
fix(test): Fix BasicAuthOperationsIT failing with System.exit when si…
diqiu50 Jun 9, 2026
d26c2d3
Merge remote-tracking branch 'upstream/main' into cv-pg
diqiu50 Jun 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ private Map<String, String> applyDefaultCredentialProviders(Map<String, String>

String jdbcUser = properties.get(JdbcConfig.USERNAME.getKey());
String jdbcPassword = properties.get(JdbcConfig.PASSWORD.getKey());
if (StringUtils.isNotBlank(jdbcUser) && StringUtils.isNotBlank(jdbcPassword)) {
// Register provider when user is configured; allow empty-string password (e.g. StarRocks
// default). Only skip when password is absent (null) entirely without a user.
if (StringUtils.isNotBlank(jdbcUser) && jdbcPassword != null) {
properties.put(CredentialConstants.CREDENTIAL_PROVIDERS, JdbcCredential.JDBC_CREDENTIAL_TYPE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,38 @@ void testJdbcCatalogDefaultCredentialProviders() {
Assertions.assertEquals(JdbcCredential.JDBC_CREDENTIAL_TYPE, credentialProviders);
}

@Test
void testJdbcCatalogDefaultCredentialProvidersWithEmptyPassword() {
AuditInfo auditInfo =
AuditInfo.builder().withCreator("creator").withCreateTime(Instant.now()).build();

// Empty-string password (e.g. StarRocks default) should still register the credential provider
Map<String, String> jdbcProps = Maps.newHashMap();
jdbcProps.put(JdbcConfig.JDBC_URL.getKey(), "jdbc:mysql://localhost:9030/");
jdbcProps.put(JdbcConfig.JDBC_DRIVER.getKey(), "com.mysql.cj.jdbc.Driver");
jdbcProps.put(JdbcConfig.USERNAME.getKey(), "root");
jdbcProps.put(JdbcConfig.PASSWORD.getKey(), "");

CatalogEntity jdbcEntity =
CatalogEntity.builder()
.withId(7L)
.withName("jdbc-catalog-empty-password")
.withNamespace(Namespace.of("metalake"))
.withType(TestableJdbcCatalog.Type.RELATIONAL)
.withProvider("jdbc-starrocks")
.withAuditInfo(auditInfo)
.withProperties(jdbcProps)
.build();

TestableJdbcCatalog jdbcCatalog = new TestableJdbcCatalog();
jdbcCatalog.withCatalogConf(jdbcProps).withCatalogEntity(jdbcEntity);
Map<String, String> properties = jdbcCatalog.propertiesWithCredentialProviders();

String credentialProviders = properties.get(CredentialConstants.CREDENTIAL_PROVIDERS);
Assertions.assertNotNull(credentialProviders);
Assertions.assertEquals(JdbcCredential.JDBC_CREDENTIAL_TYPE, credentialProviders);
}

@Test
void testJdbcCatalogNoCredentialProvidersWithoutPassword() {
AuditInfo auditInfo =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String credentialType() {
@Nullable
@Override
public Credential getCredential(CredentialContext context) {
if (StringUtils.isBlank(jdbcUser) || StringUtils.isBlank(jdbcPassword)) {
if (StringUtils.isBlank(jdbcUser) || jdbcPassword == null) {
Comment thread
diqiu50 marked this conversation as resolved.
return null;
}
return new JdbcCredential(jdbcUser, jdbcPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import com.google.common.collect.Maps;
import java.util.Map;
import org.apache.gravitino.credential.CredentialConstants;
import org.apache.gravitino.credential.JdbcCredential;
import org.apache.gravitino.integration.test.container.ContainerSuite;
import org.apache.gravitino.spark.connector.integration.test.SparkCommonIT;
import org.apache.gravitino.spark.connector.integration.test.util.SparkTableInfoChecker;
Expand Down Expand Up @@ -115,6 +117,8 @@ protected Map<String, String> getCatalogConfigs() {
catalogProperties.put(JdbcPropertiesConstants.GRAVITINO_JDBC_DRIVER, this.pgDriver);
catalogProperties.put(
JdbcPropertiesConstants.GRAVITINO_JDBC_DATABASE, PG_CATALOG_PG_IT.toString());
catalogProperties.put(
CredentialConstants.CREDENTIAL_PROVIDERS, JdbcCredential.JDBC_CREDENTIAL_TYPE);
return catalogProperties;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.gravitino.trino.connector.catalog.jdbc.postgresql;

import java.util.Collections;
import java.util.Map;
import org.apache.gravitino.credential.Credential;
import org.apache.gravitino.credential.JdbcCredential;
import org.apache.gravitino.trino.connector.catalog.jdbc.JDBCCatalogPropertyConverter;
import org.apache.gravitino.trino.connector.metadata.GravitinoCatalog;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/** Unit tests for {@link PostgreSQLConnectorAdapter#buildInternalConnectorConfig}. */
public class TestPostgreSQLConnectorAdapter {
Comment thread
diqiu50 marked this conversation as resolved.
Outdated

private static final String JDBC_URL = "jdbc:postgresql://localhost:5432/";

private GravitinoCatalog catalogWithProps(Map<String, String> props) {
return new GravitinoCatalog("metalake", "jdbc-postgresql", "test", props, 0L);
}

@Test
void testCredentialVendingOverridesProperties() throws Exception {
GravitinoCatalog catalog = catalogWithProps(Collections.singletonMap("jdbc-url", JDBC_URL));
Credential[] credentials = {new JdbcCredential("vended-user", "vended-password")};

Map<String, String> config =
new PostgreSQLConnectorAdapter().buildInternalConnectorConfig(catalog, credentials);

Assertions.assertEquals(
"vended-user", config.get(JDBCCatalogPropertyConverter.JDBC_CONNECTION_USER_KEY));
Assertions.assertEquals(
"vended-password", config.get(JDBCCatalogPropertyConverter.JDBC_CONNECTION_PASSWORD_KEY));
}

@Test
void testFallsBackToPropertiesWhenNoCredentials() throws Exception {
Map<String, String> props =
Map.of("jdbc-url", JDBC_URL, "jdbc-user", "prop-user", "jdbc-password", "prop-password");
GravitinoCatalog catalog = catalogWithProps(props);

Map<String, String> config =
new PostgreSQLConnectorAdapter().buildInternalConnectorConfig(catalog, new Credential[0]);

Assertions.assertEquals(
"prop-user", config.get(JDBCCatalogPropertyConverter.JDBC_CONNECTION_USER_KEY));
Assertions.assertEquals(
"prop-password", config.get(JDBCCatalogPropertyConverter.JDBC_CONNECTION_PASSWORD_KEY));
}
}
Loading