Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.Subject


     */
    public Set<Subject> setupSubjects(List<Map<URI, List<AttributeValue>>> subjs) {
        Set<Subject> subjects = new HashSet<Subject>();

        if (subjs == null || subjs.size() == 0) {
            subjects.add(new Subject(new HashSet<Attribute>()));
            return subjects;
        }

        // Go through each of the subjects
        for (Map<URI, List<AttributeValue>> s : subjs) {
            Set<Attribute> attributes = new HashSet<Attribute>();

            // Extract and create the attributes for this subject and add them
            // to the set
            for (URI uri : s.keySet()) {
                List<AttributeValue> attributeValues = s.get(uri);
                for (AttributeValue attributeValue : attributeValues) {
                    attributes.add(new Attribute(uri,
                                                 null,
                                                 null,
                                                 attributeValue));
                }
            }

            // Create a new subject and add the attributes for this subject
            subjects.add(new Subject(attributes));
        }

        return subjects;
    }
View Full Code Here


      Set subjectAttrSet = new HashSet();
      subjectAttrSet.add(subjectAttr);
      subjectAttrSet.addAll(getXACMLRoleSet(roles));
     
      Set subjectSet = new HashSet();
      subjectSet.add(new Subject(subjectAttrSet));
     
      //Create the resource set
      URI resourceUri = new URI(XACMLConstants.RESOURCE_IDENTIFIER);
      Attribute resourceAttr = new Attribute(resourceUri,null,null,
            new StringAttribute(ejbName));
View Full Code Here

      Set subjectAttrSet = new HashSet();
      subjectAttrSet.add(subjectAttr);
      subjectAttrSet.addAll(getXACMLRoleSet(roles));
     
      Set subjectSet = new HashSet();
      subjectSet.add(new Subject(subjectAttrSet));
     
      //Create the resource set
      URI resourceUri = new URI(XACMLConstants.RESOURCE_IDENTIFIER);
      Attribute resourceAttr = new Attribute(resourceUri,null,null,
            new AnyURIAttribute(new URI(request.getRequestURI())));
View Full Code Here

      Set subjectAttrSet = new HashSet();
      subjectAttrSet.add(subjectAttr);
      subjectAttrSet.addAll(getXACMLRoleSet(roles));
     
      Set subjectSet = new HashSet();
      subjectSet.add(new Subject(subjectAttrSet));
     
      //Create the resource set
      URI resourceUri = new URI(XACMLConstants.RESOURCE_IDENTIFIER);
      Attribute resourceAttr = new Attribute(resourceUri,null,null,
            new StringAttribute(ejbName));
View Full Code Here

      Set subjectAttrSet = new HashSet();
      subjectAttrSet.add(subjectAttr);
      subjectAttrSet.addAll(getXACMLRoleSet(roles));
     
      Set subjectSet = new HashSet();
      subjectSet.add(new Subject(subjectAttrSet));
     
      //Create the resource set
      URI resourceUri = new URI(XACMLConstants.RESOURCE_IDENTIFIER);
      Attribute resourceAttr = new Attribute(resourceUri,null,null,
            new AnyURIAttribute(new URI(request.getRequestURI())));
View Full Code Here

/*  85 */     Set subjectAttrSet = new HashSet();
/*  86 */     subjectAttrSet.add(subjectAttr);
/*  87 */     subjectAttrSet.addAll(getXACMLRoleSet(roles));
/*     */
/*  89 */     Set subjectSet = new HashSet();
/*  90 */     subjectSet.add(new Subject(subjectAttrSet));
/*     */
/*  93 */     URI resourceUri = new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id");
/*  94 */     Attribute resourceAttr = new Attribute(resourceUri, null, null, new AnyURIAttribute(new URI(request.getRequestURI())));
/*     */
/*  96 */     Set resourceSet = new HashSet();
View Full Code Here

/*  73 */     Set subjectAttrSet = new HashSet();
/*  74 */     subjectAttrSet.add(subjectAttr);
/*  75 */     subjectAttrSet.addAll(getXACMLRoleSet(roles));
/*     */
/*  77 */     Set subjectSet = new HashSet();
/*  78 */     subjectSet.add(new Subject(subjectAttrSet));
/*     */
/*  81 */     URI resourceUri = new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id");
/*  82 */     Attribute resourceAttr = new Attribute(resourceUri, null, null, new StringAttribute(ejbName));
/*     */
/*  84 */     Set resourceSet = new HashSet();
View Full Code Here

                .getResourceInfoRequestCtxBuilder(readerRole, europe, AccessMode.READ)
                .createRequestCtx();

        // System.out.println(XACMLUtil.asXMLString(request));

        Subject subject = request.getSubjects().iterator().next();
        for (Attribute attr : subject.getAttributes()) {
            if (attr.getId().toString().equals(XACMLConstants.RoleParamPrefix + "persNr"))
                assertTrue(((IntegerAttribute) attr.getValue()).getValue() == 4711);
            if (attr.getId().toString().equals(
                    XACMLConstants.RoleParamPrefix + "geometryRestriction"))
                assertTrue(attr.getValue() instanceof GeometryAttribute);
View Full Code Here

        for (Attribute attr : role.getAttributes()) {
            subjectAttributes.add(attr);
        }

        Subject subject = new Subject(subjectAttributes);
        subjects.add(subject);

    }
View Full Code Here

                .getResourceInfoRequestCtxBuilder(readerRole, europe, AccessMode.READ)
                .createRequestCtx();

        // System.out.println(XACMLUtil.asXMLString(request));

        Subject subject = request.getSubjects().iterator().next();
        for (Attribute attr : subject.getAttributes()) {
            if (attr.getId().toString().equals(XACMLConstants.RoleParamPrefix + "persNr"))
                assertTrue(((IntegerAttribute) attr.getValue()).getValue() == 4711);
            if (attr.getId().toString().equals(
                    XACMLConstants.RoleParamPrefix + "geometryRestriction"))
                assertTrue(attr.getValue() instanceof GeometryAttribute);
View Full Code Here

TOP

Related Classes of com.sun.xacml.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.