Skip to content

Commit

Permalink
[Authorization] Revert new AuthorizationProvider method (apache#13133)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljmarshall authored Dec 6, 2021
1 parent 591b4e8 commit d1156ca
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,6 @@ CompletableFuture<Boolean> allowSourceOpsAsync(NamespaceName namespaceName, Stri
CompletableFuture<Boolean> allowSinkOpsAsync(NamespaceName namespaceName, String role,
AuthenticationDataSource authenticationData);

/**
* Allow consume operations with in this namespace
* @param namespaceName The namespace that the consume operations can be executed in
* @param role The role to check
* @param authenticationData authentication data related to the role
* @return a boolean to determine whether authorized or not
*/
CompletableFuture<Boolean> allowConsumeOpsAsync(NamespaceName namespaceName, String role,
AuthenticationDataSource authenticationData);

/**
*
* Grant authorization-action permission on a namespace to the given client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ public CompletableFuture<Boolean> allowSinkOpsAsync(NamespaceName namespaceName,
return authorize(authenticationData, r -> super.allowSinkOpsAsync(namespaceName, r, authenticationData));
}

@Override
public CompletableFuture<Boolean> allowConsumeOpsAsync(NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) {
return authorize(authenticationData, r -> super.allowConsumeOpsAsync(namespaceName, r, authenticationData));
}

@Override
public CompletableFuture<Boolean> allowTenantOperationAsync(String tenantName,
String role,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,6 @@ public CompletableFuture<Boolean> allowSinkOpsAsync(NamespaceName namespaceName,
return allowTheSpecifiedActionOpsAsync(namespaceName, role, authenticationData, AuthAction.sinks);
}

@Override
public CompletableFuture<Boolean> allowConsumeOpsAsync(NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) {
return allowTheSpecifiedActionOpsAsync(namespaceName, role, authenticationData, AuthAction.consume);
}

private CompletableFuture<Boolean> allowTheSpecifiedActionOpsAsync(NamespaceName namespaceName, String role,
AuthenticationDataSource authenticationData,
AuthAction authAction) {
Expand Down Expand Up @@ -534,7 +529,7 @@ public CompletableFuture<Boolean> allowNamespaceOperationAsync(NamespaceName nam
case GET_TOPICS:
case UNSUBSCRIBE:
case CLEAR_BACKLOG:
isAuthorizedFuture = allowConsumeOpsAsync(namespaceName, role, authData);
isAuthorizedFuture = allowTheSpecifiedActionOpsAsync(namespaceName, role, authData, AuthAction.consume);
break;
default:
isAuthorizedFuture = CompletableFuture.completedFuture(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ public CompletableFuture<Boolean> allowSinkOpsAsync(NamespaceName namespaceName,
return roleAuthorizedAsync(role);
}

@Override
public CompletableFuture<Boolean> allowConsumeOpsAsync(NamespaceName namespaceName, String role,
AuthenticationDataSource authenticationData) {
return roleAuthorizedAsync(role);
}

@Override
public CompletableFuture<Void> grantPermissionAsync(NamespaceName namespace, Set<AuthAction> actions, String role,
String authDataJson) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,6 @@ public CompletableFuture<Boolean> allowSinkOpsAsync(NamespaceName namespaceName,
return null;
}

@Override
public CompletableFuture<Boolean> allowConsumeOpsAsync(NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) {
return null;
}

@Override
public CompletableFuture<Void> grantPermissionAsync(NamespaceName namespace, Set<AuthAction> actions,
String role, String authenticationData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ public CompletableFuture<Boolean> allowSinkOpsAsync(NamespaceName namespaceName,
return null;
}

@Override
public CompletableFuture<Boolean> allowConsumeOpsAsync(NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) {
return null;
}

@Override
public CompletableFuture<Void> grantPermissionAsync(NamespaceName namespace, Set<AuthAction> actions,
String role, String authenticationData) {
Expand Down

0 comments on commit d1156ca

Please sign in to comment.