Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.ResponseCtx


        long enforceStartTime = System.currentTimeMillis();
        try {
            synchronized (this) {
                //wait, if pdp update is in progress
            }
                ResponseCtx response = null;
                String contextIndex = null;
                try {
                    contextIndex = (new Integer(next())).toString();
                    logger.debug("context index set={}", contextIndex);
                    Set<Subject> subjects = wrapSubjects(subjectId);
                    Set<Attribute> actions = wrapActions(action, api, contextIndex);
                    Set<Attribute> resources = wrapResources(pid, namespace);

                    RequestCtx request =
                            new RequestCtx(subjects,
                                           resources,
                                           actions,
                                           Collections.EMPTY_SET);
                    Iterator<Attribute> tempit = actions.iterator();
                    while (tempit.hasNext()) {
                        Attribute tempobj = tempit.next();
                        logger.debug("request action has {}={}", tempobj.getId(), tempobj.getValue().toString());
                    }
                    m_registry.registerContext(contextIndex, context);
                    long st = System.currentTimeMillis();
                    try {
                        response = m_pdp.evaluate(request);
                    } finally {
                        long dur = System.currentTimeMillis() - st;
                        logger.debug("Policy evaluation took {}ms.", dur);
                    }

                    logger.debug("in pep, after evaluate() called");
                } catch (Throwable t) {
                    logger.error("Error evaluating policy", t);
                    throw new AuthzOperationalException("");
                } finally {
                    m_registry.unregisterContext(contextIndex);
                }
                logger.debug("in pep, before denyBiasedAuthz() called");
                if (!denyBiasedAuthz(response.getResults())) {
                    throw new AuthzDeniedException("");
                }
           
            if (context.getNoOp()) {
                throw new AuthzPermittedException("noOp");
View Full Code Here


                throw new ServletException(e.getMessage(), e);
            }
        }

        String res = null;
        ResponseCtx resCtx = null;
        try {
            if (logger.isDebugEnabled()) {
                logger.debug("Number of requests: " + requests.size());
            }

            res =
                    getContextHandler().evaluateBatch(requests
                            .toArray(new String[requests.size()]));

            if (logger.isDebugEnabled()) {
                logger.debug("Response: " + res);
            }

            resCtx = m_contextUtil.makeResponseCtx(res);
        } catch (MelcoeXacmlException pe) {
            throw new ServletException("Error evaluating pids: "
                    + pe.getMessage(), pe);
        }

        @SuppressWarnings("unchecked")
        Set<Result> results = resCtx.getResults();

        return results;
    }
View Full Code Here

   /**
    * @see ResponseContext#getDecision()
    */
   public int getDecision()
   {
      ResponseCtx response = (ResponseCtx) map.get(XACMLConstants.RESPONSE_CTX);
      if(response != null)
      {
         Set<Result> results = response.getResults();
         Result res = results.iterator().next();
         decision = res.getDecision();
      }
      return decision;
        
View Full Code Here

            policyFinder, null));
      RequestCtx req = (RequestCtx) request.get(XACMLConstants.REQUEST_CTX);
      if(req == null)
         throw new IllegalStateException("Request Context does not contain a request");
     
      ResponseCtx resp = pdp.evaluate(req);
     
      ResponseContext response = RequestResponseContextFactory.createResponseContext();
      response.set(XACMLConstants.RESPONSE_CTX, resp);
      return response;
   }
View Full Code Here

    * @throws Exception
    */
   public static synchronized int checkXACMLAuthorization(RequestCtx request,
         Policy policy) throws Exception
   {
      ResponseCtx response = getXACMLResponse(request,policy);
      return analyzeResponseCtx(response);
   }
View Full Code Here

/*     */   }
/*     */
/*     */   public static synchronized int checkXACMLAuthorization(RequestCtx request, Policy policy)
/*     */     throws Exception
/*     */   {
/* 106 */     ResponseCtx response = getXACMLResponse(request, policy);
/* 107 */     return analyzeResponseCtx(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

            simplePDP = new SimplePDP(policyFiles);
        }

        // evaluate the request
        ResponseCtx response = simplePDP.evaluate(requestFile);

        // for this sample program, we'll just print out the response
        response.encode(System.out, new Indenter());
    }
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.