For the outbound HTTP request, I need to set keystore configurations. The keystore contains the client certificate. This is working, If I provide the path as ;
${app.home}${tls.keystore.relativepath}${client.ssl.keystore}
Here;
tls.keystore.relativepath
and client.ssl.keystore properties
are defined in the properties file.
eg: in properties file;
tls.keystore.relativepath=/keystore/
client.ssl.keystore=client_certificate.p12
But my requirement is, The HTTP request is a generic one, and this program will route requests to different endpoints. So,the key store files also different at runtime.
eg: In properties file I'll define;
client.ssl.keystore=client_certificate.p12
client2.ssl.keystore=client2_certificate.p12
to determine the 'client' or 'client2' word at runtime, I have defined a variable, which examine the request and holding value as 'client' or client2'.
So, to define 'path' value under TLS context/key store configuration, I tried several combinations. But no luck.[1,2,3]
${app.home}${tls.keystore.relativepath}++#[p(vars.'app.name' ++'.'++'ssl.keystore')]
keystore/ ++ p(vars.'app.name' ++'.'++'ssl.keystore')
%dw 2.0
output application/java
keystore/ ++ p(vars.'app.name' ++'.'++'ssl.keystore')
Anyone can please provide me solution for this dynamic path configuration?
You can refer dynamically to a property using the following sample
%dw 2.0
output application/json
var appName="test-app"
var keystore="client-cert.p12"
var finalProp=appName ++ keystore
---
Mule::p(finalProp)
However the part of the HTTP requester config (TLS) does not consider dynamic values and needs reference to a static property or hard coded values. Thus you would have to resort to multiple HTTP requester components in your flow and use a choice router to route accordingly given the client type.