Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit de3a68e

Browse files
committed
#295 Added securitySslContext
1 parent 1d6d0aa commit de3a68e

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/main/java/com/marklogic/mgmt/ManageClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ public void setManageConfig(ManageConfig config) {
7575
rc.setScheme(config.getScheme());
7676
rc.setConfigureSimpleSsl(config.isConfigureSimpleSsl());
7777
rc.setHostnameVerifier(config.getHostnameVerifier());
78-
rc.setSslContext(config.getSslContext());
78+
79+
if (config.getSecuritySslContext() != null) {
80+
rc.setSslContext(config.getSecuritySslContext());
81+
} else {
82+
rc.setSslContext(config.getSslContext());
83+
}
84+
7985
this.securityUserRestTemplate = RestTemplateUtil.newRestTemplate(rc);
8086
} else {
8187
this.securityUserRestTemplate = restTemplate;

src/main/java/com/marklogic/mgmt/ManageConfig.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
import com.marklogic.rest.util.RestConfig;
44

5+
import javax.net.ssl.SSLContext;
6+
57
/**
68
* Defines the configuration data for talking to the Mgmt REST API. Also includes properties for the security user, as this
79
* user is typically needed for creating an app-specific user (which may depend on app-specific roles and privileges)
8-
* which is then used for deploying every other resources. If securityUsername and securityPassword are not set, they default
9-
* to the username/password attribute values.
10+
* which is then used for deploying every other resources.
11+
*
12+
* If securityUsername and securityPassword are not set, they default to the username/password attribute values.
13+
* Additionally, as of version 3.8.3, setSecuritySslContext can be called to provide an SSLContext for the connection
14+
* made using securityUsername and securityPassword.
1015
*/
1116
public class ManageConfig extends RestConfig {
1217

@@ -19,6 +24,7 @@ public class ManageConfig extends RestConfig {
1924

2025
private String securityUsername;
2126
private String securityPassword;
27+
private SSLContext securitySslContext;
2228

2329
private boolean cleanJsonPayloads = false;
2430

@@ -105,4 +111,12 @@ public String getSecurityPassword() {
105111
public void setSecurityPassword(String securityPassword) {
106112
this.securityPassword = securityPassword;
107113
}
114+
115+
public SSLContext getSecuritySslContext() {
116+
return securitySslContext;
117+
}
118+
119+
public void setSecuritySslContext(SSLContext securitySslContext) {
120+
this.securitySslContext = securitySslContext;
121+
}
108122
}

0 commit comments

Comments
 (0)