This is an automated email from the ASF dual-hosted git repository.

lizhimin pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 40ca80ea90 [ISSUE #9741] Optimize authentication whitelist lookup 
efficiency (#9742)
40ca80ea90 is described below

commit 40ca80ea9055f7f8de97fa9f4146d39507d1f6cc
Author: yx9o <[email protected]>
AuthorDate: Mon Oct 13 13:53:02 2025 +0800

    [ISSUE #9741] Optimize authentication whitelist lookup efficiency (#9742)
---
 .../strategy/AbstractAuthenticationStrategy.java               | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/AbstractAuthenticationStrategy.java
 
b/auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/AbstractAuthenticationStrategy.java
index b27b6e33ec..bc7052014d 100644
--- 
a/auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/AbstractAuthenticationStrategy.java
+++ 
b/auth/src/main/java/org/apache/rocketmq/auth/authentication/strategy/AbstractAuthenticationStrategy.java
@@ -16,8 +16,8 @@
  */
 package org.apache.rocketmq.auth.authentication.strategy;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
 import java.util.function.Supplier;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.auth.authentication.context.AuthenticationContext;
@@ -30,7 +30,7 @@ import org.apache.rocketmq.common.utils.ExceptionUtils;
 public abstract class AbstractAuthenticationStrategy implements 
AuthenticationStrategy {
 
     protected final AuthConfig authConfig;
-    protected final List<String> authenticationWhitelist = new ArrayList<>();
+    protected final Set<String> authenticationWhiteSet = new HashSet<>();
     protected final AuthenticationProvider<AuthenticationContext> 
authenticationProvider;
 
     public AbstractAuthenticationStrategy(AuthConfig authConfig, Supplier<?> 
metadataService) {
@@ -42,7 +42,7 @@ public abstract class AbstractAuthenticationStrategy 
implements AuthenticationSt
         if (StringUtils.isNotBlank(authConfig.getAuthenticationWhitelist())) {
             String[] whitelist = 
StringUtils.split(authConfig.getAuthenticationWhitelist(), ",");
             for (String rpcCode : whitelist) {
-                this.authenticationWhitelist.add(StringUtils.trim(rpcCode));
+                this.authenticationWhiteSet.add(StringUtils.trim(rpcCode));
             }
         }
     }
@@ -57,7 +57,7 @@ public abstract class AbstractAuthenticationStrategy 
implements AuthenticationSt
         if (this.authenticationProvider == null) {
             return;
         }
-        if (this.authenticationWhitelist.contains(context.getRpcCode())) {
+        if (this.authenticationWhiteSet.contains(context.getRpcCode())) {
             return;
         }
         try {

Reply via email to