forked from loafle/openapi-generator-original
[Java] Add custom SSL KeyManagers for okhttp-gson Java clients (#5629)
* Add the ability to set SSL KeyManagers for okhttp-gson Java clients * Update generated code. * Update security model files.
This commit is contained in:
@@ -127,6 +127,7 @@ public class ApiClient {
|
||||
|
||||
private InputStream sslCaCert;
|
||||
private boolean verifyingSsl;
|
||||
private KeyManager[] keyManagers;
|
||||
|
||||
private OkHttpClient httpClient;
|
||||
private JSON json;
|
||||
@@ -274,6 +275,23 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeyManager[] getKeyManagers() {
|
||||
return keyManagers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure client keys to use for authorization in an SSL session.
|
||||
* Use null to reset to default.
|
||||
*
|
||||
* @param managers The KeyManagers to use
|
||||
* @return ApiClient
|
||||
*/
|
||||
public ApiClient setKeyManagers(KeyManager[] managers) {
|
||||
this.keyManagers = managers;
|
||||
applySslSettings();
|
||||
return this;
|
||||
}
|
||||
|
||||
public DateFormat getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
@@ -1263,7 +1281,6 @@ public class ApiClient {
|
||||
*/
|
||||
private void applySslSettings() {
|
||||
try {
|
||||
KeyManager[] keyManagers = null;
|
||||
TrustManager[] trustManagers = null;
|
||||
HostnameVerifier hostnameVerifier = null;
|
||||
if (!verifyingSsl) {
|
||||
|
||||
Reference in New Issue
Block a user