org.keycloak.admin.client.ClientBuilderWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of keycloak-admin-client-tests Show documentation
Show all versions of keycloak-admin-client-tests Show documentation
Keycloak Admin REST Client. This module is supposed to be used just in the Keycloak repository for the testsuite. It is NOT supposed to be used by the 3rd party applications.
For the use by 3rd party applications, please use `org.keycloak:keycloak-admin-client` module.
package org.keycloak.admin.client;
import javax.net.ssl.SSLContext;
import jakarta.ws.rs.client.ClientBuilder;
public class ClientBuilderWrapper {
static Class clazz;
static {
try {
clazz = Class.forName("org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl");
} catch (ClassNotFoundException e) {
try {
clazz = Class.forName("org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder");
} catch (ClassNotFoundException ex) {
throw new RuntimeException("RestEasy 3 or 4 not found on classpath");
}
}
}
public static ClientBuilder create(SSLContext sslContext, boolean disableTrustManager) {
try {
Object o = clazz.newInstance();
clazz.getMethod("sslContext", SSLContext.class).invoke(o, sslContext);
clazz.getMethod("connectionPoolSize", int.class).invoke(o, 10);
if (disableTrustManager) {
clazz.getMethod("disableTrustManager").invoke(o);
}
return (ClientBuilder) o;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy