Examples of PolicyResponseBuilder


Examples of org.wso2.carbon.identity.entitlement.policy.PolicyResponseBuilder

     * @return
     * @throws Exception
     */
    public String getDecision(String request) throws Exception {
        PolicyRequestBuilder policyRequestBuilder = null;
        PolicyResponseBuilder policyResponseBuilder = null;
        Element xacmlReq = null;
        ResponseCtx response = null;

        try {

            if (log.isDebugEnabled()) {
                log.debug("XACML request" + request);
            }

            EntitlementEngine entitlementEngine = EntitlementEngine
                    .getInstance(getGovernanceUserRegistry(), CarbonContext.getCurrentContext().getTenantId());
            policyRequestBuilder = new PolicyRequestBuilder();
            policyResponseBuilder = new PolicyResponseBuilder();
            xacmlReq = policyRequestBuilder.getXacmlRequest(request);
            RequestCtx req = RequestCtx.getInstance(xacmlReq);
            List<PIPExtension> extensions = EntitlementServiceComponent.getPipConfig()
                    .getExtensions();
            for (Iterator iterator = extensions.iterator(); iterator.hasNext();) {
                PIPExtension pipExtension = (PIPExtension) iterator.next();
                pipExtension.update(req);
            }
            response = entitlementEngine.evaluate(req);
            return policyResponseBuilder.getXacmlResponse(response);
        } catch (Exception e) {
            log.error("Error occured while eveluating XACML request", e);
            throw new Exception("Error occured while eveluating XACML request");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.