use of com.sun.identity.policy.client.PolicyEvaluator in project OpenAM by OpenRock.
the class PolicyEvaluationSample method getPolicyDecision.
private void getPolicyDecision(SSOToken ssoToken, String serviceName, String resourceName, String actionName) throws Exception {
System.out.println("Entering getPolicyDecision():" + "resourceName=" + resourceName + "," + "serviceName=" + serviceName + "," + "actionName=" + actionName);
PolicyEvaluator pe = PolicyEvaluatorFactory.getInstance().getPolicyEvaluator(serviceName);
Map env = new HashMap();
Set attrSet = new HashSet();
Set actions = new HashSet();
actions.add(actionName);
PolicyDecision pd = pe.getPolicyDecision(ssoToken, resourceName, actions, env);
System.out.println("policyDecision:" + pd.toXML());
System.out.println("returning from getPolicyDecision()");
}
use of com.sun.identity.policy.client.PolicyEvaluator in project OpenAM by OpenRock.
the class AMIdentityMembershipConditionTest method testGetPolicyDecision.
@Test(groups = { "policy-client" })
@Parameters({ "orgName", "userName", "password", "serviceName", "resourceName", "actionName", "invocatorUuid" })
public void testGetPolicyDecision(String orgName, String userName, String password, String serviceName, String resourceName, String actionName, String invocatorUuid) throws Exception {
entering("testGetPolicyDecision()", null);
log(Level.INFO, "orgName:", orgName);
log(Level.INFO, "userName:", userName);
log(Level.INFO, "password:", password);
log(Level.INFO, "serviceName:", serviceName);
log(Level.INFO, "resourceName:", resourceName);
log(Level.INFO, "actionName:", actionName);
log(Level.INFO, "invocatorUuid:", invocatorUuid);
SSOToken token = TokenUtils.getSessionToken(orgName, userName, password);
log(Level.INFO, "Created ssoToken", "\n");
PolicyEvaluator pe = PolicyEvaluatorFactory.getInstance().getPolicyEvaluator(serviceName);
Map env = new HashMap();
Set attrSet = new HashSet();
attrSet.add(invocatorUuid);
env.put("invocatorPrincipalUuid", attrSet);
log(Level.INFO, "env Map:" + env, "\n");
Set actions = new HashSet();
actions.add(actionName);
PolicyDecision pd = pe.getPolicyDecision(token, resourceName, actions, env);
log(Level.INFO, "PolicyDecision XML:", pd.toXML());
entering("testGetPolicyDecision()", null);
}
Aggregations