sarutak commented on code in PR #57387:
URL: https://github.com/apache/spark/pull/57387#discussion_r3665816857
##########
core/src/main/java/org/apache/spark/security/CredentialProviderLoader.java:
##########
@@ -221,10 +223,38 @@ private static List<CredentialProvider> loadProviders() {
return result;
}
+ /**
+ * Discovers all URI schemes supported by providers on the classpath.
+ * <p>
+ * This method queries all discovered {@link CredentialProvider} instances
and collects
+ * their {@link CredentialProvider#supportedSchemes()} into a single set.
Unlike
+ * {@link #providerFor(String, Map)}, this does not initialize providers or
apply
+ * explicit selection rules -- it only reports what schemes are potentially
available.
+ * <p>
+ * Intended for use by {@code UserCredentialManager} when no explicit scheme
configuration
+ * (e.g., {@code spark.security.credentials.provider.<scheme>}) is provided.
+ *
+ * @return a set of all supported scheme names (lowercased), possibly empty
+ */
+ public static Set<String> discoverAllSchemes() {
+ List<CredentialProvider> providers = getProviders();
+ Set<String> schemes = new java.util.HashSet<>();
+ for (CredentialProvider provider : providers) {
+ Set<String> providerSchemes = provider.supportedSchemes();
+ if (providerSchemes != null) {
Review Comment:
Added a note to the `discoverAllSchemes()` Javadoc: "Providers returning
{@code null} from {@code supportedSchemes()} are silently skipped (unlike
{@code providerFor}, which throws)."
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]