diqiu50 commented on code in PR #10081:
URL: https://github.com/apache/gravitino/pull/10081#discussion_r3208604114


##########
catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/JdbcCatalog.java:
##########
@@ -113,4 +118,26 @@ public PropertiesMetadata schemaPropertiesMetadata() 
throws UnsupportedOperation
   public PropertiesMetadata tablePropertiesMetadata() throws 
UnsupportedOperationException {
     return TABLE_PROPERTIES_META;
   }
+
+  @Override
+  public Map<String, String> propertiesWithCredentialProviders() {
+    Map<String, String> properties = 
Maps.newHashMap(super.propertiesWithCredentialProviders());
+    return buildCredentialProvidersIfNecessary(properties);
+  }
+
+  private Map<String, String> buildCredentialProvidersIfNecessary(Map<String, 
String> properties) {
+    // If credential providers already set, return as is
+    if 
(StringUtils.isNotBlank(properties.get(CredentialConstants.CREDENTIAL_PROVIDERS)))
 {
+      return properties;
+    }
+
+    // Add JDBC credential provider if jdbc-user and jdbc-password are set
+    String jdbcUser = properties.get(JdbcConfig.USERNAME.getKey());
+    String jdbcPassword = properties.get(JdbcConfig.PASSWORD.getKey());
+    if (StringUtils.isNotBlank(jdbcUser) && 
StringUtils.isNotBlank(jdbcPassword)) {
+      properties.put(CredentialConstants.CREDENTIAL_PROVIDERS, 
JdbcCredential.JDBC_CREDENTIAL_TYPE);
+    }

Review Comment:
   The JDBC catalog does not need more



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