I am trying to use the WSClient in my Play app with a custom ssl config, but it's not working.
My controller looks like this:
@Singleton
class HomeController @Inject()(cc: ControllerComponents, ws: WSClient, configuration: Configuration) extends AbstractController(cc) {
implicit val timeout: Timeout = 5 seconds
def index() = Action.async {
val url = "https://our-microservice-endpoint.com"
ws.url(url).get().map {
response =>
Ok((response.xml \\ "payload").head.text)
}
}
}
And I have added the following ssl-config object to application.conf
:
ssl-config {
keyManager = {
stores = [
{ type = "JKS", path = "client.jks", password = "changeit1" }
]
}
trustManager = {
stores = [
{ type = "JKS", path = "exampletrust.jks" }
]
}
}
(Obviously with my local settings in place). I know the values that I am passing to the key stores and the trust stores work because they are the ones I use in other applications.
However I if I debug the app and look at the wsclient that has been injected it seems to have no ssl settings. And when I run the controller I get an ssl handshake_failure
.
Am I missing something or is this all wrong? I am using the latest play framework release 2.6.
Thanks