jcshepherd commented on code in PR #4427:
URL: https://github.com/apache/cassandra/pull/4427#discussion_r2430311949


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -1959,16 +1959,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.
+     */

Review Comment:
   In the future, the semantics will change from "'The' authenticator requires 
authentication" to "Any supported authenticator requires authentication." 
Existing callers to this method should be unaffected by that change.



-- 
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]

Reply via email to