Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.Attribute


    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


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

        setB.addAll(b.getAttributes());

        Iterator<Attribute> iterA = setA.iterator();
        Iterator<Attribute> iterB = setB.iterator();
        while (iterA.hasNext() && iterB.hasNext()) {
            Attribute attrA = iterA.next();
            Attribute attrB = iterB.next();
            result = cmp.compare(attrA, attrB);

            if (result != 0) {
                return result;
            }
View Full Code Here

    /*
     * (non-Javadoc)
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
     */
    public int compare(Object o1, Object o2) {
        Attribute a = (Attribute) o1;
        Attribute b = (Attribute) o2;

        int result = a.getId().toString().compareTo(b.getId().toString());

        if (result == 0) {
            result = a.getType().toString().compareTo(b.getType().toString());
        } else {
            return result;
        }

        if (result == 0) {
            result = a.getValue().encode().compareTo(b.getValue().encode());
        } else {
            return result;
        }

        if (result == 0
                && (a.getIssueInstant() != null || b.getIssueInstant() != null)) {
            if (a.getIssueInstant() == null && b.getIssueInstant() == null) {
                result = 0;
            } else if (a.getIssueInstant() != null
                    && b.getIssueInstant() == null) {
                result = 1;
            } else if (a.getIssueInstant() == null
                    && b.getIssueInstant() != null) {
                result = -1;
            } else {
                result =
                        a.getIssueInstant().encode().compareTo(b
                                .getIssueInstant().encode());
            }
        }

        return result;
View Full Code Here

                                           resources,
                                           actions,
                                           Collections.EMPTY_SET);
                    Iterator<Attribute> tempit = actions.iterator();
                    while (tempit.hasNext()) {
                        Attribute tempobj = tempit.next();
                        logger.debug("request action has {}={}", tempobj.getId(), tempobj.getValue().toString());
                    }
                    m_registry.registerContext(contextIndex, context);
                    long st = System.currentTimeMillis();
                    try {
                        response = m_pdp.evaluate(request);
View Full Code Here

    }

    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="
                    + subjectAttribute.getValue());
        }
        subjectAttributes.add(subjectAttribute);
        Subject singleSubject = new Subject(subjectAttributes);
        Set<Subject> subjects = new HashSet<Subject>();
        subjects.add(singleSubject);
View Full Code Here

    protected Set<Attribute> wrapActions(String actionId,
                                  String actionApi,
                                  String contextIndex) {
        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

    }

    protected Set<Attribute> wrapResources(String pid, String namespace)
            throws AuthzOperationalException {
        Set<Attribute> resources = new HashSet<Attribute>();
        Attribute attribute = null;
        attribute =
                new Attribute(Constants.XACML1_RESOURCE.ID.getURI(),
                              null,
                              null,
                              new StringAttribute(""));
        resources.add(attribute);
        attribute =
                new Attribute(RESOURCE_ID_URI,
                              null,
                              null,
                              new StringAttribute(pid));
        resources.add(attribute);
        attribute =
                new Attribute(RESOURCE_NAMESPACE_URI,
                              null,
                              null,
                              new StringAttribute(namespace));
        resources.add(attribute);
        return resources;
View Full Code Here

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

            logger.error("Error finding parents.", e);
            throw new MelcoeXacmlException("Error finding parents.", e);
        }

        for (URI uri : res.keySet()) {
            attributes.add(new Attribute(uri, null, null, res.get(uri)));
        }

        return attributes;
    }
View Full Code Here

TOP

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