I am currently working on adding security to the Helidon webclient programmatically. To achieve this, I'm using the WebClientSecurity class to create a security service and integrating it into the WebClient using the addService method. However, I'm wondering if it's possible to handle the security configuration through a CONFIG file instead, eliminating the need for explicit code.
Security clientSecurity = Security.builder()
.addProvider(HttpBasicAuthProvider.builder().build())
.build();
WebClient.Builder builder = WebClient.builder()
.baseUri(..)
.config(..)
.addService(WebClientSecurity.create(clientSecurity))
.addReader(..)
.addWriter(..)
.addMediaSupport(..)
.addMediaSupport(..);
private WebClient webClient= builder.build();
In addition to that, I'm also curious if it's possible to streamline the code further by removing the addReader, addWriter, and addMediaSupport methods from the WebClient and instead relying on the configuration file to handle them.
For example, can I create the WebClient like this?
WebClient webClient = WebClient.builder() .baseUri(..) .config(config) .build();
I would appreciate any insights or suggestions on achieving these configurations. Thank you!