oscerd commented on code in PR #27432:
URL: https://github.com/apache/camel/pull/27432#discussion_r4194797363


##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java:
##########
@@ -235,16 +237,31 @@ protected boolean matchesRoles(String roles, String 
userRoles) {
             return true;
         }
 
-        // see if any of the user roles is contained in the roles list
-        for (String userRole : ObjectHelper.createIterable(userRoles)) {
-            if (roles.contains(userRole)) {
+        // the user must have one of the roles, compared by the exact role name
+        Set<String> names = roleNames(roles);
+        for (String userRole : roleNames(userRoles)) {
+            if (names.contains(userRole)) {
                 return true;
             }
         }
 
         return false;
     }
 
+    /**
+     * The role names in the comma separated list of roles, trimmed and 
without blank entries.
+     */
+    private static Set<String> roleNames(String roles) {
+        Set<String> names = new HashSet<>();

Review Comment:
   Applied in 0f89771d8b45: the user roles are now iterated with 
`createIterable` and trimmed per entry, and only the configured roles are 
collected into a set. Blank user entries still never match, since that set 
holds no blank name (the blank-entry rows of 
`HttpServerChannelHandlerRolesTest` cover it). Thanks!
   
   _Claude Code on behalf of Andrea Cosentino_



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

Reply via email to