use of com.sun.identity.entitlement.interfaces.ResourceName in project OpenAM by OpenRock.
the class OpenSSOApplicationPrivilegeManager method isDelegatableResource.
private boolean isDelegatableResource(Application appl, String res) {
Set<String> resources = getDelegatableResourceNames(appl.getName());
if ((resources != null) && !resources.isEmpty()) {
ResourceName resComp = appl.getResourceComparator();
boolean isRegEx = (resComp instanceof RegExResourceName);
for (String r : resources) {
if (!r.endsWith("*")) {
if (!r.endsWith("/")) {
r += "/";
}
r += "*";
}
if (isRegEx) {
ResourceMatch result = resComp.compare(res, r, true);
if (result.equals(ResourceMatch.EXACT_MATCH) || result.equals(ResourceMatch.SUB_RESOURCE_MATCH) || result.equals(ResourceMatch.WILDCARD_MATCH)) {
return true;
}
} else {
ResourceMatch result = resComp.compare(r, res, false);
if (result.equals(ResourceMatch.EXACT_MATCH) || result.equals(ResourceMatch.SUB_RESOURCE_MATCH)) {
return true;
}
result = resComp.compare(res, r, true);
if (result.equals(ResourceMatch.EXACT_MATCH) || result.equals(ResourceMatch.SUB_RESOURCE_MATCH) || result.equals(ResourceMatch.WILDCARD_MATCH)) {
return true;
}
}
}
}
return false;
}
Aggregations