Package com.sun.xacml.attr

Examples of com.sun.xacml.attr.StringAttribute


            String[] parts = getPathParts(request);
            String pid = parts[1];
            resAttr = ResourceAttributes.getResources(parts);
            if (format != null && !"".equals(format)) {
                resAttr.put(Constants.OBJECT.ENCODING.getURI(),
                            new StringAttribute(format));
            }
            if (eContext != null && !"".equals(eContext)) {
                resAttr.put(Constants.OBJECT.CONTEXT.getURI(),
                            new StringAttribute(eContext));
            }

            actions.put(Constants.ACTION.ID.getURI(),
                        Constants.ACTION.EXPORT.getStringAttribute());
            actions.put(Constants.ACTION.API.getURI(),
View Full Code Here


        Map<URI, AttributeValue> resAttr;
        try {
            resAttr = ResourceAttributes.getRepositoryResources();
            if (format != null && !"".equals(format)) {
                resAttr.put(Constants.OBJECT.FORMAT_URI.getURI(),
                            new StringAttribute(format));
            }

            actions.put(Constants.ACTION.ID.getURI(),
                        Constants.ACTION.INGEST.getStringAttribute());
            actions.put(Constants.ACTION.API.getURI(),
View Full Code Here

        // setup the id and value for the requesting subject
        Map<URI, List<AttributeValue>> subAttr =
                new HashMap<URI, List<AttributeValue>>();
        List<AttributeValue> attrList = new ArrayList<AttributeValue>();
        attrList.add(new StringAttribute(user));
        subAttr.put(Constants.SUBJECT.LOGIN_ID.getURI(), attrList);
        if (fedoraRole != null && fedoraRole.length > 0) {
            attrList = new ArrayList<AttributeValue>();
            for (String f : fedoraRole) {
                attrList.add(new StringAttribute(f));
            }
            subAttr.put(Constants.SUBJECT.ROLE.getURI(), attrList);
        }
        subjects.add(subAttr);

        subAttr = new HashMap<URI, List<AttributeValue>>();
        attrList = new ArrayList<AttributeValue>();
        attrList.add(new StringAttribute(user));
        subAttr.put(Constants.SUBJECT.USER_REPRESENTED.getURI(), attrList);
        if (fedoraRole != null && fedoraRole.length > 0) {
            attrList = new ArrayList<AttributeValue>();
            for (String f : fedoraRole) {
                attrList.add(new StringAttribute(f));
            }
            subAttr.put(Constants.SUBJECT.ROLE.getURI(), attrList);
        }
        subjects.add(subAttr);

        subAttr = new HashMap<URI, List<AttributeValue>>();
        attrList = new ArrayList<AttributeValue>();
        attrList.add(new StringAttribute(user));
        subAttr.put(Constants.SUBJECT.ROLE.getURI(), attrList);
        if (fedoraRole != null && fedoraRole.length > 0) {
            attrList = new ArrayList<AttributeValue>();
            for (String f : fedoraRole) {
                attrList.add(new StringAttribute(f));
            }
            subAttr.put(Constants.SUBJECT.ROLE.getURI(), attrList);
        }
        subjects.add(subAttr);
View Full Code Here

        Map<URI, AttributeValue> envAttr = new HashMap<URI, AttributeValue>();
        String ip = request.getRemoteAddr();

        if (ip != null && !"".equals(ip)) {
            envAttr.put(Constants.HTTP_REQUEST.CLIENT_IP_ADDRESS.getURI(),
                    new StringAttribute(ip));
        }

        return envAttr;
    }
View Full Code Here

    public static Map<URI, AttributeValue> getResources(String pid) {
        Map<URI, AttributeValue> resAttr = new HashMap<URI, AttributeValue>();
        if (pid != null && !"".equals(pid)) {
            resAttr.put(Constants.OBJECT.PID.getURI(),
                        new StringAttribute(pid));
            try{
                resAttr.put(Constants.XACML1_RESOURCE.ID.getURI(),
                            new AnyURIAttribute(new URI(pid)));
            } catch (URISyntaxException e) {
                logger.warn("pid {} is not a valid uri; write policies against the StringAttribute {} instead.",
                            pid,
                            Constants.OBJECT.PID.uri);
                resAttr.put(Constants.XACML1_RESOURCE.ID.getURI(),
                            new StringAttribute(pid));
            }
        }
        return resAttr;
    }
View Full Code Here

                if ("datastreams".equals(parts[2])) {
                    String dsID = parts[3];
                    if (dsID.endsWith(".xml")) dsID = dsID.substring(0,dsID.length()-4);
                    if (dsID != null && !"".equals(dsID)) {
                        resAttr.put(Constants.DATASTREAM.ID.getURI(),
                                new StringAttribute(dsID));
                    }
                }
            }
        } else {
            resAttr = new HashMap<URI, AttributeValue>();
View Full Code Here

      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(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));
      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)));
     
     
      //TODO: Get hold of the invocation arguments and populate in the xacml request
     
      //Create the Environment set
View Full Code Here

      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(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())));
      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

         Principal role = iter.next();
         if(role instanceof SimplePrincipal)
         {
            SimplePrincipal sp = (SimplePrincipal)role;
            Attribute roleAttr = new Attribute(roleURI,null,null,
                new StringAttribute(sp.getName()));
            roleset.add(roleAttr);
         }
      }
      return roleset;
   }
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.