public static PooledConnectionFactory newLdaptivePooledConnectionFactory(final AbstractLdapProperties props) {
        val connectionConfig = newLdaptiveConnectionConfig(props);

        LOGGER.debug("Creating LDAP connection pool configuration for [{}]", props.getLdapUrl());
        val pooledCf = new PooledConnectionFactory(connectionConfig);
        pooledCf.setMinPoolSize(props.getMinPoolSize());
        pooledCf.setMaxPoolSize(props.getMaxPoolSize());
        pooledCf.setValidateOnCheckOut(props.isValidateOnCheckout());
        pooledCf.setValidatePeriodically(props.isValidatePeriodically());
        pooledCf.setBlockWaitTime(Beans.newDuration(props.getBlockWaitTime()));

        val strategy = new IdlePruneStrategy();
        strategy.setIdleTime(Beans.newDuration(props.getIdleTime()));
        strategy.setPrunePeriod(Beans.newDuration(props.getPrunePeriod()));

        pooledCf.setPruneStrategy(strategy);

        val validator = props.getValidator();
        switch (validator.getType().trim().toLowerCase(Locale.ENGLISH)) {
            case "compare" -> {
                val compareRequest = new CompareRequest(
                    validator.getDn(),
                    validator.getAttributeName(),
                    validator.getAttributeValue());
                val compareValidator = new CompareConnectionValidator(compareRequest);
                compareValidator.setValidatePeriod(Beans.newDuration(props.getValidatePeriod()));
                compareValidator.setValidateTimeout(Beans.newDuration(props.getValidateTimeout()));
                pooledCf.setValidator(compareValidator);
            }
            case "none" -> LOGGER.debug("No validator is configured for the LDAP connection pool of [{}]", props.getLdapUrl());
            case "search" -> {
                val searchRequest = new SearchRequest();
                searchRequest.setBaseDn(validator.getBaseDn());
                searchRequest.setFilter(validator.getSearchFilter());
                searchRequest.setReturnAttributes(ReturnAttributes.NONE.value());
                searchRequest.setSearchScope(SearchScope.valueOf(validator.getScope()));
                searchRequest.setSizeLimit(1);
                val searchValidator = new SearchConnectionValidator(searchRequest);
                searchValidator.setValidatePeriod(Beans.newDuration(props.getValidatePeriod()));
                searchValidator.setValidateTimeout(Beans.newDuration(props.getValidateTimeout()));
                pooledCf.setValidator(searchValidator);
            }
        }

        pooledCf.setFailFastInitialize(props.isFailFast());

        if (StringUtils.isNotBlank(props.getPoolPassivator())) {
            val pass = AbstractLdapProperties.LdapConnectionPoolPassivator.valueOf(props.getPoolPassivator().toUpperCase(Locale.ENGLISH));
            if (pass == AbstractLdapProperties.LdapConnectionPoolPassivator.BIND) {
                if (StringUtils.isNotBlank(props.getBindDn()) && StringUtils.isNoneBlank(props.getBindCredential())) {
                    val bindRequest = new SimpleBindRequest(props.getBindDn(), props.getBindCredential());
                    pooledCf.setPassivator(new BindConnectionPassivator(bindRequest));
                    LOGGER.debug("Created [{}] passivator for [{}]", props.getPoolPassivator(), props.getLdapUrl());
                } else if (LOGGER.isInfoEnabled()) {
                    val values = Arrays.stream(AbstractLdapProperties.LdapConnectionPoolPassivator.values())
                        .filter(v -> v != AbstractLdapProperties.LdapConnectionPoolPassivator.BIND)
                        .collect(Collectors.toList());
                    LOGGER.info("[{}] pool passivator could not be created for [{}] given bind credentials are not specified. "
                            + "If you are dealing with LDAP in such a way that does not require bind credentials, you may need to "
                            + "set the pool passivator setting to one of [{}]",
                        props.getPoolPassivator(), props.getLdapUrl(), values);
                }
            }
        }
        LOGGER.debug("Initializing ldap connection pool for [{}] and bindDn [{}]", props.getLdapUrl(), props.getBindDn());
        pooledCf.initialize();
        return pooledCf;
    }
New pooled connection factory pooled connection factory.

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