Browse Source
Sometimes, it's useful to override the hostname verifier for SSL connections. One example, would be when you're developing against a test server managed by another company that's using a self-signed certificate with a mis-matched hostname. This patch enables that usage by overriding the default HostnameVerifier in a Dagger module. Adding test coverage required switching the TrustingSSLSocketFactory from using an anonymous cipher suite to one that authenticates. A test keystore is used for this purpose. It contains two self-signed certificates, one each with alias (and CN) "localhost" and "bad.example.com". The TrustingSSLSocketFactory is no longer a singleton; it now optionally takes a key alias as an argument.4.x
David M. Carr
11 years ago
committed by
adriancole
7 changed files with 157 additions and 14 deletions
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
Feign |
||||
Copyright 2013 Netflix, Inc. |
||||
|
||||
Portions of this software developed by Commerce Technologies, Inc. |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
/* |
||||
* Copyright 2013 Netflix, Inc. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package feign; |
||||
|
||||
import javax.net.ssl.HostnameVerifier; |
||||
import javax.net.ssl.SSLSession; |
||||
|
||||
final class AcceptAllHostnameVerifier implements HostnameVerifier { |
||||
@Override |
||||
public boolean verify(String s, SSLSession sslSession) { |
||||
return true; |
||||
} |
||||
} |
Binary file not shown.
Loading…
Reference in new issue