@Override
    protected List<PersonAttributes> getPeopleForQuery(final FilterTemplate filter, final String userName) {
        try {
            Objects.requireNonNull(this.searchFilter, "Search filter cannot be null");
            val search = new SearchOperation(this.connectionFactory);
            search.setEntryHandlers(entryHandlers);
            search.setSearchResultHandlers(searchResultHandlers);
            val request = createRequest(filter);
            val response = search.execute(request);

            val peopleAttributes = new ArrayList<PersonAttributes>(response.entrySize());
            for (val entry : response.getEntries()) {
                val attributes = convertLdapEntryToMap(entry);
                if (response.getDiagnosticMessage() != null && !response.getDiagnosticMessage().isEmpty()) {
                    val values = new ArrayList<>();
                    values.add(response.getDiagnosticMessage());
                    attributes.put("diagnosticMessage", values);
                }
                if (response.getMatchedDN() != null && !response.getMatchedDN().isEmpty()) {
                    val values = new ArrayList<>();
                    values.add(response.getMatchedDN());
                    attributes.put("matchedDN", values);
                }

                val userNameAttribute = this.getConfiguredUserNameAttribute();
                val person = attributes.containsKey(userNameAttribute)
                    ? SimplePersonAttributes.fromAttribute(userNameAttribute, attributes)
                    : new SimplePersonAttributes(userName, attributes);
                peopleAttributes.add(person);
            }
            return peopleAttributes;
        } catch (final LdapException e) {
            throw new RuntimeException("Failed executing LDAP query " + filter, e);
        }
    }
Person directory {@link org.apereo.cas.authentication.principal.attribute.PersonAttributeDao}
implementation that queries an LDAP directory
with ldaptive components to populate person attributes.

@author Marvin S. Addison
@since 7.1.0
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/persondir/LdapPersonAttributeDao.java