Package com.sun.xacml.ctx

Examples of com.sun.xacml.ctx.Attribute


        try {
            geomAttr = new GeometryAttribute(g, srsName, null, GMLVersion.Version3, gmlType);
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        resources.add(new Attribute(attributeURI, null, null, geomAttr));
    }
View Full Code Here


                Log.severe("No obligation with id: " + XACMLConstants.CatalogModeObligationId);
                Log.severe(XACMLUtil.asXMLString(requestCtx));
                return useDefaultMode();
            }

            Attribute catalogModeAssignment = obligation.getAssignments().iterator().next();
            if (catalogModeAssignment == null
                    || CatalogModeMap.containsKey(((StringAttribute) catalogModeAssignment
                            .getValue()).getValue()) == false) {
                Log.severe("No valid catalog mode ");
                Log.severe(XACMLUtil.asXMLString(requestCtx));
                return useDefaultMode();
            }

            String catalogModeKey = ((StringAttribute) catalogModeAssignment.getValue()).getValue();
            mode = CatalogModeMap.get(catalogModeKey);
            return mode;
        }

    }
View Full Code Here

            if (set.size() > 1) {
                System.err.println("Resource may contain only one " + "resource-scope Attribute");
                throw new ParsingException("too many resource-scope attrs");
            }

            Attribute attr = (Attribute) (set.iterator().next());
            AttributeValue attrValue = attr.getValue();

            // scope must be a string, so throw an exception otherwise
            if (!attrValue.getType().toString().equals(StringAttribute.identifier))
                throw new ParsingException("scope attr must be a string");
View Full Code Here

    public void setResourceId(AttributeValue resourceId) {
        this.resourceId = resourceId;

        // there will always be exactly one value for this attribute
        Set<Attribute> attrSet = resourceMap.get(RESOURCE_ID);
        Attribute attr = (Attribute) (attrSet.iterator().next());

        // remove the old value...
        attrSet.remove(attr);

        // ...and insert the new value
        attrSet.add(new Attribute(attr.getId(), attr.getIssuer(), attr.getIssueInstant(),
                resourceId));
    }
View Full Code Here

        Set<Attribute> actions = new HashSet<Attribute>(1);
        addAction(actions);

        Set<Attribute> environment = new HashSet<Attribute>(1);
        if (userName != null) {
            environment.add(new Attribute(XACMLConstants.UserEnvironmentURI,null,null,new StringAttribute(userName)));           
        }

       
        RequestCtx ctx = new RequestCtx(subjects, resources, actions, environment);
        return ctx;
View Full Code Here

                        if (((Geometry) value).getUserData() == null)
                            throw new RuntimeException("Property: " + propertyName
                                    + " : Geometry must have srs name as userdata");
                    }
                    AttributeValue attrValue = createAttributeValueFromObject(value);
                    Attribute xacmlAttr = new Attribute(attr.getId(), null, null, attrValue);
                    role.getAttributes().add(xacmlAttr);
                }
            }
        }
View Full Code Here

        addAction(actions);

        Set<Attribute> environment = new HashSet<Attribute>(1);
        try {
            if (remoteHost != null) {
                environment.add(new Attribute(XACMLConstants.DNSNameEnvironmentURI, null, null,
                        new DNSNameAttribute(remoteHost)));
            }
            if (remoteIP != null) {
                InetAddress addr = InetAddress.getByName(remoteIP);
                if (addr instanceof Inet4Address)
                    environment.add(new Attribute(XACMLConstants.IPAddressEnvironmentURI, null, null,
                            new IPv4AddressAttribute(addr)));
                if (addr instanceof Inet6Address) {
                    environment.add(new Attribute(XACMLConstants.IPAddressEnvironmentURI, null, null,
                            new IPv6AddressAttribute(addr)));
                }
            }
        } catch (Exception ex) {
            throw new RuntimeException(ex); // should not happen
View Full Code Here

            if (node.getNodeName().equals("AttributeAssignment")) {
                try {
                    URI attrId = new URI(node.getAttributes().getNamedItem("AttributeId")
                            .getNodeValue());
                    AttributeValue attrValue = attrFactory.createValue(node);
                    assignments.add(new Attribute(attrId, null, null, attrValue));
                } catch (URISyntaxException use) {
                    throw new ParsingException("Error parsing URI", use);
                } catch (UnknownIdentifierException uie) {
                    throw new ParsingException("Unknown AttributeId", uie);
                } catch (Exception e) {
View Full Code Here

                        Iterator<Attribute> ait1 = assignments1.iterator();
                        Iterator<Attribute> ait2 = assignments2.iterator();
                        boolean assignmentsMatch = true;

                        while (ait1.hasNext() && assignmentsMatch) {
                            Attribute attr1 = ait1.next();
                            Attribute attr2 = ait2.next();

                            if ((!attr1.getId().equals(attr2.getId()))
                                    || (!attr1.getType().equals(attr2.getType()))
                                    || (!attr1.getValue().equals(attr2.getValue())))
                                assignmentsMatch = false;
                        }

                        matched = assignmentsMatch;
                    }
View Full Code Here

    private void checkForObligation(ResponseCtx response) {
        Result result = response.getResults().iterator().next();
        assertNotNull(result);
        Obligation obligation = result.getObligations().iterator().next();
        assertNotNull(obligation);
        Attribute assignment = obligation.getAssignments().iterator().next();
        GeometryAttribute geomAttr = (GeometryAttribute) assignment.getValue();
        assertNotNull(geomAttr.getGeometry());

    }
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.