use of com.sun.identity.policy.interfaces.Condition in project OpenAM by OpenRock.
the class ProxyPETest method createAuthSchemeCondition.
private Condition createAuthSchemeCondition(PolicyManager pm) throws PolicyException {
ConditionTypeManager mgr = pm.getConditionTypeManager();
Condition cond = mgr.getCondition("AuthSchemeCondition");
Map<String, Set<String>> map = new HashMap<String, Set<String>>();
Set<String> set = new HashSet<String>();
set.add("LDAP");
map.put(Condition.AUTH_SCHEME, set);
cond.setProperties(map);
return cond;
}
use of com.sun.identity.policy.interfaces.Condition in project OpenAM by OpenRock.
the class UpgradeUtils method removeDelegationCondition.
/**
* Removes Condition Properties.
*
* @param policyName Name of Policy.
* @param attributeName the name of the attribute whose default values
* needs to be updated.
* @param conditionNameMap Map of condition name to map of property name to
* set of attribute values to be removed.
*/
public static void removeDelegationCondition(String policyName, String attributeName, Map conditionNameMap) {
try {
PolicyManager pm = new PolicyManager(ssoToken, HIDDEN_REALM);
Policy policy = pm.getPolicy(policyName);
for (Iterator i = conditionNameMap.keySet().iterator(); i.hasNext(); ) {
String condName = (String) i.next();
Condition cond = policy.getCondition(condName);
if (cond != null) {
Set removeSet = (HashSet) conditionNameMap.get(condName);
Map orig = cond.getProperties();
for (Iterator j = removeSet.iterator(); j.hasNext(); ) {
String defaultValue = (String) j.next();
Set origValues = (Set) orig.get(attributeName);
if (origValues != null) {
origValues.removeAll(removeSet);
}
}
cond.setProperties(orig);
policy.replaceCondition(condName, cond);
}
}
pm.replacePolicy(policy);
} catch (PolicyException e) {
debug.error("UpgradeUtils.removeDelegationCondition", e);
} catch (SSOException e) {
debug.error("UpgradeUtils.removeDelegationCondition", e);
}
}
Aggregations