public static ClientOptions newClientOptions(final BaseRedisProperties redis,
                                                 final CasSSLContext casSslContext) throws Exception {
        val clientOptionsBuilder = initializeClientOptionsBuilder(redis);
        if (StringUtils.hasText(redis.getConnectTimeout())) {
            val connectTimeout = Beans.newDuration(redis.getConnectTimeout());
            clientOptionsBuilder.socketOptions(SocketOptions.builder().connectTimeout(connectTimeout).build());
        }
        val sslOptionsBuilder = SslOptions.builder()
            .jdkSslProvider()
            .keyManager(casSslContext.getKeyManagerFactory())
            .trustManager(casSslContext.getTrustManagerFactory());

        if ((redis.isStartTls() || redis.isUseSsl()) && redis.getKeyCertificateChainFile() != null && redis.getKeyFile() != null) {
            LOGGER.debug("Loading SSL certificate chain [{}] and key file [{}]",
                redis.getKeyCertificateChainFile().getCanonicalPath(), redis.getKeyFile().getCanonicalPath());
            sslOptionsBuilder.keyManager(redis.getKeyCertificateChainFile(), redis.getKeyFile(),
                StringUtils.hasText(redis.getKeyPassword()) ? redis.getKeyPassword().toCharArray() : null);
        }
        if (redis.isUseSsl() && redis.getCertificateFile() != null) {
            sslOptionsBuilder.trustManager(redis.getCertificateFile());
        }
        return clientOptionsBuilder
            .timeoutOptions(TimeoutOptions.enabled())
            .sslOptions(sslOptionsBuilder.build())
            .protocolVersion(ProtocolVersion.valueOf(redis.getProtocolVersion()))
            .build();

    }
New client options.

@param redis         the redis
@param casSslContext the cas ssl context
@return the client options
@throws Exception the exception
support/cas-server-support-redis-core/src/main/java/org/apereo/cas/redis/core/RedisObjectFactory.java