AttributeValues. If you want to provide a new type, extend this class and implement the equals(Object)
and hashCode
methods from Object
, which are used for equality checking.
@since 1.0
@author Seth Proctor
return attributes;
}
try {
String pid = null;
AttributeValue pidAttr = res.get(XACML_RESOURCE_ID);
if (pidAttr != null) {
pid = pidAttr.encode();
pid = relationshipResolver.buildRESTParentHierarchy(pid);
String dsid = null;
AttributeValue dsidAttr =
res.get(Constants.DATASTREAM.ID.getURI());
if (dsidAttr != null) {
dsid = dsidAttr.encode();
if (!dsid.equals("")) {
pid += "/" + dsid;
}
}
Map<URI, AttributeValue> newActions =
new HashMap<URI, AttributeValue>();
for (URI uri : a.keySet()) {
URI newUri = null;
AttributeValue newValue = null;
if (actionMap != null && actionMap.size() > 0) {
newUri = actionMap.get(uri);
}
Set<AttributeValue> bagValues = new HashSet<AttributeValue>();
logger.debug("Attribute values found: " + results.size());
for (String s : results) {
AttributeValue attributeValue = null;
try {
attributeValue = m_attributeFactory.createValue(type, s);
} catch (Exception e) {
logger.error("Error creating attribute: " + e.getMessage(), e);
continue;
}
Set<AttributeValue> bagValues = new HashSet<AttributeValue>();
logger.debug("Attribute values found: " + results.size());
for (String s : results) {
AttributeValue attributeValue = null;
try {
attributeValue = m_attributeFactory.createValue(type, s);
} catch (Exception e) {
logger.error("Error creating attribute: " + e.getMessage(), e);
continue;
EvaluationResult result =
eval.getSubjectAttribute(new URI(im.get(attributeId)),
new URI(attributeId),
defaultCategoryURI);
if (result.getStatus() == null && !result.indeterminate()) {
AttributeValue attr = result.getAttributeValue();
if (attr.returnsBag()) {
Iterator<AttributeValue> i =
((BagAttribute) attr).iterator();
if (i.hasNext()) {
while (i.hasNext()) {
AttributeValue value = i.next();
String attributeType = im.get(attributeId);
AttributeBean ab = attributeBeans.get(attributeId);
if (ab == null) {
ab = new AttributeBean();
ab.setId(attributeId);
ab.setType(attributeType);
attributeBeans.put(attributeId, ab);
}
ab.addValue(value.encode());
}
}
}
}
}
attributeMap.put(SUBJECT_KEY, new HashSet(attributeBeans
.values()));
im = indexMap.get(RESOURCE_KEY);
attributeBeans = new HashMap<String, AttributeBean>();
for (String attributeId : im.keySet()) {
EvaluationResult result =
eval.getResourceAttribute(new URI(im.get(attributeId)),
new URI(attributeId),
null);
if (result.getStatus() == null && !result.indeterminate()) {
AttributeValue attr = result.getAttributeValue();
if (attr.returnsBag()) {
Iterator<AttributeValue> i =
((BagAttribute) attr).iterator();
if (i.hasNext()) {
while (i.hasNext()) {
AttributeValue value = i.next();
String attributeType = im.get(attributeId);
AttributeBean ab = attributeBeans.get(attributeId);
if (ab == null) {
ab = new AttributeBean();
ab.setId(attributeId);
ab.setType(attributeType);
attributeBeans.put(attributeId, ab);
}
if (attributeId.equals(XACML_RESOURCE_ID)
&& value.encode().startsWith("/")) {
String[] components =
makeComponents(value.encode());
if (components != null && components.length > 0) {
for (String c : components) {
ab.addValue(c);
}
} else {
ab.addValue(value.encode());
}
} else {
ab.addValue(value.encode());
}
}
}
}
}
}
attributeMap.put(RESOURCE_KEY, new HashSet<AttributeBean>(attributeBeans
.values()));
im = indexMap.get(ACTION_KEY);
attributeBeans = new HashMap<String, AttributeBean>();
for (String attributeId : im.keySet()) {
EvaluationResult result =
eval.getActionAttribute(new URI(im.get(attributeId)),
new URI(attributeId),
null);
if (result.getStatus() == null && !result.indeterminate()) {
AttributeValue attr = result.getAttributeValue();
if (attr.returnsBag()) {
Iterator<AttributeValue> i =
((BagAttribute) attr).iterator();
if (i.hasNext()) {
while (i.hasNext()) {
AttributeValue value = i.next();
String attributeType = im.get(attributeId);
AttributeBean ab = attributeBeans.get(attributeId);
if (ab == null) {
ab = new AttributeBean();
ab.setId(attributeId);
ab.setType(attributeType);
attributeBeans.put(attributeId, ab);
}
ab.addValue(value.encode());
}
}
}
}
}
attributeMap.put(ACTION_KEY, new HashSet<AttributeBean>(attributeBeans
.values()));
im = indexMap.get(ENVIRONMENT_KEY);
attributeBeans = new HashMap<String, AttributeBean>();
for (String attributeId : im.keySet()) {
URI imAttrId = new URI(im.get(attributeId));
URI attrId = new URI(attributeId);
EvaluationResult result =
eval.getEnvironmentAttribute(imAttrId, attrId, null);
if (result.getStatus() == null && !result.indeterminate()) {
AttributeValue attr = result.getAttributeValue();
if (attr.returnsBag()) {
Iterator<AttributeValue> i =
((BagAttribute) attr).iterator();
if (i.hasNext()) {
while (i.hasNext()) {
AttributeValue value = i.next();
String attributeType = im.get(attributeId);
AttributeBean ab = attributeBeans.get(attributeId);
if (ab == null) {
ab = new AttributeBean();
ab.setId(attributeId);
ab.setType(attributeType);
attributeBeans.put(attributeId, ab);
}
ab.addValue(value.encode());
}
}
}
}
}
Set<AttributeValue> bagValues = new HashSet<AttributeValue>();
logger.debug("Attribute values found: " + results.size());
for (String s : results) {
AttributeValue attributeValue = null;
try {
attributeValue = m_attributeFactory.createValue(type, s);
} catch (Exception e) {
logger.error("Error creating attribute: " + e.getMessage(), e);
continue;
if (userER == null) {
return new EvaluationResult(BagAttribute
.createEmptyBag(attributeType));
}
AttributeValue userAV = userER.getAttributeValue();
if (userAV == null) {
return new EvaluationResult(BagAttribute
.createEmptyBag(attributeType));
}
user = userAV.encode();
if (logger.isDebugEnabled()) {
logger.debug("LDAPAttributeFinder: Getting info for " + user);
}
// figure out which attribute we're looking for
String value = (String) nea.nextElement();
if (logger.isDebugEnabled()) {
logger.debug(attr.getID() + ": " + value);
}
AttributeValue attributeValue = null;
try {
attributeValue =
attributeFactory.createValue(type, value);
} catch (Exception e) {
logger.error("Error creating attribute: "
type);
BagAttribute bag = (BagAttribute) result.getAttributeValue();
Iterator i = bag.iterator();
while (i.hasNext()) {
AttributeValue a = (AttributeValue) i.next();
logger.info("value: " + a.encode());
}
}
throw new RuntimeException(e);
}
Set<Attribute> subjectAttributes = new HashSet<Attribute>(1 + role.getAttributes().size());
AttributeValue roleAttributeValue = new AnyURIAttribute(roleURI);
Attribute roleAttribute = new Attribute(XACMLConstants.RoleAttributeURI, null, null,
roleAttributeValue);
subjectAttributes.add(roleAttribute);
for (Attribute attr : role.getAttributes()) {
Related Classes of com.sun.xacml.attr.AttributeValue
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.