FANNG1 commented on code in PR #5995:
URL: https://github.com/apache/gravitino/pull/5995#discussion_r1897718598


##########
core/src/main/java/org/apache/gravitino/credential/CredentialUtils.java:
##########
@@ -19,14 +19,74 @@
 
 package org.apache.gravitino.credential;
 
+import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
 import org.apache.gravitino.utils.PrincipalUtils;
 
 public class CredentialUtils {
+
+  private static final Splitter splitter = Splitter.on(",");
+
   public static Credential vendCredential(CredentialProvider 
credentialProvider, String[] path) {
     PathBasedCredentialContext pathBasedCredentialContext =
         new PathBasedCredentialContext(
             PrincipalUtils.getCurrentUserName(), ImmutableSet.copyOf(path), 
ImmutableSet.of());
     return credentialProvider.getCredential(pathBasedCredentialContext);
   }
+
+  public static Map<String, CredentialProvider> loadCredentialProviders(
+      Map<String, String> catalogProperties) {
+    Set<String> credentialProviders =
+        CredentialUtils.getCredentialProvidersByOrder(() -> catalogProperties);
+
+    return credentialProviders.stream()
+        .collect(
+            Collectors.toMap(
+                String::toString,
+                credentialType ->
+                    CredentialProviderFactory.create(credentialType, 
catalogProperties)));
+  }
+
+  /**
+   * Get Credential providers from properties supplier.
+   *
+   * <p>If there are multiple properties suppliers, will try to get the 
credential providers in the
+   * input order.
+   *
+   * @param propertiesSuppliers The properties suppliers.
+   * @return A set of credential providers.
+   */
+  public static Set<String> getCredentialProvidersByOrder(

Review Comment:
   not related



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