scala - how to ignore Play Framework WS SSL certs without making my entire application insecure? -
newb alert! i'll try describe clear , concise.
scala 2.10.3, play 2.2.1.
i have play application gets used on https. have setting in conf/application.conf
file making sure play app uses ssl (and it's been tested , it's fine):
session.secure=true
but now, want play app connect webservice, using ws library. webservice on https self-signed ssl certificate. can set following setting in conf/application.conf
file don't have deal webservice certificates - i'd prefer that. (the webservice flavor of special, prefer not deal certificates @ all):
ws.acceptanycertificate=true
when set both of these true
appears compile , run. dow these 2 different settings interact, overlap, and/or interfere? more secure app if use asynchttpclient, , set sslcontext
?
i tried setting keymanager , keystore in conf/application.conf
ws call results in sslengine error - think due me using play 2.2.1 , ssl support ws available on play 2.3.x +
note: make following kind of call using ws. need future response complete, , function return boolean value. should instead using
def myfun : boolean = { var ret : boolean = false val futureresult = ws.url("https://somewhere.com").post(jsoninput) oncomplete { case success(response) => { ret = true } case failure(e) => { log.error("badness") } } ret }
ref:
how ignore ssl validation in play framework scala ws calls
https://www.playframework.com/documentation/2.2.x/scalaws
https://www.playframework.com/documentation/2.3.x/wsquickstart
you should not set ws.acceptanycertificate. , need keymanager , key store if intend client authentication.
add self signed certificate trust store instead, or define custom trust store on command line "javax.net.ssl.truststore" -- see http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/jsserefguide.html#customization details.
https://www.playframework.com/documentation/2.3.x/certificategeneration walk through how add certificate truststore.
there activator template should help: http://typesafe.com/activator/template/play-tls-example
Comments
Post a Comment