[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:
Brendan Burns
2017-05-12 08:49:00 -07:00
committed by wing328
parent 68864a2eea
commit e7a1f5fb17
4 changed files with 72 additions and 4 deletions

View File

@@ -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) {