-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Ensure certificate verification by using a singleton and defaults. #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What's the benefit of this singleton over the static class? What are the benefits of this SingletonHolder pattern (first time I see it)? Why not an enum? |
singleton holder is a thread safe lazy initialization pattern: https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom |
OK, thanks :) |
I just tried to merge and got the following test errors:
@wsargent Did you run the tests successfully before submitting? |
@wsargent OK, I feel stupid: that's just that the tests use a self-signed certificate. With your PR, in order to have AHC work with servers using self signed certificates is to expect the users to create a SSLContext with a "trust all" TrustManager and either set the Default SSLContext or pass it in AHC config. Do I get it right? If so, this is way too much a constraint, we should ship such a permissive TrustManager and have an option for enabling/disabling. How do you deal with this in Play? |
From memory, but I think the way I did it in Play was to add a self signed certificate to a trust manager explicitly in the test. |
But that means that Play WS doesn't work with self signed certificates, like it's usually the case on dev/test platforms?! |
Ha, OK, if |
So honestly, you're PR was excessive: if you completely remove AHC LooseTrustManager like you did, you're shooting yourself in the foot and will have to reimplement it in Play. :) |
By design. playframework/playframework#2855 |
Fixes #352