Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,29 @@ public class ApiClient {
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>
*
Expand Down Expand Up @@ -1820,7 +1843,17 @@ public class ApiClient {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1635,7 +1658,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1565,7 +1588,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1539,7 +1562,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1539,7 +1562,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1562,7 +1585,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1635,7 +1658,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
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>
*
Expand Down Expand Up @@ -1635,7 +1658,17 @@ public boolean verify(String hostname, SSLSession session) {
trustManagerFactory.init(caKeyStore);
}
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");
Expand Down
Loading
Loading