Examples of RequestCtx


Examples of com.sun.xacml.ctx.RequestCtx

    public void testHttpParams() {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("param1", "value1");
        paramMap.put("param2", new String[] { "value2" });
        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getURLMatchRequestCtxBuilder((XACMLRole) anonymous.getAuthorities()[0], "/rest/",
                        "GET", paramMap,"127.0.0.1", "localhost").createRequestCtx();

        //System.out.println(XACMLUtil.asXMLString(request));
        int count = 0;
        for (Attribute attr : request.getResource()) {
            if (attr.getId().toString().equals(XACMLConstants.URLParamPrefix + "param1")) {
                assertTrue(((StringAttribute) attr.getValue()).getValue().equals("value1"));
                count++;
            }
            if (attr.getId().toString().equals(XACMLConstants.URLParamPrefix + "param2")) {
View Full Code Here

Examples of com.sun.xacml.ctx.RequestCtx

        for (GrantedAuthority role : auth.getAuthorities()) {
            XACMLRole xacmlRole = (XACMLRole) role;
            if (xacmlRole.isEnabled() == false)
                continue;
            RequestCtx requestCtx = GeoXACMLConfig.getRequestCtxBuilderFactory()
                    .getURLMatchRequestCtxBuilder(xacmlRole, urlPath, method, httpParams,remoteIP,remoteHost)
                    .createRequestCtx();
            // XACMLUtil.getXACMLLogger().info(XACMLUtil.asXMLString(requestCtx));
            resultList.add(requestCtx);
        }
View Full Code Here

Examples of com.sun.xacml.ctx.RequestCtx

    public void testLayerAccessStates() {
        SecurityContextHolder.getContext().setAuthentication(null);
        ReferencedEnvelope env = new ReferencedEnvelope(10, 20, 40, 60, null);
        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

Examples of com.sun.xacml.ctx.RequestCtx

    public void testLayerAccessAsia() {
        SecurityContextHolder.getContext().setAuthentication(null);
        ReferencedEnvelope env = new ReferencedEnvelope(10, 20, 40, 60, null);
        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

Examples of com.sun.xacml.ctx.RequestCtx

    public void testLayerAccessEuropePermit() {
        SecurityContextHolder.getContext().setAuthentication(null);
        ReferencedEnvelope env = new ReferencedEnvelope(12, 17, 12, 17, null);
        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

Examples of com.sun.xacml.ctx.RequestCtx

    public void testLayerAccessEuropeDeny() {
        SecurityContextHolder.getContext().setAuthentication(null);
        ReferencedEnvelope env = new ReferencedEnvelope(6, 8, 6, 8, null);
        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

Examples of com.sun.xacml.ctx.RequestCtx

        GeoXACMLConfig.getXACMLRoleAuthority().prepareRoles(reader);

        // //////
        XACMLRole readerRole = (XACMLRole) reader.getAuthorities()[0];

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(readerRole, europe, AccessMode.READ)
                .createRequestCtx();

        // System.out.println(XACMLUtil.asXMLString(request));

        Subject subject = request.getSubjects().iterator().next();
        for (Attribute attr : subject.getAttributes()) {
            if (attr.getId().toString().equals(XACMLConstants.RoleParamPrefix + "persNr"))
                assertTrue(((IntegerAttribute) attr.getValue()).getValue() == 4711);
            if (attr.getId().toString().equals(
                    XACMLConstants.RoleParamPrefix + "geometryRestriction"))
View Full Code Here

Examples of com.sun.xacml.ctx.RequestCtx

        }

        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

Examples of com.sun.xacml.ctx.RequestCtx

    public CatalogMode getMode() {
        synchronized (modeLock) {
            if (mode != null)
                return mode;

            RequestCtx requestCtx = GeoXACMLConfig.getRequestCtxBuilderFactory()
                    .getCatalogRequestCtxBuilder().createRequestCtx();
            ResponseCtx responseCtx = GeoXACMLConfig.getXACMLTransport().evaluateRequestCtx(
                    requestCtx);

            Result result = responseCtx.getResults().iterator().next();
View Full Code Here

Examples of com.sun.xacml.ctx.RequestCtx

        for (GrantedAuthority role : auth.getAuthorities()) {
            XACMLRole xacmlRole = (XACMLRole) role;
            if (xacmlRole.isEnabled() == false)
                continue;
            RequestCtx requestCtx = GeoXACMLConfig.getRequestCtxBuilderFactory()
                    .getWorkspaceRequestCtxBuilder(xacmlRole, workspaceInfo, mode)
                    .createRequestCtx();
            // XACMLUtil.getXACMLLogger().info(XACMLUtil.asXMLString(requestCtx));
            resultList.add(requestCtx);
        }
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.