Github user saandrews commented on a diff in the pull request:
https://github.com/apache/incubator-pulsar/pull/530#discussion_r124126013
--- 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 --
Do we really needs to support regex use case? Even though it's a nice
feature, I think * at the beginning or end should address most use cases for
auth.
---
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.
---