Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.Result


   {
      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


    private void dumpRequestCtx(RequestCtx request) {
        Logger.getAnonymousLogger().info(XACMLUtil.asXMLString(request));
    }

    private void checkForObligation(ResponseCtx response) {
        Result result = response.getResults().iterator().next();
        assertNotNull(result);
        Obligation obligation = result.getObligations().iterator().next();
        assertNotNull(obligation);
        Attribute assignment = obligation.getAssignments().iterator().next();
        GeometryAttribute geomAttr = (GeometryAttribute) assignment.getValue();
        assertNotNull(geomAttr.getGeometry());
View Full Code Here

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

            Result result = responseCtx.getResults().iterator().next();
            if (result == null || result.getDecision() != Result.DECISION_PERMIT) {
                Log.severe("Geserver cannot access its catalog !!!");
                Log.severe(XACMLUtil.asXMLString(requestCtx));
                return useDefaultMode();
            }

            Obligation obligation = result.getObligations().iterator().next();
            if (obligation == null
                    || XACMLConstants.CatalogModeObligationId.equals(obligation.getId()
                            .toASCIIString()) == false) {
                Log.severe("No obligation with id: " + XACMLConstants.CatalogModeObligationId);
                Log.severe(XACMLUtil.asXMLString(requestCtx));
View Full Code Here

      if(results.size() > 1)
         throw new IllegalArgumentException("Number of results > 1");
      Iterator<Result> iter = results.iterator();
      if(iter.hasNext())
      {
         Result res = (Result)iter.next();
         int decision = res.getDecision();
         if(decision == Result.DECISION_PERMIT)
            result = AuthorizationContext.PERMIT;
      }
      return result;
   }
View Full Code Here

        int nNotApplicables = 0; //no targets matched
        int nIndeterminates = 0; //for targets matched, no rules matched
        int nWrongs = 0; //none of the above, i.e., unreported failure, should not happen
        Iterator it = set.iterator();
        while (it.hasNext()) {
            Result result = (Result) it.next();
            int decision = result.getDecision();
            switch (decision) {
                case Result.DECISION_PERMIT:
                    nPermits++;
                    break;
                case Result.DECISION_DENY:
View Full Code Here

        Set<AbstractPolicy> applicablePolicies =
                getApplicablePolicies(context, matchedPolicies);

        for (AbstractPolicy policy : applicablePolicies) {
            Result result = policy.evaluate(context);
            int effect = result.getDecision();

            if (effect == Result.DECISION_PERMIT) {
                return result;
            }

            if (effect == Result.DECISION_DENY) {
                atLeastOneDeny = true;
                denyObligations.addAll(result.getObligations());
            } else if (effect == Result.DECISION_INDETERMINATE) {
                atLeastOneError = true;

                // keep track of the first error, regardless of cause
                if (firstIndeterminateStatus == null) {
                    firstIndeterminateStatus = result.getStatus();
                }
            }
        }

        // if we got a DENY, return it
        if (atLeastOneDeny) {
            return new Result(Result.DECISION_DENY, context.getResourceId()
                    .encode(), denyObligations);
        }

        // if we got an INDETERMINATE, return it
        if (atLeastOneError) {
            return new Result(Result.DECISION_INDETERMINATE,
                              firstIndeterminateStatus,
                              context.getResourceId().encode());
        }

        // if we got here, then nothing applied to us
        return new Result(Result.DECISION_NOT_APPLICABLE, context
                .getResourceId().encode());
    }
View Full Code Here

        Set<AbstractPolicy> applicablePolicies =
                getApplicablePolicies(context, matchedPolicies);

        for (AbstractPolicy policy : applicablePolicies) {
            Result result = policy.evaluate(context);
            int effect = result.getDecision();

            if (effect == Result.DECISION_DENY) {
                denyObligations.addAll(result.getObligations());
                return new Result(Result.DECISION_DENY, context.getResourceId()
                        .encode(), denyObligations);
            }

            if (effect == Result.DECISION_PERMIT) {
                atLeastOnePermit = true;
            } else if (effect == Result.DECISION_INDETERMINATE) {
                atLeastOneError = true;

                // keep track of the first error, regardless of cause
                if (firstIndeterminateStatus == null) {
                    firstIndeterminateStatus = result.getStatus();
                }
            }
        }

        // if we got a PERMIT, return it
        if (atLeastOnePermit) {
            return new Result(Result.DECISION_PERMIT, context.getResourceId()
                    .encode());
        }

        // if we got an INDETERMINATE, return it
        if (atLeastOneError) {
            return new Result(Result.DECISION_INDETERMINATE,
                              firstIndeterminateStatus,
                              context.getResourceId().encode());
        }

        // if we got here, then nothing applied to us
        return new Result(Result.DECISION_NOT_APPLICABLE, context
                .getResourceId().encode());
    }
View Full Code Here

        Iterator<Result> i = resCtx.getResults().iterator();

        Map<String, Result> resultMap = new HashMap<String, Result>();

        while (i.hasNext()) {
            Result r = i.next();
            resultMap.put(r.getResource(), r);
        }

        return resultMap;
    }
View Full Code Here

   {
      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

      if(results.size() > 1)
         throw new IllegalArgumentException("Number of results > 1");
      Iterator iter = results.iterator();
      if(iter.hasNext())
      {
         Result res = (Result)iter.next();
         int decision = res.getDecision();
         if(decision == Result.DECISION_PERMIT)
            result = AuthorizationContext.PERMIT;
      }
      return result;
   }
View Full Code Here

TOP

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

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.