Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ protected boolean hasSuperUserAccess() {
return true;
}

public CompletableFuture<Void> validateSuperUserAccessAsync(){
if (!config().isAuthenticationEnabled()) {
public CompletableFuture<Void> validateSuperUserAccessAsync() {
if (!config().isAuthenticationEnabled() || !config().isAuthorizationEnabled()) {
return CompletableFuture.completedFuture(null);
}
String appId = clientAppId();
Expand Down Expand Up @@ -221,22 +221,15 @@ public CompletableFuture<Void> validateSuperUserAccessAsync(){
}
});
} else {
if (config().isAuthorizationEnabled()) {
return pulsar.getBrokerService()
.getAuthorizationService()
.isSuperUser(appId, clientAuthData())
.thenAccept(proxyAuthorizationSuccess -> {
if (!proxyAuthorizationSuccess) {
throw new RestException(Status.UNAUTHORIZED,
"This operation requires super-user access");
}
});
}
if (log.isDebugEnabled()) {
log.debug("Successfully authorized {} as super-user",
appId);
}
return CompletableFuture.completedFuture(null);
return pulsar.getBrokerService()
.getAuthorizationService()
.isSuperUser(appId, clientAuthData())
.thenAccept(proxyAuthorizationSuccess -> {
if (!proxyAuthorizationSuccess) {
throw new RestException(Status.UNAUTHORIZED,
"This operation requires super-user access");
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ public void testUpdateTransactionCoordinatorNumber() throws Exception {
Awaitility.await().until(() -> pulsar.getTransactionMetadataStoreService().getStores().size() ==
coordinatorSize * 2);
pulsar.getConfiguration().setAuthenticationEnabled(true);
pulsar.getConfiguration().setAuthorizationEnabled(true);
Set<String> proxyRoles = spy(Set.class);
doReturn(true).when(proxyRoles).contains(any());
pulsar.getConfiguration().setProxyRoles(proxyRoles);
Expand Down