Package com.sun.xacml

Examples of com.sun.xacml.AbstractPolicy


       Iterator it = policyList.iterator();
       while (it.hasNext())
       {
           String str = (String)(it.next());
           AbstractPolicy policy = null;
           try
           {
              try
              {
                      // first try to load it as a URL
View Full Code Here


     
       try
       {
          if(this.encounteredParsingException)
             return new PolicyFinderResult(new Status(aList));
           AbstractPolicy policy = policies.getPolicy(context);

           if (policy == null)
               return new PolicyFinderResult();
           else
               return new PolicyFinderResult(policy);
View Full Code Here

  {
    final DocumentSet mainPolicyDocs = XACMLUtil.getPolicyDocuments(broker, false);
    if(mainPolicyDocs == null)
      {return new PolicyFinderResult();}

    AbstractPolicy matchedPolicy = null;
    AbstractPolicy policy;
    MatchResult match;
    int result;
    try
    {
      final XACMLUtil util = pdp.getUtil();
      for(final Iterator<DocumentImpl> it = mainPolicyDocs.getDocumentIterator(); it.hasNext();)
      {
        policy = util.getPolicyDocument(it.next());
        match = policy.match(context);
        result = match.getResult();
        if(result == MatchResult.INDETERMINATE)
          {return new PolicyFinderResult(match.getStatus());}
        else if(result == MatchResult.MATCH)
        {
View Full Code Here

    final BrokerPool pool = pdp.getBrokerPool();
    DBBroker broker = null;
    try
    {
      broker = pool.get(pool.getSecurityManager().getSystemSubject());
      final AbstractPolicy policy = pdp.getUtil().findPolicy(broker, idReference, type);
      return (policy == null) ? new PolicyFinderResult() : new PolicyFinderResult(policy);
    }
    catch(final Exception e)
    {
      return XACMLUtil.errorResult("Error resolving id '" + idReference.toString() + "': " + e.getMessage(), e);
View Full Code Here

  */
  public AbstractPolicy getPolicyDocument(DocumentImpl policyDoc) throws ParsingException
  {
    //TODO: use xmldbUri
    final String name = policyDoc.getURI().toString();
    AbstractPolicy policy = (AbstractPolicy)POLICY_CACHE.get(name);
    if(policy == null)
    {
      policy = parsePolicyDocument(policyDoc);
      POLICY_CACHE.put(name, policy);
    }
View Full Code Here

        PolicyFinderResult policyFinderResult = null;
        try {
            List<AbstractPolicy> policies = new ArrayList<AbstractPolicy>(m_repositoryPolicies);
            String pid = getPid(context);
            if (pid != null && !"".equals(pid)) {
                AbstractPolicy objectPolicyFromObject =
                        m_policyLoader.loadObjectPolicy(m_policyParser.copy(),
                                                         pid,
                                                         m_validateObjectPoliciesFromDatastream);
                if (objectPolicyFromObject != null) {
                    policies.add(objectPolicyFromObject);
View Full Code Here

                    policies.putAll(loadPolicies(policyParser, validate, file));
                } else {
                    if (file.getName().endsWith(".xml")) {
                        logger.info("Loading policy: {}", file.getPath());
                        InputStream policyStream = new FileInputStream(file);
                        AbstractPolicy policy = policyParser.parse(policyStream, validate);
                        logger.info("Loaded policy ID: {}", policy.getId());
                        String key = null;
                        if (m_override == Strategy.FILENAME) {
                            key = file.getName();
                        }
                        else key = policy.getId().toString();
                        policies.put(key, policy);
                    }
                }
            }
        }
View Full Code Here

        Set<AbstractPolicy> matchedPolicies = new HashSet<AbstractPolicy>();

        Iterator it = policyElements.iterator();
        while (it.hasNext()) {
            AbstractPolicy policy =
                    ((PolicyCombinerElement) it.next()).getPolicy();

            // make sure that the policy matches the context
            MatchResult match = policy.match(context);

            if (match.getResult() == MatchResult.INDETERMINATE) {
                atLeastOneError = true;

                // keep track of the first error, regardless of cause
                if (firstIndeterminateStatus == null) {
                    firstIndeterminateStatus = match.getStatus();
                }
            } else if (match.getResult() == MatchResult.MATCH) {
                matchedPolicies.add(policy);
            }
        }

        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;
            }
View Full Code Here

            throws TopLevelPolicyException, PolicyIndexException {
        Map<String, AbstractPolicy> potentialPolicies =
                m_policyIndex.getPolicies(eval, m_policyFinder);
        logger.debug("Obtained policies: {}", potentialPolicies.size());

        AbstractPolicy policy = matchPolicies(eval, potentialPolicies);
        logger.debug("Matched policies and created abstract policy.");

        return policy;
    }
View Full Code Here

        Map<String, AbstractPolicy> list =
                new HashMap<String, AbstractPolicy>();

        // get an iterator over all the identifiers
        for (String policyId : policyList.keySet()) {
            AbstractPolicy policy = policyList.get(policyId);

            MatchResult match = policy.match(eval);

            int result = match.getResult();
            if (result == MatchResult.INDETERMINATE) {
                throw new TopLevelPolicyException(match.getStatus());
            }

            // if we matched, we keep track of the matching policy...
            if (result == MatchResult.MATCH) {
                // ...first checking if this is the first match and if
                // we automatically nest policies
                if (m_combiningAlg == null && list.size() > 0) {
                    ArrayList<String> code = new ArrayList<String>();
                    code.add(Status.STATUS_PROCESSING_ERROR);
                    Status status =
                            new Status(code, "too many applicable"
                                    + " top-level policies");
                    throw new TopLevelPolicyException(status);
                }

                if (logger.isDebugEnabled()) {
                    logger.debug("Matched policy: {}", policyId);
                }

                list.put(policyId, policy);
            }
        }

        // no errors happened during the search, so now take the right
        // action based on how many policies we found
        switch (list.size()) {
            case 0:
                return null;
            case 1:
                Iterator<AbstractPolicy> i = list.values().iterator();
                AbstractPolicy p = i.next();
                return p;
            default:
                return new PolicySet(parentPolicyId,
                                     m_combiningAlg,
                                     m_target,
View Full Code Here

TOP

Related Classes of com.sun.xacml.AbstractPolicy

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.