public static FilterTemplate newSearchFilter(final String filterQuery, final String... params) {
        val filter = new FilterTemplate();
        filter.setFilter(filterQuery);
        if (params != null) {
            for (var i = 0; i < params.length; i++) {
                if (filter.getFilter().contains("{" + i + "}")) {
                    filter.setParameter(i, params[i]);
                } else {
                    filter.setParameter("user", params[i]);
                }
            }
        }
        LOGGER.debug("Constructed LDAP search filter [{}]", filter.format());
        return filter;
    }
Constructs a new search filter using filterQuery as a template and the username as a parameter.

@param filterQuery the query filter
@param params      the username
@return Search filter with parameters applied.
pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java