Technoboy- commented on issue #22343:
URL: https://github.com/apache/pulsar/issues/22343#issuecomment-2024950672
@dhsy6z Could you help confirm if the below test match your reproduced
steps? I can't reproduce it.
you can put this method in
org.apache.pulsar.client.api.MultiRolesTokenAuthorizationProviderTest.
and then run it with green bar
```
@Test
public void testMultiRole() throws Exception {
String tenant = "tenant1";
@Cleanup
PulsarAdmin admin = newPulsarAdmin(superUserToken);
admin.tenants().createTenant(tenant, TenantInfo.builder()
.adminRoles(Sets.newHashSet("Group_Test-user"))
.allowedClusters(Sets.newHashSet(configClusterName)).build());
String namespace = tenant + "/namespace1";
admin.namespaces().createNamespace(namespace);
String topic = namespace + "/" + "test-topic";
admin.topics().createNonPartitionedTopicAsync(topic);
//
Map<String, Object> claims = new HashMap<>();
Set<String> roles = new HashSet<>();
roles.add("Group_Test-admin");
roles.add("Group_Test-user");
claims.put("roles", roles);
final String token = Jwts.builder()
.setClaims(claims)
.signWith(secretKey)
.compact();
@Cleanup
PulsarAdmin adminTest = newPulsarAdmin(token);
adminTest.namespaces().getTopics(namespace);
admin.topics().grantPermission(topic, "Group_Test-user",
Sets.newHashSet(AuthAction.consume, AuthAction.produce));
}
```
--
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]