dongjoon-hyun commented on code in PR #57387:
URL: https://github.com/apache/spark/pull/57387#discussion_r3650952528
##########
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:
`providerFor` throws an `IllegalStateException` when a provider returns
`null` from `supportedSchemes()`, while this method silently skips such
providers. The javadoc explains the divergence on initialization and selection
rules, but not this one. If the leniency is intentional (a misbehaving
third-party provider shouldn't break auto-discovery), consider mentioning it in
the javadoc — e.g. "Providers returning null from supportedSchemes() are
skipped" — so the asymmetry with `providerFor` reads as deliberate rather than
accidental.
--
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]