Github user rdhabalia commented on a diff in the pull request:
https://github.com/apache/incubator-pulsar/pull/530#discussion_r124121140
--- Diff:
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationManager.java
---
@@ -177,6 +190,29 @@ private boolean checkCluster(DestinationName
destination) {
return permissionFuture;
}
+ private Boolean checkWildcardPermission(String checkedRole, AuthAction
checkedAction,
+ Map<String, Set<AuthAction>> permissionMap) {
+ for (Map.Entry<String, Set<AuthAction>> permissionData :
permissionMap.entrySet()) {
+ String permittedRole = permissionData.getKey();
+ Set<AuthAction> permittedActions = permissionData.getValue();
+
+ // Prefix match
+ if (permittedRole.charAt(permittedRole.length() - 1) == '*'
+ && checkedRole.startsWith(permittedRole.substring(0,
permittedRole.length() - 1))
+ && permittedActions.contains(checkedAction)) {
+ return true;
+ }
+
+ // Suffix match
+ if (permittedRole.charAt(0) == '*'
--- End diff --
as we just check Prefix and suffix so, it seems it will not support
wild-card character for usecase:
checkedRole = `abcd`
and permittedRole = `ab*d`
So, instead can we use regex-pattern to validate it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---