@SuppressWarnings("EnumOrdinal")
    protected SearchRequest createRequest(final FilterTemplate filter) {
        val request = new SearchRequest();
        request.setBaseDn(this.baseDN);
        request.setFilter(filter);
        request.setBinaryAttributes(binaryAttributes);

        if (getResultAttributeMapping() != null && !getResultAttributeMapping().isEmpty()) {
            val attributes = getResultAttributeMapping().keySet().toArray(ArrayUtils.EMPTY_STRING_ARRAY);
            request.setReturnAttributes(attributes);
        } else if (searchControls.getReturningAttributes() != null && searchControls.getReturningAttributes().length > 0) {
            request.setReturnAttributes(searchControls.getReturningAttributes());
        } else {
            request.setReturnAttributes(ReturnAttributes.ALL_USER.value());
        }

        var searchScope = SearchScope.SUBTREE;
        for (val scope : SearchScope.values()) {
            if (scope.ordinal() == searchControls.getSearchScope()) {
                searchScope = scope;
            }
        }
        request.setSearchScope(searchScope);
        request.setSizeLimit(Long.valueOf(searchControls.getCountLimit()).intValue());
        request.setTimeLimit(Duration.ofSeconds(searchControls.getTimeLimit()));
        return request;
    }
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