public static EntryResolver newLdaptiveSearchEntryResolver(final AbstractLdapAuthenticationProperties properties,
                                                               final ConnectionFactory factory) {

        var resolvers = Arrays.stream(StringUtils.split(properties.getBaseDn(), BASE_DN_DELIMITER))
            .map(baseDn -> {
                val entryResolver = new SearchEntryResolver();
                entryResolver.setBaseDn(baseDn.trim());
                entryResolver.setUserFilter(properties.getSearchFilter());
                entryResolver.setSubtreeSearch(properties.isSubtreeSearch());
                entryResolver.setConnectionFactory(factory);
                entryResolver.setAllowMultipleEntries(properties.isAllowMultipleEntries());
                entryResolver.setBinaryAttributes(properties.getBinaryAttributes().toArray(ArrayUtils.EMPTY_STRING_ARRAY));

                if (StringUtils.isNotBlank(properties.getDerefAliases())) {
                    entryResolver.setDerefAliases(DerefAliases.valueOf(properties.getDerefAliases()));
                }

                val entryHandlers = newLdaptiveEntryHandlers(properties.getSearchEntryHandlers());
                val searchResultHandlers = newLdaptiveSearchResultHandlers(properties.getSearchEntryHandlers());
                if (!entryHandlers.isEmpty()) {
                    LOGGER.debug("Search entry handlers defined for the entry resolver of [{}] are [{}]", properties.getLdapUrl(), entryHandlers);
                    entryResolver.setEntryHandlers(entryHandlers.toArray(LdapEntryHandler[]::new));
                }
                if (!searchResultHandlers.isEmpty()) {
                    LOGGER.debug("Search entry handlers defined for the entry resolver of [{}] are [{}]", properties.getLdapUrl(), searchResultHandlers);
                    entryResolver.setSearchResultHandlers(searchResultHandlers.toArray(SearchResultHandler[]::new));
                }
                if (properties.isFollowReferrals()) {
                    entryResolver.setSearchResultHandlers(new FollowSearchReferralHandler());
                }
                return entryResolver;
            })
            .collect(Collectors.toList());
        return new ChainingLdapEntryResolver(resolvers);
    }
New dn resolver entry resolver.
Creates the necessary search entry resolver.

@param properties the ldap settings
@param factory    the factory
@return the entry resolver
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java