Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.Subject


        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

            subjects = new HashSet<Subject>();
            resources = new HashSet<Attribute>();
            actions = new HashSet<Attribute>();
            environment = new HashSet<Attribute>();

            subjects.add(new Subject(getAttributes(
                    "urn:oasis:names:tc:xacml:1.0:subject:subject-id",
                    "http://www.w3.org/2001/XMLSchema#string", subject)));
            resources.add(getAttribute("urn:oasis:names:tc:xacml:1.0:resource:resource-id",
                    "http://www.w3.org/2001/XMLSchema#string", resource));
            actions.add(getAttribute("urn:oasis:names:tc:xacml:1.0:action:action-id",
View Full Code Here

      Set<Attribute> subjectAttrSet = new HashSet<Attribute>();
      subjectAttrSet.add(subjectAttr);
      subjectAttrSet.addAll(getXACMLRoleSet(roles));
     
      Set<Subject> subjectSet = new HashSet<Subject>();
      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<Attribute> subjectAttrSet = new HashSet<Attribute>();
      subjectAttrSet.add(subjectAttr);
      subjectAttrSet.addAll(getXACMLRoleSet(roles));
     
      Set<Subject> subjectSet = new HashSet<Subject>();
      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(callerRoles));
     
      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

  */
  public Subject createUserSubject(Account user)
  {
    final AttributeValue value = new StringAttribute(user.getName());
    final Attribute attr = new Attribute(XACMLConstants.SUBJECT_ID_ATTRIBUTE, null, null, value);
    return new Subject(XACMLConstants.ACCESS_SUBJECT, Collections.singleton(attr));
  }
View Full Code Here

    addStringAttribute(attributes, XACMLConstants.MODULE_CATEGORY_ATTRIBUTE, getModuleCategory(module));
    final XACMLSource moduleSrc = generateModuleSource(module);
    addSourceAttributes(attributes, moduleSrc);
    addStringAttribute(attributes, XACMLConstants.SUBJECT_ID_ATTRIBUTE, moduleSrc.createId());

    return new Subject(XACMLConstants.CODEBASE_SUBJECT, attributes);
  }
View Full Code Here

  {
    if(user == null)
      {throw new NullPointerException("User cannot be null");}
    final Set<Subject> subjects = new HashSet<Subject>(4);

    final Subject userSubject = createUserSubject(user);
    subjects.add(userSubject);

    if(contextModule != null)
    {
      final Subject moduleSubject = createModuleSubject(contextModule);
      subjects.add(moduleSubject);
    }
    return subjects;
  }
View Full Code Here

                    + subjectAttribute.getId() + ", type="
                    + subjectAttribute.getType() + ", value="
                    + subjectAttribute.getValue());
        }
        subjectAttributes.add(subjectAttribute);
        Subject singleSubject = new Subject(subjectAttributes);
        Set<Subject> subjects = new HashSet<Subject>();
        subjects.add(singleSubject);
        return subjects;
    }
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.