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

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


            throw new ParsingException("Request must a contain subject");

        // now go through the subject attributes
        Iterator it = subjects.iterator();
        while (it.hasNext()) {
            Subject subject = (Subject)(it.next());

            URI category = subject.getCategory();
            Map categoryMap = null;

            // see if we've already got a map for the category
            if (subjectMap.containsKey(category)) {
                categoryMap = (Map)(subjectMap.get(category));
            } else {
                categoryMap = new HashMap();
                subjectMap.put(category, categoryMap);
            }

            // iterate over the set of attributes
            Iterator attrIterator = subject.getAttributesAsList().iterator();

            while (attrIterator.hasNext()) {
                Attribute attr = (Attribute)(attrIterator.next());
                String id = attr.getId().toString();
View Full Code Here


            throw new ParsingException("Request must a contain subject");

        // now go through the subject attributes
        Iterator it = subjects.iterator();
        while (it.hasNext()) {
            Subject subject = (Subject)(it.next());

            URI category = subject.getCategory();
            Map categoryMap = null;

            // see if we've already got a map for the category
            if (subjectMap.containsKey(category)) {
                categoryMap = (Map)(subjectMap.get(category));
            } else {
                categoryMap = new HashMap();
                subjectMap.put(category, categoryMap);
            }

            // iterate over the set of attributes
            Iterator attrIterator = subject.getAttributes().iterator();

            while (attrIterator.hasNext()) {
                Attribute attr = (Attribute)(attrIterator.next());
                String id = attr.getId().toString();
View Full Code Here

      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
      Set environSet = new HashSet();

      RequestCtx request = new RequestCtx(subjectSet, resourceSet, actionSet, environSet);
      assertNotNull("XACML Request != null", request);

      //Log the request for viewing
      if (DEBUG)
         XACMLUtil.logRequest(request);

      //Test the request contents
      Set subjects = request.getSubjects();
      assertTrue("We have one subject?", subjects.size() == 1);
      Subject subj = (Subject) (subjects.iterator().next());
      assertNotNull("Subject != null", subj);
      assertEquals("Attributes in subject match", subjectAttr, (Attribute) (subj.getAttributes().iterator().next()));

      //Test the resource attributes
      Set resources = request.getResource();
      assertTrue("# of resources = 1", resources.size() == 1);
      assertEquals("Attributes in resources match", resourceAttr, (Attribute) (resources.iterator().next()));
View Full Code Here

TOP

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

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.