Geal commented on a change in pull request #5718: [WIP][Issue 5712][broker] Auth provider superuser
URL: https://github.com/apache/pulsar/pull/5718#discussion_r349500464
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
##########
@@ -200,8 +200,21 @@ protected void validateSuperUserAccess() {
}
log.debug("Successfully authorized {} (proxied by {}) as super-user",
originalPrincipal, appId);
- } else if (!config().getSuperUserRoles().contains(appId)) {
- throw new RestException(Status.UNAUTHORIZED, "This operation requires super-user access");
+ } else {
+ CompletableFuture<Boolean> isSuperUserFuture;
+ try {
+ isSuperUserFuture = pulsar.getBrokerService()
+ .getAuthorizationService()
+ .isSuperUser(appId);
+
+ if (!isSuperUserFuture.get()) {
+ throw new RestException(Status.UNAUTHORIZED, "This operation requires super-user access");
+ }
+ } catch (InterruptedException | ExecutionException e) {
Review comment:
thansk for the suggestion, this looks much better
----------------------------------------------------------------
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
With regards,
Apache Git Services