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


##########
core/src/main/java/org/apache/gravitino/credential/CatalogCredentialManager.java:
##########
@@ -51,6 +51,16 @@ public Credential getCredential(String credentialType, 
CredentialContext context
     return credentialCache.getCredential(credentialCacheKey, cacheKey -> 
doGetCredential(cacheKey));
   }
 
+  // Get credential with only one credential provider.
+  public Credential getCredential(CredentialContext context) {
+    if (credentialProviders.size() == 0) {
+      throw new RuntimeException("There are not any credential provider for 
the catalog.");
+    } else if (credentialProviders.size() > 1) {
+      throw new RuntimeException("There are multiple credential providers for 
the catalog.");
+    }
+    return getCredential(credentialProviders.keySet().iterator().next(), 
context);

Review Comment:
   updated



##########
core/src/main/java/org/apache/gravitino/credential/CatalogCredentialManager.java:
##########
@@ -51,6 +51,16 @@ public Credential getCredential(String credentialType, 
CredentialContext context
     return credentialCache.getCredential(credentialCacheKey, cacheKey -> 
doGetCredential(cacheKey));
   }
 
+  // Get credential with only one credential provider.
+  public Credential getCredential(CredentialContext context) {
+    if (credentialProviders.size() == 0) {
+      throw new RuntimeException("There are not any credential provider for 
the catalog.");

Review Comment:
   updated



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