roryqi commented on code in PR #9785:
URL: https://github.com/apache/gravitino/pull/9785#discussion_r2787801349
##########
core/src/main/java/org/apache/gravitino/credential/CredentialProviderFactory.java:
##########
@@ -44,6 +46,24 @@ public static CredentialProvider create(
}
}
+ /**
+ * Looks up all sensitive property keys from all registered credential
providers.
+ *
+ * @return A set of all sensitive property keys used by credential providers.
+ */
+ public static Set<String> lookupSensitivePropertyKeys() {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ ServiceLoader<CredentialProvider> serviceLoader =
+ ServiceLoader.load(CredentialProvider.class, classLoader);
+
+ Set<String> allPropertyKeys = new HashSet<>();
+ for (CredentialProvider provider : serviceLoader) {
+ Set<String> providerPropertyKeys = provider.sensitivePropertyKeys();
+ allPropertyKeys.addAll(providerPropertyKeys);
+ }
Review Comment:
If the provider isn't initialized correctly, it should throw an exception
first.
--
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]