C0urante commented on code in PR #12010:
URL: https://github.com/apache/kafka/pull/12010#discussion_r853538239


##########
clients/src/main/java/org/apache/kafka/common/config/internals/BrokerSecurityConfigs.java:
##########
@@ -89,4 +91,31 @@ public class BrokerSecurityConfigs {
             + "The broker will disconnect any such connection that is not 
re-authenticated within the session lifetime and that is then subsequently "
             + "used for any purpose other than re-authentication. 
Configuration names can optionally be prefixed with listener prefix and SASL "
             + "mechanism name in lower-case. For example, 
listener.name.sasl_ssl.oauthbearer.connections.max.reauth.ms=3600000";
+
+    public static class SaslEnabledMechanismsValidator implements 
ConfigDef.Validator {
+        @Override
+        public void ensureValid(String name, Object value) {
+            if (value == null) {
+                throw new ConfigException(name, null, "entry must be non 
null");
+            }
+
+            @SuppressWarnings("unchecked")
+            List<String> mechanismStrings = (List) value;
+
+            if (mechanismStrings.isEmpty()) {
+                throw new ConfigException(name, null, "entry must be non-empty 
list");
+            }
+
+            mechanismStrings.forEach(mechanism -> {
+                if (mechanism == null || mechanism.isEmpty()) {

Review Comment:
   This is unnecessary; strings are [automatically 
trimmed](https://github.com/apache/kafka/blob/9c3f605fc78f297ecf5accdcdec18471c19cf7d6/clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java#L655)
 when parsed during validation.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to