Returns the roles that can invoke the given operation. This is determined by matching the
operation details against configuration provided.
The following configuration is supported. Keys are used to match an invocation against. The value can contain
a comma-separated list of roles. Spaces are ignored for the role values. Note that comments are allowed in the
value field after the hash
# character:
myMethod = role1, role2
methodName(int)[/17/] = role1 # regex match, assume it's surrounded by ^ and $
methodName(int)[/[01]8/] = role2
methodName(int)["19"] = role3 # exact value match
methodName(int) = role4 # signature match
methodName(java.lang.String, int) = role5 # signature match
methodName = # no roles can invoke this command
method* = role6 # name prefix/wildcard match. The asterisk must appear at the end.
The following algorithm is used to find matching roles:
- Find all regex and exact value matches. For all parameters these matches are found by calling
toString()
on the parameters passed in. If there are multiple matches in this category all the matching roles are collected.
If any is found return these roles.
- Find a signature match. If found return the associated roles.
- Find a method name match. If found return the associated roles.
- Find a method name prefix/wildcard match. If more than one prefix match, the roles associated with the longest
prefix is used. So for example, if there are rules for
get* and * only the roles associated with
get* are returned.
- If none of the above criteria match, this method returns
null.