You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/05/24 07:41:28 UTC

[GitHub] [pulsar] zymap commented on a change in pull request #10685: [Broker] Add multi roles support for authentication and authorization

zymap commented on a change in pull request #10685:
URL: https://github.com/apache/pulsar/pull/10685#discussion_r637751818



##########
File path: pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderToken.java
##########
@@ -149,7 +150,13 @@ public String authenticate(AuthenticationDataSource authData) throws Authenticat
             String token;
             token = getToken(authData);
             // Parse Token by validating
-            String role = getPrincipal(authenticateToken(token));
+            String role;
+            List<String> principals = getPrincipals(authenticateToken(token));
+            if (principals == null) { // Empty list check has been done in getPrincipals.
+                role = null;
+            } else {
+                role = principals.get(0);

Review comment:
       Just curious, if we always get the first role in the role list, so what's the motivation for passing a role sets? 
   If we only want to support get the role from an `Array`, why don't just parse it in the related auth provider?




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

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