Package com.sun.xacml.attr

Examples of com.sun.xacml.attr.StringAttribute


      Iterator<Principal> iter = roles != null ? roles.iterator(): null;
      while(iter != null && iter.hasNext())
      {
         Principal role = iter.next();
         Attribute roleAttr = new Attribute(roleURI,null,null,
               new StringAttribute(role.getName()));
           roleset.add(roleAttr)
      }
      return roleset;
   }
View Full Code Here


      Principal principal = request.getUserPrincipal();
      String username = principal.getName()
      //Create the subject set
      URI subjectAttrUri = new URI(XACMLConstants.SUBJECT_IDENTIFIER);
      Attribute subjectAttr = new Attribute(subjectAttrUri,null,null,
            new StringAttribute(username));
      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())));
      Set resourceSet = new HashSet();
      resourceSet.add(resourceAttr);
     
      //Create the action set
      Set actionSet = new HashSet();
      actionSet.add(new Attribute(new URI(XACMLConstants.ACTION_IDENTIFIER),
             null,null, new StringAttribute(action)));
     
      Enumeration<String> enumer = request.getParameterNames();
      while(enumer.hasMoreElements())
      {
         String paramName = enumer.nextElement();
         String paramValue = request.getParameter(paramName);
         URI actionUri = new URI(actionURIBase + paramName);
         Attribute actionAttr = new Attribute(actionUri,null,null,
               new StringAttribute(paramValue));
         actionSet.add(actionAttr);
      }
      //Create the Environment set
      Set environSet = new HashSet();
      //Current time
View Full Code Here

      List<Role> croles = roles.getRoles();
     
      for(Role r: croles)
      {
         Attribute roleAttr = new Attribute(roleURI,null,null,
            new StringAttribute(r.getRoleName()));
         roleset.add(roleAttr);
      }
      return roleset;
   }
View Full Code Here

      {return errorResult("No user exists for UID '" + uid + "'");}
   
    if(XACMLConstants.GROUP_ATTRIBUTE.equals(attributeId))
      {return getGroups(user);}
    else if(XACMLConstants.USER_NAME_ATTRIBUTE.equals(attributeId))
      {return new EvaluationResult(new StringAttribute(user.getName()));}
    else
      {return errorResult("UserAttributeModule cannot handle attribute '" + attributeId + "'");}
  }
View Full Code Here

  {
    final String[] groupArray = user.getGroups();
    final int size = (groupArray == null) ? 0 : groupArray.length;
    final Set<StringAttribute> groupAttributes = new HashSet<StringAttribute>(size);
    for(int i = 0; i < size; ++i)
      groupAttributes.add(new StringAttribute(groupArray[i]));
    final AttributeValue value = new BagAttribute(XACMLConstants.STRING_TYPE, groupAttributes);
    return new EvaluationResult(value);
   
  }
View Full Code Here

  * @param user The user making the request
  * @return A <code>Subject</code> for use in a <code>RequestCtx</code>
  */
  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

      {return;}
    if(attrID == null)
      {throw new NullPointerException("Attribute ID cannot be null");}
    if(attrValue == null)
      {throw new NullPointerException("Attribute value cannot be null");}
    final AttributeValue value = new StringAttribute(attrValue);
    final Attribute attr = new Attribute(attrID, null, null, value);
    attributes.add(attr);
  }
View Full Code Here

        Set<AttributeValue> set = new HashSet<AttributeValue>();
        if (temp instanceof String) {
            logger.debug("AttributeFinder:findAttribute will return a String {}", iAm());
            if (attributeType.toString().equals(StringAttribute.identifier)) {
                set.add(new StringAttribute((String) temp));
            } else if (attributeType.toString()
                    .equals(DateTimeAttribute.identifier)) {
                DateTimeAttribute tempDateTimeAttribute;
                try {
                    tempDateTimeAttribute =
                            DateTimeAttribute.getInstance((String) temp);
                    set.add(tempDateTimeAttribute);
                } catch (Throwable t) {
                }
            } else if (attributeType.toString()
                    .equals(DateAttribute.identifier)) {
                DateAttribute tempDateAttribute;
                try {
                    tempDateAttribute =
                            DateAttribute.getInstance((String) temp);
                    set.add(tempDateAttribute);
                } catch (Throwable t) {
                }
            } else if (attributeType.toString()
                    .equals(TimeAttribute.identifier)) {
                TimeAttribute tempTimeAttribute;
                try {
                    tempTimeAttribute =
                            TimeAttribute.getInstance((String) temp);
                    set.add(tempTimeAttribute);
                } catch (Throwable t) {
                }
            } else if (attributeType.toString()
                    .equals(IntegerAttribute.identifier)) {
                IntegerAttribute tempIntegerAttribute;
                try {
                    tempIntegerAttribute =
                            IntegerAttribute.getInstance((String) temp);
                    set.add(tempIntegerAttribute);
                } catch (Throwable t) {
                }
            } //xacml fixup
            //was set.add(new StringAttribute((String)temp));
        } else if (temp instanceof String[]) {
            logger.debug("AttributeFinder:findAttribute will return a String[] ", iAm());
            for (int i = 0; i < ((String[]) temp).length; i++) {
                if (((String[]) temp)[i] == null) {
                    continue;
                }
                if (attributeType.toString().equals(StringAttribute.identifier)) {
                    set.add(new StringAttribute(((String[]) temp)[i]));
                } else if (attributeType.toString()
                        .equals(DateTimeAttribute.identifier)) {
                    logger.debug("USING AS DATETIME:{}", ((String[]) temp)[i]);
                    DateTimeAttribute tempDateTimeAttribute;
                    try {
View Full Code Here

        m_pdp = null;
    }

    protected Set<Subject> wrapSubjects(String subjectLoginId) {
        logger.debug("wrapSubjectIdAsSubjects(): " + subjectLoginId);
        StringAttribute stringAttribute = new StringAttribute("");
        Attribute subjectAttribute =
                new Attribute(Constants.XACML1_SUBJECT.ID.getURI(), null, null, stringAttribute);
        logger.debug("wrapSubjectIdAsSubjects(): subjectAttribute, id="
                + subjectAttribute.getId() + ", type="
                + subjectAttribute.getType() + ", value="
                + subjectAttribute.getValue());
        Set<Attribute> subjectAttributes = new HashSet<Attribute>();
        subjectAttributes.add(subjectAttribute);
        if (subjectLoginId != null && !"".equals(subjectLoginId)) {
            stringAttribute = new StringAttribute(subjectLoginId);
            subjectAttribute =
                    new Attribute(SUBJECT_ID_URI, null, null, stringAttribute);
            logger.debug("wrapSubjectIdAsSubjects(): subjectAttribute, id="
                    + subjectAttribute.getId() + ", type="
                    + subjectAttribute.getType() + ", value="
View Full Code Here

        Set<Attribute> actions = new HashSet<Attribute>();
        Attribute action =
                new Attribute(Constants.XACML1_ACTION.ID.getURI(),
                              null,
                              null,
                              new StringAttribute(""));
        actions.add(action);
        action =
                new Attribute(ACTION_ID_URI,
                              null,
                              null,
                              new StringAttribute(actionId));
        actions.add(action);
        action =
                new Attribute(ACTION_API_URI,
                              null,
                              null,
                              new StringAttribute(actionApi));
        actions.add(action);
        action =
                new Attribute(ACTION_CONTEXT_URI,
                              null,
                              null,
                              new StringAttribute(contextIndex));
        actions.add(action);
        return actions;
    }
View Full Code Here

TOP

Related Classes of com.sun.xacml.attr.StringAttribute

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.