Examples of BagAttribute


Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

                                    result.getStatus().getMessage());
                    return result;
                }

                // if the result wasn't empty, then return the result
                BagAttribute bag = (BagAttribute)(result.getAttributeValue());
                if (! bag.isEmpty())
                    return result;
            }
        }

        // if we got here then there were no errors but there were also no
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

                                result.getStatus().getMessage());
                return result;
            }

            // if the result wasn't empty, then return the result
            BagAttribute bag = (BagAttribute)(result.getAttributeValue());
            if (! bag.isEmpty())
                return result;
        }

        // if we got here then there were no errors but there were also no
        // matches, so we have to return an empty bag
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

        switch (getFunctionId()) {
           
            // *-one-and-only takes a single bag and returns a
            // single value of baseType
        case ID_BASE_ONE_AND_ONLY: {
            BagAttribute bag = (BagAttribute)(argValues[0]);

            if (bag.size() != 1)
                return makeProcessingError(getFunctionName() + " expects " +
                                           "a bag that contains a single " +
                                           "element, got a bag with " +
                                           bag.size() + " elements");

            attrResult = (AttributeValue)(bag.iterator().next());
            break;
        }

            // *-size takes a single bag and returns an integer
        case ID_BASE_BAG_SIZE: {
            BagAttribute bag = (BagAttribute)(argValues[0]);

            attrResult = new IntegerAttribute(bag.size());
            break;
        }

            // *-bag takes any number of elements of baseType and
            // returns a bag containing those elements
        case ID_BASE_BAG: {
            List argsList = Arrays.asList(argValues);

            attrResult = new BagAttribute(getReturnType(), argsList);
            break;
        }
        }

        return new EvaluationResult(attrResult);
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

            // the first bag and a single value from the second bag, and if
            // any evaluation is true return true, otherwise return false

            result = new EvaluationResult(BooleanAttribute.getInstance(false));
            Iterator it = ((BagAttribute)args[0]).iterator();
            BagAttribute bag = (BagAttribute)(args[1]);
           
            while (it.hasNext()) {
                AttributeValue value = (AttributeValue)(it.next());
                result = any(value, bag, function, context, false);
               
                if (result.indeterminate())
                    return result;
           
                if (((BooleanAttribute)(result.
                                        getAttributeValue())).getValue())
                    break;
            }
            break;
        }

        case ID_ALL_OF_ANY: {

            // param: boolean-function, bag, bag of same type
            // return: boolean
            // iterate through the first bag, and if for each of those values
            // one of the values in the second bag matches then return true,
            // otherwise return false

            result = allOfAny((BagAttribute)(args[1]), (BagAttribute)(args[0]),
                              function, context);
            break;
        }

        case ID_ANY_OF_ALL: {

            // param: boolean-function, bag, bag of same type
            // return: boolean
            // iterate through the second bag, and if for each of those values
            // one of the values in the first bag matches then return true,
            // otherwise return false

            result = anyOfAll((BagAttribute)(args[0]), (BagAttribute)(args[1]),
                              function, context);
            break;
        }

        case ID_ALL_OF_ALL: {

            // param: boolean-function, bag, bag of same type
            // return: boolean
            // iterate through the first bag, and for each of those values
            // if every value in the second bag matches using the given
            // function, then return true, otherwise return false

            result = new EvaluationResult(BooleanAttribute.getInstance(true));
            Iterator it = ((BagAttribute)args[0]).iterator();
            BagAttribute bag = (BagAttribute)(args[1]);

            while (it.hasNext()) {
                AttributeValue value = (AttributeValue)(it.next());
                result = all((AttributeValue)(it.next()), bag, function,
                             context);
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

      EvaluationResult result = context.getSubjectAttribute(attributeType, SUBJECT_IDENTIFIER, issuer, subjectLogger);
      if (result.indeterminate())
         return result;

      // Check that we succeeded in getting the subject identifier
      BagAttribute bag = (BagAttribute) (result.getAttributeValue());
      if (bag.isEmpty())
      {
         ArrayList code = new ArrayList();
         code.add(Status.STATUS_MISSING_ATTRIBUTE);
         Status status = new Status(code, "missing subject-id");
         return new EvaluationResult(status);
      }

      // Finally search for the subject with the role-mapping defined,
      // and if there is a match, add their role
      BagAttribute returnBag = null;
      Iterator it = bag.iterator();
      while (it.hasNext())
      {
         StringAttribute attr = (StringAttribute) (it.next());
         if (attr.getValue().equals("Anil Saldhana"))
         {
            Set set = new HashSet();
            set.add(new StringAttribute("Developer"));
            returnBag = new BagAttribute(attributeType, set);
            break;
         }
      }

      return new EvaluationResult(returnBag);
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

                }

                list.add(attrFactory.createValue(type, text));
            }
           
            return new EvaluationResult(new BagAttribute(type, list));
        } catch (ParsingException pe) {
            return createProcessingError(pe.getMessage());
        } catch (UnknownIdentifierException uie) {
            return createProcessingError("unknown attribute type: " + type);
        }
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

                    // sets won't allow duplicates, so this addition is ok
                    set.add(value);
                }
            }

            result = new BagAttribute(bags[0].getType(), set);

            break;

            // *-union takes two bags of the same type and returns a bag of
            // that type
        case ID_BASE_UNION:
            // create a bag with all the elements from both inputs, removing
            // all duplicate values

            Iterator it0 = bags[0].iterator();
            while (it0.hasNext()) {
                // first off, add all elements from the first bag...the set
                // will ignore all duplicates
                set.add(it0.next());
            }
           
            Iterator it1 = bags[1].iterator();
            while (it1.hasNext()) {
                // now add all the elements from the second bag...again, all
                // duplicates will be ignored by the set
                set.add(it1.next());
            }

            result = new BagAttribute(bags[0].getType(), set);

            break;
        }
       
        return new EvaluationResult(result);
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

            return result;
       
        // *-is-in takes a bag and an element of baseType and
        // returns a single boolean value
        AttributeValue item = (AttributeValue)(argValues[0]);
        BagAttribute bag = (BagAttribute)(argValues[1]);
       
        return new EvaluationResult(BooleanAttribute.
                                    getInstance(bag.contains(item)));
    }
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

        // in a higher-order case, if anything is INDETERMINATE, then
        // we stop right away
        if (result.indeterminate())
            return result;
       
        BagAttribute bag = (BagAttribute)(result.getAttributeValue());
       
        // param: function, bag
        // return: bag
        // for each value in the bag evaluate the given function with
        // the value and put the function result in a new bag that
        // is ultimately returned

        Iterator it = bag.iterator();
        List outputs = new ArrayList();

        while (it.hasNext()) {
            List params = new ArrayList();
            params.add(it.next());
            result = function.evaluate(params, context);

            if (result.indeterminate())
                return result;

            outputs.add(result.getAttributeValue());
        }

        return new EvaluationResult(new BagAttribute(returnType, outputs));
    }
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.BagAttribute

     */
    private EvaluationResult makeBag(AttributeValue attribute) {
        Set set = new HashSet();
        set.add(attribute);

        BagAttribute bag = new BagAttribute(attribute.getType(), set);

        return new EvaluationResult(bag);
    }
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.