use of com.sun.identity.policy.plugins.IDRepoResponseProvider in project OpenAM by OpenRock.
the class PrivilegeUtils method nrpsToResourceAttributes.
private static Set<ResourceAttribute> nrpsToResourceAttributes(Set nrps) throws EntitlementException {
Set<ResourceAttribute> resourceAttributesSet = new HashSet<ResourceAttribute>();
if (nrps != null && !nrps.isEmpty()) {
for (Object nrpObj : nrps) {
Object[] nrpa = (Object[]) nrpObj;
String nrpName = (String) nrpa[0];
ResponseProvider rp = (ResponseProvider) nrpa[1];
if (rp instanceof IDRepoResponseProvider) {
resourceAttributesSet.addAll(nrpsToResourceAttributes((IDRepoResponseProvider) rp, nrpName));
} else if (rp instanceof ResponseProvider) {
resourceAttributesSet.addAll(mapGenericResponseProvider(nrpName, rp));
}
}
}
return resourceAttributesSet;
}
use of com.sun.identity.policy.plugins.IDRepoResponseProvider in project OpenAM by OpenRock.
the class PrivilegeUtils method resourceAttributesToResponseProviders.
private static Map<String, ResponseProvider> resourceAttributesToResponseProviders(Set<ResourceAttribute> resourceAttributes) throws PolicyException, EntitlementException {
Map<String, ResponseProvider> results = new HashMap<String, ResponseProvider>();
if (resourceAttributes != null) {
Map<String, Map<String, Set<String>>> map = new HashMap<String, Map<String, Set<String>>>();
for (ResourceAttribute ra : resourceAttributes) {
if (ra instanceof StaticAttributes) {
resourceAttributesToResponseProviders((StaticAttributes) ra, map);
} else if (ra instanceof UserAttributes) {
resourceAttributesToResponseProviders((UserAttributes) ra, map);
}
}
for (String n : map.keySet()) {
ResponseProvider rp = new IDRepoResponseProvider();
Map<String, Set<String>> values = map.get(n);
Set<String> dynValues = values.get(IDRepoResponseProvider.DYNAMIC_ATTRIBUTE);
if ((dynValues != null) && !dynValues.isEmpty()) {
Map<String, Set<String>> configParams = new HashMap<String, Set<String>>();
configParams.put(PolicyConfig.SELECTED_DYNAMIC_ATTRIBUTES, dynValues);
rp.initialize(configParams);
}
rp.setProperties(values);
results.put(n, rp);
}
// Copy any legacy response providers over directly
for (ResourceAttribute ra : resourceAttributes) {
if (ra instanceof PolicyResponseProvider) {
PolicyResponseProvider prp = (PolicyResponseProvider) ra;
results.put(prp.getPResponseProviderName(), prp.getResponseProvider());
}
}
}
return results;
}
Aggregations