Package org.jboss.security.xacml.sunxacml.ctx

Examples of org.jboss.security.xacml.sunxacml.ctx.Attribute


    public void setResourceId(AttributeValue resourceId) {
        this.resourceId = resourceId;

        // there will always be exactly one value for this attribute
        Set attrSet = (Set)(resourceMap.get(RESOURCE_ID));
        Attribute attr = (Attribute)(attrSet.iterator().next());
       
        // remove the old value...
        attrSet.remove(attr);

        // ...and insert the new value
        attrSet.add(new Attribute(attr.getId(), attr.getIssuer(),
                                  attr.getIssueInstant(), resourceId));
    }
View Full Code Here


        // now go through each, considering each Attribute object
        List attributes = new ArrayList();
        Iterator it = attrSet.iterator();

        while (it.hasNext()) {
            Attribute attr = (Attribute)(it.next());

            // make sure the type and issuer are correct
            if ((attr.getType().equals(type)) &&
                ((issuer == null) ||
                 ((attr.getIssuer() != null) &&
                  (attr.getIssuer().equals(issuer.toString()))))) {

                // if we got here, then we found a match, so we want to pull
                // out the values and put them in out list
                attributes.addAll(attr.getValues());
            }
        }

        // see if we found any acceptable attributes
        if (attributes.size() == 0) {
View Full Code Here

                  Iterator ait2 = assignments2.iterator();
                  boolean assignmentsMatch = true;
                 
                  while (ait1.hasNext() && assignmentsMatch)
                  {
                     Attribute attr1 = (Attribute)(ait1.next());
                     Attribute attr2 = (Attribute)(ait2.next());
                    
                     if ((! attr1.getId().equals(attr2.getId())) ||
                           (! attr1.getType().equals(attr2.getType())) ||
                           (! attr1.getValue().equals(attr2.getValue())))
                        assignmentsMatch = false;
                  }
                 
                  matched = assignmentsMatch;
               }
View Full Code Here

      //Create the subject set
      URI subjectAttrUri = new URI("urn:oasis:names:tc:xacml:1.0:subject:subject-id");
      Set subjectAttributeValues = new HashSet();
      subjectAttributeValues.add(new StringAttribute("Anil Saldhana"));
      Attribute subjectAttr = new Attribute(subjectAttrUri, new URI(StringAttribute.identifier), null, null,
            subjectAttributeValues);
      Set subjectAttrSet = new HashSet();
      subjectAttrSet.add(subjectAttr);
      Set subjectSet = new HashSet();
      subjectSet.add(new Subject(subjectAttrSet));

      //Create the resource set
      URI resourceUri = new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id");
      Set resourceAttributeValues = new HashSet();
      resourceAttributeValues.add(new StringAttribute("http://jboss.com/developers/payroll/anilsaldhana"));
      Attribute resourceAttr = new Attribute(resourceUri, new URI(StringAttribute.identifier), null, null,
            resourceAttributeValues);
      Set resourceSet = new HashSet();
      resourceSet.add(resourceAttr);

      //Create the action set
      URI actionUri = new URI("urn:oasis:names:tc:xacml:1.0:action:action-id");
      Set actionAttributeValues = new HashSet();
      actionAttributeValues.add(new StringAttribute("read"));
      Attribute actionAttr = new Attribute(actionUri, new URI(StringAttribute.identifier), null, null,
            actionAttributeValues);
      Set actionSet = new HashSet();
      actionSet.add(actionAttr);

      //Create the environment set
View Full Code Here

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

                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) {
                    throw new ParsingException("Unknown AttributeId", uie);
View Full Code Here

        indenter.in();
       
        Iterator it = assignments.iterator();

        while (it.hasNext()) {
            Attribute attr = (Attribute)(it.next());
            /*out.println(indenter.makeString() +
                        "<AttributeAssignment AttributeId=\"" +
                        attr.getId().toString() + "\" DataType=\"" +
                        attr.getType().toString() + "\">" +
                        attr.getValue().encode() +
                        "</AttributeAssignment>");*/
           
            StringBuilder str = new StringBuilder();
            str.append(indenter.makeString());
            str.append("<AttributeAssignment AttributeId=\"");
            str.append(attr.getId().toString() + "\" DataType=\"");
            str.append(attr.getType().toString() + "\">");
            Set<AttributeValue> attrValues = attr.getValues();
            if(attrValues != null)
            {
               for(AttributeValue val: attrValues)
               {
                  str.append(val.encodeWithTags(true));
View Full Code Here

TOP

Related Classes of org.jboss.security.xacml.sunxacml.ctx.Attribute

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.