public class AuthZClientProxy { SSOToken token; com.sun.identity.policy.client.PolicyEvaluator pe; PolicyDecision policyDecision; // Can store serviceName in a configuration file String serviceName = ?CustomClaimsApplicationPolicyService?; Map envParams = new HashMap(); AuthZClientProxy (HttpServletRequest request) { try { SSOTokenManager manager = SSOTokenManager.getInstance(); token = manager.createSSOToken(request); pe = new PolicyEvaluator(serviceName); } catch (Exception e) {} } AuthZClientProxy (EJBContext ctx) { try { AmSSOCache cache = AmFilterManager.getAmSSOCacheInstance(); String tokenStr = cache.getSSOTokenForUser(ctx); SSOTokenManager manager = SSOTokenManager.getInstance(); token = manager.createSSOToken(tokenStr); pe = new PolicyEvaluator(serviceName); } catch (Exception e) {} } public AuthZResultSet authorize(String resource) { AuthZResultSet results = new AuthZResultSet(); policyDecision = pe.getPolicyDecision(token, resourceName, actionNames, envParams); // For debugging purposes, we can print the values String str = policyDecision.tostring(); System.out.println(?String output: ?+str); String xmlStr = policyDecision.toXml(); System.out.println (?XML output: ?+xmlStr); /* The next steps involve getting ActionDecision map from the PolicyDecision object and creation the AuthZResultSet from the results. */ return results; } }