use of com.sun.identity.policy.interfaces.ResourceName in project OpenAM by OpenRock.
the class ResourceResultCache method getPolicyDecision.
/**
* Returns policy decision
* @param appToken application sso token to identify the client to policy
* service
*
* @param serviceName name of service for which to get policy decision
* @param token session token of user for whom to get policy decision
* @param resourceName resource name for which to get policy decision
* @param actionNames action names for which to get policy decision
* @param env environment map to use to get policy decision
*
* @param useCache flag indicating whether to return a locally cached
* policy decision. Locally cached decision is returned only if the
* value is <code>true</code>. Otherwise, policy decision is fetched
* from policy service and returned.
*
* @return policy decision
* @throws PolicyException if can not get policy decision
* @throws SSOException if session token is not valid
*/
private PolicyDecision getPolicyDecision(SSOToken appToken, String serviceName, SSOToken token, String resourceName, Set actionNames, Map env, boolean useCache) throws InvalidAppSSOTokenException, PolicyException, SSOException {
String cacheMode = policyProperties.getCacheMode();
String rootResourceName = resourceName;
if (PolicyProperties.SUBTREE.equals(cacheMode)) {
rootResourceName = getRootResourceName(resourceName, serviceName);
if (debug.messageEnabled()) {
debug.message("ResourceResultCache.getPolicyDecision():" + "resourceName=" + resourceName + ":cacheMode=" + cacheMode + ":would get resource results for root resource=" + rootResourceName);
}
}
Set resourceResults = getResourceResults(appToken, serviceName, token, rootResourceName, actionNames, env, cacheMode, useCache);
ResourceName resourceComparator = (ResourceName) policyProperties.getResourceComparator(serviceName);
PolicyDecision pd = getPolicyDecisionFromResourceResults(resourceResults, resourceName, resourceComparator, serviceName);
if (debug.messageEnabled()) {
debug.message("ResourceResultCache.getPolicyDecision():" + ":serviceName=" + serviceName + ":token=" + token.getPrincipal().getName() + ":resourceName=" + resourceName + ":actionNames=" + actionNames + ":env" + ":cacehMode=" + cacheMode + ":useCache=" + useCache + ":returning policyDecision:" + pd);
}
return pd;
}
Aggregations