-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
Currently you can enable client TLS like this.
HttpClientBuilder builder = HttpClientBuilder.create();
builder.setSslcontext(sslContext);
JenkinsHttpClient client = new JenkinsHttpClient(uri, builder);
Or add authentication credentials like this
JenkinsServer jenkins = new JenkinsServer(uri, username, password);
But not both, because the last constructor contains this small peace of code.
public JenkinsHttpClient(URI uri, String username, String password) { this(uri, addAuthentication(HttpClientBuilder.create(), uri, username, password)); if (isNotBlank(username)) { localContext = new BasicHttpContext(); localContext.setAttribute("preemptive-auth", new BasicScheme()); } }
localContext not a accessible outside of JenkinsHttpClient
It would be nice with a constructor that takes both a builder and the username and password like this.
public JenkinsHttpClient(HttpClientBuilder builder, URI uri, String username, String password)
That way the client could support both client TLS and authentication at the same time, like this.
HttpClientBuilder builder = HttpClientBuilder.create(); builder.setSslcontext(sslContext); JenkinsHttpClient client = new JenkinsHttpClient(uri, builder, username, password); JenkinsServer jenkins = new JenkinsServer(client);
Possible workarounds
None that i know of except for forking the codebase.