use of org.apereo.cas.configuration.model.support.ldap.LdapSearchEntryHandlersProperties in project cas by apereo.
the class LdapUtilsTests method verifyComparePooling.
@Test
public void verifyComparePooling() throws Exception {
val ldap = new Ldap();
ldap.setBaseDn("ou=people,dc=example,dc=org|ou=users,dc=example,dc=org");
ldap.setLdapUrl("ldap://localhost:10389");
ldap.setBindDn("cn=Directory Manager");
ldap.setBindCredential("password");
ldap.setSearchFilter("cn=invalid-user");
ldap.getValidator().setType("compare");
val factory = LdapUtils.newLdaptivePooledConnectionFactory(ldap);
val response = LdapUtils.executeSearchOperation(factory, ldap.getBaseDn(), LdapUtils.newLdaptiveSearchFilter(ldap.getSearchFilter()), 10, "cn");
assertNotNull(response);
assertFalse(LdapUtils.containsResultEntry(response));
val config1 = LdapUtils.newLdaptiveConnectionConfig(ldap);
assertNotNull(config1);
Arrays.stream(LdapSearchEntryHandlersProperties.SearchEntryHandlerTypes.values()).forEach(type -> {
val props = new LdapSearchEntryHandlersProperties();
props.setType(type);
props.getCaseChange().setAttributeNameCaseChange(CaseChangeEntryHandler.CaseChange.UPPER.name());
props.getCaseChange().setDnCaseChange(CaseChangeEntryHandler.CaseChange.UPPER.name());
props.getCaseChange().setAttributeValueCaseChange(CaseChangeEntryHandler.CaseChange.UPPER.name());
ldap.getSearchEntryHandlers().add(props);
val resolver = LdapUtils.newLdaptiveSearchEntryResolver(ldap, factory);
assertNotNull(resolver);
});
}
Aggregations