subject = context.getSubjectAttribute(new URI(StringAttribute.identifier), new URI(
"urn:oasis:names:tc:xacml:1.0:subject:subject-id"), subjectCategory);
if (subject.getAttributeValue().isBag()) {
BagAttribute attr = (BagAttribute) subject.getAttributeValue();
for (Iterator iterator = attr.iterator(); iterator.hasNext();) {
AttributeValue val = (AttributeValue) iterator.next();
subjectId = val.encode();
if (log.isDebugEnabled()) {
log.debug(String.format("Finding attributes for the subject %1$s",
subjectId));
}
break;
}
}
resource = context.getResourceAttribute(new URI(StringAttribute.identifier), new URI(
"urn:oasis:names:tc:xacml:1.0:resource:resource-id"), null);
if (resource.getAttributeValue().isBag()) {
BagAttribute attr = (BagAttribute) resource.getAttributeValue();
for (Iterator iterator = attr.iterator(); iterator.hasNext();) {
AttributeValue val = (AttributeValue) iterator.next();
resourceId = val.encode();
if (log.isDebugEnabled()) {
log.debug(String.format("Finding attributes for the resource %1$s",
resourceId));
}
break;
}
}
for (Iterator iterator = finders.iterator(); iterator.hasNext();) {
PIPAttributeFinder pipAttributeFinder = (PIPAttributeFinder) iterator.next();
if (log.isDebugEnabled()) {
log.debug(String.format(
"Finding attributes with the PIP attribute handler %1$s",
pipAttributeFinder.getClass()));
}
Set<String> attrs = pipAttributeFinder.getAttributeValues(subjectId, resourceId,
attributeId.toString());
if (attrs != null) {
for (Iterator iterAttr = attrs.iterator(); iterAttr.hasNext();) {
final String attr = (String) iterAttr.next();
AttributeValue attribute = getAttribute(attr, attributeType.toString());
attrBag.add(attribute);
}
}
}