mirror of
https://github.com/square/okhttp.git
synced 2026-01-14 07:22:20 +03:00
Warn about how TrustManagers are weird on Android (#5686)
This commit is contained in:
committed by
Yuri Schimke
parent
3e61ce3cf0
commit
51fa06cfa7
@@ -726,6 +726,22 @@ open class OkHttpClient internal constructor(
|
||||
* .sslSocketFactory(sslSocketFactory, trustManager)
|
||||
* .build();
|
||||
* ```
|
||||
*
|
||||
* ## TrustManagers on Android are Weird!
|
||||
*
|
||||
* Trust managers targeting Android must also define a method that has this signature:
|
||||
*
|
||||
* ```
|
||||
* @SuppressWarnings("unused")
|
||||
* public List<X509Certificate> checkServerTrusted(
|
||||
* X509Certificate[] chain, String authType, String host) throws CertificateException {
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* This method works like [X509TrustManager.checkServerTrusted] but it receives the hostname of
|
||||
* the server as an extra parameter. Regardless of what checks this method performs, OkHttp will
|
||||
* always check that the server's certificates match its hostname using the [HostnameVerifier].
|
||||
* See [android.net.http.X509TrustManagerExtensions] for more information.
|
||||
*/
|
||||
fun sslSocketFactory(
|
||||
sslSocketFactory: SSLSocketFactory,
|
||||
|
||||
Reference in New Issue
Block a user