Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
freeznet committed Jul 6, 2021
1 parent 3c45126 commit 5edbfef
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class PatternTopicsConsumerImplAuthTest extends ProducerConsumerBase {
private static final long testTimeout = 90000; // 1.5 min
private static final Logger log = LoggerFactory.getLogger(PatternTopicsConsumerImplAuthTest.class);
private static final String clientRole = "pluggableRole";
private static final String superUserRole = "superUser";
private static final Set<String> clientAuthProviderSupportedRoles = Sets.newHashSet(clientRole);

@Override
Expand All @@ -88,7 +89,7 @@ public void setup() throws Exception {
conf.setAuthorizationEnabled(true);

Set<String> superUserRoles = new HashSet<>();
superUserRoles.add("superUser");
superUserRoles.add(superUserRole);
conf.setSuperUserRoles(superUserRoles);

Set<String> providers = new HashSet<>();
Expand All @@ -109,7 +110,7 @@ protected void cleanup() throws Exception {
}

private PulsarAdmin buildAdminClient() throws Exception {
Authentication adminAuthentication = new ClientAuthentication("superUser");
Authentication adminAuthentication = new ClientAuthentication(superUserRole);
return PulsarAdmin.builder()
.serviceHttpUrl(brokerUrl.toString())
.authentication(adminAuthentication)
Expand Down Expand Up @@ -341,7 +342,7 @@ public CompletableFuture<Boolean> allowNamespaceOperationAsync(
NamespaceName namespaceName, String role, NamespaceOperation operation, AuthenticationDataSource authData) {
CompletableFuture<Boolean> isAuthorizedFuture;

if (role.equals("superUser") || role.equals(clientRole)) {
if (role.equals(superUserRole) || role.equals(clientRole)) {
isAuthorizedFuture = CompletableFuture.completedFuture(true);
} else {
isAuthorizedFuture = CompletableFuture.completedFuture(false);
Expand All @@ -365,7 +366,7 @@ public CompletableFuture<Boolean> allowTopicOperationAsync(
TopicName topic, String role, TopicOperation operation, AuthenticationDataSource authData) {
CompletableFuture<Boolean> isAuthorizedFuture;

if (role.equals("superUser") || role.equals(clientRole)) {
if (role.equals(superUserRole) || role.equals(clientRole)) {
isAuthorizedFuture = CompletableFuture.completedFuture(true);
} else {
isAuthorizedFuture = CompletableFuture.completedFuture(false);
Expand All @@ -390,7 +391,7 @@ public CompletableFuture<Boolean> allowTopicPolicyOperationAsync(TopicName topic
AuthenticationDataSource authData) {
CompletableFuture<Boolean> isAuthorizedFuture;

if (role.equals("superUser") || role.equals(clientRole)) {
if (role.equals(superUserRole) || role.equals(clientRole)) {
isAuthorizedFuture = CompletableFuture.completedFuture(true);
} else {
isAuthorizedFuture = CompletableFuture.completedFuture(false);
Expand Down

0 comments on commit 5edbfef

Please sign in to comment.