public static ConnectionConfig newLdaptiveConnectionConfig(final AbstractLdapProperties properties) {
        if (StringUtils.isBlank(properties.getLdapUrl())) {
            throw new IllegalArgumentException("LDAP url cannot be empty/blank");
        }

        LOGGER.debug("Creating LDAP connection configuration for [{}]", properties.getLdapUrl());
        val connectionConfig = new ConnectionConfig();

        val urls = properties.getLdapUrl().contains(" ")
            ? properties.getLdapUrl()
            : String.join(" ", properties.getLdapUrl().split(","));
        LOGGER.debug("Transformed LDAP urls from [{}] to [{}]", properties.getLdapUrl(), urls);
        connectionConfig.setLdapUrl(urls);

        connectionConfig.setUseStartTLS(properties.isUseStartTls());
        connectionConfig.setConnectTimeout(Beans.newDuration(properties.getConnectTimeout()));
        connectionConfig.setResponseTimeout(Beans.newDuration(properties.getResponseTimeout()));

        if (StringUtils.isNotBlank(properties.getConnectionStrategy())) {
            val strategy = AbstractLdapProperties.LdapConnectionStrategy.valueOf(properties.getConnectionStrategy());
            switch (strategy) {
                case RANDOM -> connectionConfig.setConnectionStrategy(new RandomConnectionStrategy());
                case DNS_SRV -> connectionConfig.setConnectionStrategy(new DnsSrvConnectionStrategy());
                case ROUND_ROBIN -> connectionConfig.setConnectionStrategy(new RoundRobinConnectionStrategy());
                case ACTIVE_PASSIVE -> connectionConfig.setConnectionStrategy(new ActivePassiveConnectionStrategy());
            }
        }

        if (properties.getTrustCertificates() != null) {
            LOGGER.debug("Creating LDAP SSL configuration via trust certificates [{}]", properties.getTrustCertificates());
            val cfg = new X509CredentialConfig();
            cfg.setTrustCertificates(properties.getTrustCertificates());
            connectionConfig.setSslConfig(new SslConfig(cfg));
        } else if (properties.getTrustStore() != null || properties.getKeystore() != null) {
            val cfg = new KeyStoreCredentialConfig();
            FunctionUtils.doIfNotNull(properties.getTrustStore(), store -> {
                val activeTrustStore = SpringExpressionLanguageValueResolver.getInstance().resolve(store);
                LOGGER.trace("Creating LDAP SSL configuration with truststore [{}]", activeTrustStore);
                cfg.setTrustStore(activeTrustStore);
                cfg.setTrustStoreType(properties.getTrustStoreType());
                val password = SpringExpressionLanguageValueResolver.getInstance().resolve(properties.getTrustStorePassword());
                cfg.setTrustStorePassword(password);
            });
            FunctionUtils.doIfNotNull(properties.getKeystore(), store -> {
                val activeStore = SpringExpressionLanguageValueResolver.getInstance().resolve(store);
                LOGGER.trace("Creating LDAP SSL configuration via keystore [{}]", activeStore);
                cfg.setKeyStore(activeStore);
                cfg.setKeyStoreType(properties.getKeystoreType());
                val password = SpringExpressionLanguageValueResolver.getInstance().resolve(properties.getKeystorePassword());
                cfg.setKeyStorePassword(password);
            });
            connectionConfig.setSslConfig(new SslConfig(cfg));
        } else {
            LOGGER.debug("Creating LDAP SSL configuration via the native JVM truststore");
            connectionConfig.setSslConfig(new SslConfig());
        }

        val sslConfig = connectionConfig.getSslConfig();
        if (sslConfig != null) {
            switch (properties.getHostnameVerifier()) {
                case ANY -> sslConfig.setHostnameVerifier(new AllowAnyHostnameVerifier());
                case DEFAULT -> sslConfig.setHostnameVerifier(new DefaultHostnameVerifier());
            }

            if (StringUtils.isNotBlank(properties.getTrustManager())) {
                val manager = properties.getTrustManager().trim().toUpperCase(Locale.ENGLISH);
                switch (AbstractLdapProperties.LdapTrustManagerOptions.valueOf(manager)) {
                    case ANY -> {
                        sslConfig.setCredentialConfig(null);
                        sslConfig.setTrustManagers(new AllowAnyTrustManager());
                    }
                    case DEFAULT -> sslConfig.setTrustManagers(new DefaultTrustManager());
                }
            }
        }

        if (StringUtils.isNotBlank(properties.getSaslMechanism())) {
            LOGGER.debug("Creating LDAP SASL mechanism via [{}]", properties.getSaslMechanism());

            val initializer = new BindConnectionInitializer();
            val saslConfig = getSaslConfigFrom(properties);

            FunctionUtils.doIfNotBlank(properties.getSaslAuthorizationId(), __ -> saslConfig.setAuthorizationId(properties.getSaslAuthorizationId()));
            saslConfig.setMutualAuthentication(properties.getSaslMutualAuth());
            if (StringUtils.isNotBlank(properties.getSaslQualityOfProtection())) {
                saslConfig.setQualityOfProtection(QualityOfProtection.valueOf(properties.getSaslQualityOfProtection()));
            }
            if (StringUtils.isNotBlank(properties.getSaslSecurityStrength())) {
                saslConfig.setSecurityStrength(SecurityStrength.valueOf(properties.getSaslSecurityStrength()));
            }
            if (StringUtils.isNotBlank(properties.getBindDn())) {
                initializer.setBindDn(properties.getBindDn());
                if (StringUtils.isNotBlank(properties.getBindCredential())) {
                    initializer.setBindCredential(new Credential(properties.getBindCredential()));
                }
            }
            initializer.setBindSaslConfig(saslConfig);
            connectionConfig.setConnectionInitializers(initializer);
        } else if (StringUtils.equals(properties.getBindCredential(), "*") && StringUtils.equals(properties.getBindDn(), "*")) {
            LOGGER.debug("Creating LDAP fast-bind connection initializer");
            connectionConfig.setConnectionInitializers(new FastBindConnectionInitializer());
        } else if (StringUtils.isNotBlank(properties.getBindDn()) && StringUtils.isNotBlank(properties.getBindCredential())) {
            LOGGER.debug("Creating LDAP bind connection initializer via [{}]", properties.getBindDn());
            connectionConfig.setConnectionInitializers(new BindConnectionInitializer(properties.getBindDn(), new Credential(properties.getBindCredential())));
        }
        return connectionConfig;
    }
New connection config connection config.

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