jcshepherd commented on code in PR #4427:
URL: https://github.com/apache/cassandra/pull/4427#discussion_r3042004156
##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -2037,16 +2010,52 @@ public static void
setCryptoProvider(AbstractCryptoProvider cryptoProvider)
DatabaseDescriptor.cryptoProvider = cryptoProvider;
}
+ /**
+ * Returns the authenticator configured for this node.
+ */
public static IAuthenticator getAuthenticator()
{
return authenticator;
}
+ /**
+ * Returns an authenticator configured for this node, if it is of the
requested type.
+ * @param clazz The class of the requested authenticator: e.g.
PasswordAuthenticator.class.
+ * @return An Optional of the configured authenticator, if it is of the
requested type; otherwise
+ * returns an empty Optional.
+ */
+ public static <T extends IAuthenticator> Optional<T>
getAuthenticator(Class<T> clazz)
Review Comment:
Correct. There were several places in the code like `if
(DatabaseDescriptor.getAuthenticator() instanceof PasswordAuthenticator) { ...
}` : assuming there was one and only one authenticator. In places where this
logic exists, having the caller ask "is PasswordAuthenticator one of the
authenticators this node uses" works without assuming that
PasswordAuthenticator is the only authenticator.
--
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]