Closed Baddy247 closed 9 months ago
Hi - and sorry for the super-slow response - after switching jobs, I haven't had a lot of spare time for MP issues.
The short answer is that for now, you're stuck with either using the RestClientBuilder
or using the MP Config properties - which only allow you to specify the keystore, truststore and hostname verifier (https://download.eclipse.org/microprofile/microprofile-rest-client-2.0/microprofile-rest-client-spec-2.0.html#ssl).
That said, it may be possible to use CDI semantics to produce the client instance specifying the SSLContext
that you want - something like:
public interface MyClient {
@GET
Widget getWidget(...);
}
@ApplicationScoped
public class MyBeanThatUsesARestClient {
@Inject
MyClient client;
}
@ApplicationScoped
public class SomeOtherBean {
@Produces
public MyClient createNewRestClientWithSSLSettings() {
return RestClientBuilder.newBuilder().baseUri(SOME_URI).sslContext(SOME_SSL_CONTEXT).build();
}
}
HTH
Thanks @andymc12 that did work!
Based on the above comments, we are going to close this as there are no better solution than what @andymc12 recommended.
Hi,
I have a CDI injected rest client using
@RegisterRestClient
. I am planning to implement mutual auth/2-way auth for this client and I was wondering how to initialize theSSLContext
object. From the documentation I only see it is possible forRestClientBuilder
. I'd appreciate any help.