How do I ignore ssl validation in play framework scala ws calls

核能气质少年 提交于 2019-12-22 09:17:58

问题


I want to consume a web service that is using an invalid certificate (self signed)

I want to make the web service call without performing any sort of certificate validation.

How do I do it?


回答1:


In your application.conf add the below line

ws.acceptAnyCertificate=true



回答2:


By the way, if you going to user play2 as a lib, to allow self-signed ssl certificates you should do the following(2.1.3 as actual version):

  • create conf/application.conf with at least one string

    ws.acceptAnyCertificate=true

  • create new application

    val app = new play.api.DefaultApplication(new File("."), this.getClass.getClassLoader(), None, play.api.Mode.Dev)

  • start new app

    play.api.Play.start(app)

  • do ws calls to https resources



来源:https://stackoverflow.com/questions/18073518/how-do-i-ignore-ssl-validation-in-play-framework-scala-ws-calls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!