public static List<? extends PersonAttributeDao> newPersonAttributeDaos(final List<LdapPrincipalAttributesProperties> properties) {
        return properties
            .stream()
            .filter(ldap -> StringUtils.isNotBlank(ldap.getBaseDn()) && StringUtils.isNotBlank(ldap.getLdapUrl()))
            .map(ldap -> {
                val dao = new LdapPersonAttributeDao();
                FunctionUtils.doIfNotNull(ldap.getId(), id -> dao.setId(id));
                LOGGER.debug("Configured LDAP attribute source for [{}] and baseDn [{}]", ldap.getLdapUrl(), ldap.getBaseDn());
                dao.setConnectionFactory(LdapUtils.newLdaptiveConnectionFactory(ldap));
                dao.setBaseDN(ldap.getBaseDn());
                dao.setEnabled(ldap.getState() != AttributeRepositoryStates.DISABLED);
                dao.putTag("state", ldap.getState());

                LOGGER.debug("LDAP attributes are fetched from [{}] via filter [{}]", ldap.getLdapUrl(), ldap.getSearchFilter());
                dao.setSearchFilter(ldap.getSearchFilter());

                val constraints = new SearchControls();
                if (ldap.getAttributes() != null && !ldap.getAttributes().isEmpty()) {
                    LOGGER.debug("Configured result attribute mapping for [{}] to be [{}]", ldap.getLdapUrl(), ldap.getAttributes());
                    val resultingAttributes = CollectionUtils.fromCommaDelimitedValues(ldap.getAttributes());
                    dao.setResultAttributeMapping(resultingAttributes);
                    val attributes = ldap.getAttributes().keySet().toArray(ArrayUtils.EMPTY_STRING_ARRAY);
                    constraints.setReturningAttributes(attributes);
                } else {
                    LOGGER.debug("Retrieving all attributes as no explicit attribute mappings are defined for [{}]", ldap.getLdapUrl());
                    constraints.setReturningAttributes(null);
                }

                val binaryAttributes = ldap.getBinaryAttributes();
                if (binaryAttributes != null && !binaryAttributes.isEmpty()) {
                    LOGGER.debug("Setting binary attributes [{}]", binaryAttributes);
                    dao.setBinaryAttributes(binaryAttributes.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
                }

                val searchEntryHandlers = ldap.getSearchEntryHandlers();
                if (searchEntryHandlers != null && !searchEntryHandlers.isEmpty()) {
                    val entryHandlers = LdapUtils.newLdaptiveEntryHandlers(searchEntryHandlers);
                    if (!entryHandlers.isEmpty()) {
                        LOGGER.debug("Setting entry handlers [{}]", entryHandlers);
                        dao.setEntryHandlers(entryHandlers.toArray(LDAP_ENTRY_HANDLERS));
                    }
                    val searchResultHandlers = LdapUtils.newLdaptiveSearchResultHandlers(searchEntryHandlers);
                    if (!searchResultHandlers.isEmpty()) {
                        LOGGER.debug("Setting search result handlers [{}]", searchResultHandlers);
                        dao.setSearchResultHandlers(searchResultHandlers.toArray(SEARCH_RESULT_HANDLERS));
                    }
                }

                if (ldap.isSubtreeSearch()) {
                    LOGGER.debug("Configured subtree searching for [{}]", ldap.getLdapUrl());
                    constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
                }
                if (!ldap.getQueryAttributes().isEmpty()) {
                    dao.setQueryAttributeMapping(ldap.getQueryAttributes());
                }
                constraints.setDerefLinkFlag(true);
                dao.setSearchControls(constraints);
                dao.setUseAllQueryAttributes(ldap.isUseAllQueryAttributes());
                dao.setOrder(ldap.getOrder());
                return dao;
            })
            .toList();
    }
New person attribute daos list.

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