mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-11-22 11:33:58 +00:00
Add support for custom tls server names. (#22372)
* Add support for custom tls server names. * Update samples * Fix missing declaration.
This commit is contained in:
parent
a1b962d0b6
commit
8a4246cbaf
@ -120,7 +120,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -433,6 +434,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1820,7 +1844,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -376,6 +377,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1635,7 +1659,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -86,7 +86,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -304,6 +305,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1565,7 +1589,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -86,7 +86,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -300,6 +301,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1539,7 +1563,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -86,7 +86,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -300,6 +301,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1539,7 +1563,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -86,7 +86,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -300,6 +301,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1562,7 +1586,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -376,6 +377,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1635,7 +1659,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -376,6 +377,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1635,7 +1659,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -92,7 +92,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -380,6 +381,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1655,7 +1679,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -97,7 +97,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -393,6 +394,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1640,7 +1664,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -376,6 +377,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1635,7 +1659,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -379,6 +380,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1638,7 +1662,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -382,6 +383,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1641,7 +1665,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -376,6 +377,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1635,7 +1659,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -91,7 +91,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -376,6 +377,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1635,7 +1659,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
@ -134,7 +134,8 @@ public class ApiClient {
|
|||||||
protected InputStream sslCaCert;
|
protected InputStream sslCaCert;
|
||||||
protected boolean verifyingSsl;
|
protected boolean verifyingSsl;
|
||||||
protected KeyManager[] keyManagers;
|
protected KeyManager[] keyManagers;
|
||||||
|
protected String tlsServerName;
|
||||||
|
|
||||||
protected OkHttpClient httpClient;
|
protected OkHttpClient httpClient;
|
||||||
protected JSON json;
|
protected JSON json;
|
||||||
|
|
||||||
@ -428,6 +429,29 @@ public class ApiClient {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get TLS server name for SNI (Server Name Indication).
|
||||||
|
*
|
||||||
|
* @return The TLS server name
|
||||||
|
*/
|
||||||
|
public String getTlsServerName() {
|
||||||
|
return tlsServerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TLS server name for SNI (Server Name Indication).
|
||||||
|
* This is used to verify the server certificate against a specific hostname
|
||||||
|
* instead of the hostname in the URL.
|
||||||
|
*
|
||||||
|
* @param tlsServerName The TLS server name to use for certificate verification
|
||||||
|
* @return ApiClient
|
||||||
|
*/
|
||||||
|
public ApiClient setTlsServerName(String tlsServerName) {
|
||||||
|
this.tlsServerName = tlsServerName;
|
||||||
|
applySslSettings();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||||
*
|
*
|
||||||
@ -1709,7 +1733,17 @@ public class ApiClient {
|
|||||||
trustManagerFactory.init(caKeyStore);
|
trustManagerFactory.init(caKeyStore);
|
||||||
}
|
}
|
||||||
trustManagers = trustManagerFactory.getTrustManagers();
|
trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
if (tlsServerName != null && !tlsServerName.isEmpty()) {
|
||||||
|
hostnameVerifier = new HostnameVerifier() {
|
||||||
|
@Override
|
||||||
|
public boolean verify(String hostname, SSLSession session) {
|
||||||
|
// Verify the certificate against tlsServerName instead of the actual hostname
|
||||||
|
return OkHostnameVerifier.INSTANCE.verify(tlsServerName, session);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user