hongkunxu commented on code in PR #17242:
URL: https://github.com/apache/pinot/pull/17242#discussion_r2643574566


##########
pinot-broker/src/main/java/org/apache/pinot/broker/broker/ZkBasicAuthAccessControlFactory.java:
##########
@@ -122,24 +122,39 @@ public TableAuthorizationResult 
authorize(RequesterIdentity requesterIdentity, S
 
     private Optional<ZkBasicAuthPrincipal> getPrincipalAuth(RequesterIdentity 
requesterIdentity) {
       Collection<String> tokens = 
extractAuthorizationTokens(requesterIdentity);
-      if (tokens.isEmpty()) {
+      if (tokens == null || tokens.isEmpty()) {
         return Optional.empty();
       }
 
-      _name2principal = 
BasicAuthUtils.extractBasicAuthPrincipals(_userCache.getAllBrokerUserConfig()).stream()
-          .collect(Collectors.toMap(BasicAuthPrincipal::getName, p -> p));
+      Map<String, ZkBasicAuthPrincipal> name2principal =
+          
BasicAuthUtils.extractBasicAuthPrincipals(_userCache.getAllBrokerUserConfig()).stream()
+              .collect(Collectors.toMap(BasicAuthPrincipal::getName, p -> p));
 
-      Map<String, String> name2password = tokens.stream().collect(
-          Collectors.toMap(
-              org.apache.pinot.common.auth.BasicAuthUtils::extractUsername,
-              org.apache.pinot.common.auth.BasicAuthUtils::extractPassword,
-              (v1, v2) -> v2));
-      Map<String, ZkBasicAuthPrincipal> password2principal =
-          
name2password.keySet().stream().collect(Collectors.toMap(name2password::get, 
_name2principal::get));
+      for (String token : tokens) {
+        String username = 
org.apache.pinot.common.auth.BasicAuthUtils.extractUsername(token);

Review Comment:
   <img width="484" height="71" alt="image" 
src="https://github.com/user-attachments/assets/39cb5f36-0691-4ab2-83aa-a172f3c2622c";
 />
   
   Hi @xiangfu0 Unfortunately, we cannot do this at the moment, because both 
pinot-common and pinot-core define a BasicAuthUtils class with the same name, 
and both classes are used in this method. 
   



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