private static Collection<X509TrustManager> getTrustManager(final String algorithm,
                                                                final KeyStore keystore) throws Exception {
        val factory = TrustManagerFactory.getInstance(algorithm);
        factory.init(keystore);
        return Arrays.stream(factory.getTrustManagers())
            .filter(X509TrustManager.class::isInstance)
            .map(X509TrustManager.class::cast)
            .collect(Collectors.toList());
    }
This is {@link DefaultCasSSLContext}.

@author Misagh Moayyed
@since 5.2.0
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/DefaultCasSSLContext.java