use of org.apereo.services.persondir.support.ldap.ActiveDirectoryLdapEntryHandler in project cas by apereo.
the class LdapUtils method newLdaptiveEntryHandlers.
/**
* New list of ldap entry handlers derived from the supplied properties.
*
* @param properties to inspect
* @return the list of entry handlers
*/
public static List<LdapEntryHandler> newLdaptiveEntryHandlers(final List<LdapSearchEntryHandlersProperties> properties) {
val entryHandlers = new ArrayList<LdapEntryHandler>();
properties.forEach(h -> {
switch(h.getType()) {
case ACTIVE_DIRECTORY:
entryHandlers.add(new ActiveDirectoryLdapEntryHandler());
break;
case CASE_CHANGE:
val eh = new CaseChangeEntryHandler();
val caseChange = h.getCaseChange();
eh.setAttributeNameCaseChange(CaseChangeEntryHandler.CaseChange.valueOf(caseChange.getAttributeNameCaseChange()));
eh.setAttributeNames(caseChange.getAttributeNames().toArray(ArrayUtils.EMPTY_STRING_ARRAY));
eh.setAttributeValueCaseChange(CaseChangeEntryHandler.CaseChange.valueOf(caseChange.getAttributeValueCaseChange()));
eh.setDnCaseChange(CaseChangeEntryHandler.CaseChange.valueOf(caseChange.getDnCaseChange()));
entryHandlers.add(eh);
break;
case DN_ATTRIBUTE_ENTRY:
val ehd = new DnAttributeEntryHandler();
val dnAttribute = h.getDnAttribute();
ehd.setAddIfExists(dnAttribute.isAddIfExists());
ehd.setDnAttributeName(dnAttribute.getDnAttributeName());
entryHandlers.add(ehd);
break;
case MERGE:
val ehm = new MergeAttributeEntryHandler();
val mergeAttribute = h.getMergeAttribute();
ehm.setAttributeNames(mergeAttribute.getAttributeNames().toArray(ArrayUtils.EMPTY_STRING_ARRAY));
ehm.setMergeAttributeName(mergeAttribute.getMergeAttributeName());
entryHandlers.add(ehm);
break;
case OBJECT_GUID:
entryHandlers.add(new ObjectGuidHandler());
break;
case OBJECT_SID:
entryHandlers.add(new ObjectSidHandler());
break;
default:
break;
}
});
return entryHandlers;
}
Aggregations