Package org.jboss.security.xacml.sunxacml.attr

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


   public static Attribute getInstance(Node root) throws ParsingException {
      URI id = null;
      URI type = null;
      String issuer = null;
      DateTimeAttribute issueInstant = null;
      AttributeValue value = null;
     
      Set<AttributeValue> valueSet = null;

      AttributeFactory attrFactory = AttributeFactory.getInstance();


            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);
           
                if (result.indeterminate())
                    return result;

                                          EvaluationCtx context,
                                          boolean argumentsAreSwapped) {
        Iterator it = allBag.iterator();

        while (it.hasNext()) {
            AttributeValue value = (AttributeValue)(it.next());
            EvaluationResult result =
                any(value, anyBag, function, context, argumentsAreSwapped);
           
            if (result.indeterminate())
                return result;

    * @throws Exception
    */
   public void testAttributeTypeInCTR() throws Exception
   {
      URI RESOURCE_URI = new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id");
      AttributeValue attributeValue = new StringAttribute("TestAttribute");
     
      Attribute attribute = new Attribute(RESOURCE_URI, "somepackage" ,
            new DateTimeAttribute(), attributeValue);
     
      assertNotNull("Attribute type", attribute.getType());

        EvaluationResult result = evalArgs(inputs, context, argValues);
        if (result != null)
            return result;

        // Now that we have real values, perform the date math operation.
        AttributeValue attrResult = null;

        switch (getFunctionId()) {
        // These two functions are basically the same except for sign.
        // And they both need to deal with sign anyway, so they share
        // their code.

        // setup the two bags we'll be using
        BagAttribute [] bags = new BagAttribute[2];
        bags[0] = (BagAttribute)(argValues[0]);
        bags[1] = (BagAttribute)(argValues[1]);

        AttributeValue result = null;
        Set set = new HashSet();
       
        switch(getFunctionId()) {

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

            Iterator it = bags[0].iterator();

            // find all the things in bags[0] that are also in bags[1]
            while (it.hasNext()) {
                AttributeValue value = (AttributeValue)(it.next());
                if (bags[1].contains(value)) {
                    // sets won't allow duplicates, so this addition is ok
                    set.add(value);
                }
            }

        if (result != null)
            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)));
    }

        String name = root.getAttributes().getNamedItem("ParameterName").
            getNodeValue();

        // get the attribute value, the only child of this element
        AttributeFactory attrFactory = AttributeFactory.getInstance();
        AttributeValue value = null;

        try {
            value = attrFactory.createValue(root.getFirstChild());
        } catch (UnknownIdentifierException uie) {
            throw new ParsingException("Unknown AttributeId", uie);

            // Evaluate the argument
            EvaluationResult result = eval.evaluate(context);
            if (result.indeterminate())
                return result;

            AttributeValue value = result.getAttributeValue();
            boolean argBooleanValue = ((BooleanAttribute)value).getValue();

            switch (getFunctionId()) {
            case ID_OR:
                if (argBooleanValue)

            if (SunxacmlUtil.getNodeName(node).equals("AttributeAssignment")) {
                try {
                    URI attrId =
                        new URI(node.getAttributes().
                                getNamedItem("AttributeId").getNodeValue());
                    AttributeValue attrValue = attrFactory.createValue(node);
                    assignments.add(new Attribute(attrId, null, null,
                                                  attrValue));
                } catch (URISyntaxException use) {
                    throw new ParsingException("Error parsing URI", use);
                } catch (UnknownIdentifierException uie) {

TOP

Related Classes of org.jboss.security.xacml.sunxacml.attr.AttributeValue

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.