Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.ResponseCtx


        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.parse(req.getInputStream());

        RequestCtx request = RequestCtx.getInstance(doc.getDocumentElement());
        ResponseCtx response = pdp.evaluate(request);

        response.encode(resp.getOutputStream(), new Indenter(0), true);
        return null;
    }
View Full Code Here


            // re-set any references we're using
            module.setPolicyRefs(policyRefs, testPrefix);
            module.setPolicySetRefs(policySetRefs, testPrefix);

            // actually do the evaluation
            ResponseCtx response = pdp.evaluate(request);

            // if we're supposed to fail, we should have done so by now
            if (errorExpected) {
                System.out.println("failed");
                errorCount++;
            } else {
                failurePointReached = true;

                // load the reponse that we expectd to get
                ResponseCtx expectedResponse = ResponseCtx.getInstance(new FileInputStream(
                        testPrefix + name + "Response.xml"));

                // see if the actual result matches the expected result
                boolean equiv = TestUtil.areEquivalent(response, expectedResponse);
View Full Code Here

        setDispatcherRequest("GetMap", env, null);

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(role, states, AccessMode.READ).createRequestCtx();
        // dumpRequestCtx(request);
        ResponseCtx response = GeoXACMLConfig.getXACMLTransport().evaluateRequestCtx(request);
        assertTrue(response.getResults().iterator().next().getDecision() == Result.DECISION_PERMIT);
        checkForObligation(response);
    }
View Full Code Here

        setDispatcherRequest("GetFeatureInfo", env, "EPSG:4326");

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(role, asia, AccessMode.READ).createRequestCtx();
        // dumpRequestCtx(request);
        ResponseCtx response = GeoXACMLConfig.getXACMLTransport().evaluateRequestCtx(request);
        assertTrue(response.getResults().iterator().next().getDecision() == Result.DECISION_DENY);
    }
View Full Code Here

        setDispatcherRequest("GetFeatureInfo", env, "EPSG:4326");

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(role, europe, AccessMode.READ).createRequestCtx();
        // dumpRequestCtx(request);
        ResponseCtx response = GeoXACMLConfig.getXACMLTransport().evaluateRequestCtx(request);
        assertTrue(response.getResults().iterator().next().getDecision() == Result.DECISION_PERMIT);
        checkForObligation(response);
    }
View Full Code Here

        setDispatcherRequest("GetFeatureInfo", env, "EPSG:4326");

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(role, europe, AccessMode.READ).createRequestCtx();
        // dumpRequestCtx(request);
        ResponseCtx response = GeoXACMLConfig.getXACMLTransport().evaluateRequestCtx(request);
        assertTrue(response.getResults().iterator().next().getDecision() == Result.DECISION_DENY);
    }
View Full Code Here

        }

        // serial

        XACMLTransport transport = new XACMLLocalTransportFactory(pdp, false).getXACMLTransport();
        ResponseCtx response = transport.evaluateRequestCtx(request);

        Result result = (Result) response.getResults().iterator().next();
        assertTrue(result.getDecision() == Result.DECISION_PERMIT);
        assertTrue(result.getStatus().getCode().iterator().next().equals(Status.STATUS_OK));

        // multithreaded transporter, one request

        transport = new XACMLLocalTransportFactory(pdp, true).getXACMLTransport();
        response = transport.evaluateRequestCtx(request);

        result = (Result) response.getResults().iterator().next();
        assertTrue(result.getDecision() == Result.DECISION_PERMIT);
        assertTrue(result.getStatus().getCode().iterator().next().equals(Status.STATUS_OK));

    }
View Full Code Here

    }

    private void checkResponseList(List<ResponseCtx> responseList) {
        for (int i = 0; i < responseList.size(); i++) {
            ResponseCtx response = responseList.get(i);
            Result result = (Result) response.getResults().iterator().next();
            if (i % 2 == 0) {
                assertTrue(result.getDecision() == Result.DECISION_PERMIT);
                assertTrue(result.getStatus().getCode().iterator().next().equals(Status.STATUS_OK));
            } else {
                assertTrue(result.getDecision() == Result.DECISION_NOT_APPLICABLE);
View Full Code Here

        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail(e.getMessage());
        }

        ResponseCtx response = pdp.evaluate(request);
        Result result = (Result) response.getResults().iterator().next();
        assertTrue(result.getDecision() == Result.DECISION_PERMIT);
        assertTrue(result.getStatus().getCode().iterator().next().equals(Status.STATUS_OK));
    }
View Full Code Here

        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail(e.getMessage());
        }

        ResponseCtx response = pdp.evaluate(request);
        Result result = (Result) response.getResults().iterator().next();
        assertTrue(result.getDecision() == Result.DECISION_NOT_APPLICABLE);
        assertTrue(result.getStatus().getCode().iterator().next().equals(Status.STATUS_OK));
    }
View Full Code Here

TOP

Related Classes of com.sun.xacml.ctx.ResponseCtx

Copyright © 2018 www.massapicom. 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.