
com.aliyun.credentials.http.DefaultHostnameVerifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of credentials-java Show documentation
Show all versions of credentials-java Show documentation
Alibaba Cloud Credentials for Java
Copyright (C) Alibaba Cloud Computing
All rights reserved.
版权所有 (C)阿里云计算有限公司
https://www.aliyun.com
package com.aliyun.credentials.http;
import okhttp3.internal.tls.OkHostnameVerifier;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
public class DefaultHostnameVerifier implements HostnameVerifier {
private boolean ignoreSSLCert = false;
private static final HostnameVerifier NOOP_INSTANCE = new DefaultHostnameVerifier(true);
private DefaultHostnameVerifier(boolean ignoreSSLCert) {
this.ignoreSSLCert = ignoreSSLCert;
}
public static HostnameVerifier getInstance(boolean ignoreSSLCert) {
if (ignoreSSLCert) {
return NOOP_INSTANCE;
} else {
return OkHostnameVerifier.INSTANCE;
}
}
@Override
public boolean verify(String s, SSLSession sslSession) {
return ignoreSSLCert;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy