jcshepherd commented on code in PR #4427:
URL: https://github.com/apache/cassandra/pull/4427#discussion_r3042006599
##########
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)
+ {
+ return hasAuthenticator(clazz) ?
Optional.of(clazz.cast(authenticator)) : Optional.empty();
+ }
+
+ /**
+ * Sets the authenticator used by this node to authenticate clients.
+ */
public static void setAuthenticator(IAuthenticator authenticator)
{
DatabaseDescriptor.authenticator = authenticator;
}
+ /**
+ * Indicates if this node uses an authenticator that requires
authentication.
+ */
+ public static boolean isAuthenticationRequired()
+ {
+ return authenticator.requireAuthentication();
+ }
+
+ /**
+ * Indicates if this node is configured with an authenticator of the
specified type.
+ * @param clazz The class of the authenticator.
+ * @return True if this node has an authenticator of the specified type,
false otherwise.
+ */
+ private static boolean hasAuthenticator(Class<? extends IAuthenticator>
clazz)
Review Comment:
Yes, I think it is, and I believe it goes away in next PR.
--
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]