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

Commit 215365a

Browse files
author
Rob Rudin
committed
#141 Added mlRestAuthentication
1 parent 45a027b commit 215365a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/com/marklogic/appdeployer/DefaultAppConfigFactory.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.marklogic.appdeployer;
22

3+
import com.marklogic.client.DatabaseClientFactory;
34
import com.marklogic.mgmt.util.PropertySource;
45
import com.marklogic.mgmt.util.PropertySourceFactory;
56

@@ -93,6 +94,12 @@ public AppConfig newAppConfig() {
9394
c.setRestPort(Integer.parseInt(prop));
9495
}
9596

97+
prop = getProperty("mlRestAuthentication");
98+
if (prop != null) {
99+
logger.info("App REST authentication: " + prop);
100+
c.setRestAuthentication(DatabaseClientFactory.Authentication.valueOfUncased(prop));
101+
}
102+
96103
/**
97104
* If a test REST API server is created, it will use the following port.
98105
*/

src/test/java/com/marklogic/appdeployer/DefaultAppConfigFactoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.List;
44
import java.util.Properties;
55

6+
import com.marklogic.client.DatabaseClientFactory;
67
import org.junit.Assert;
78
import org.junit.Test;
89

@@ -52,6 +53,7 @@ public void allProperties() {
5253
p.setProperty("mlPassword", "proppassword");
5354
p.setProperty("mlRestAdminUsername", "propuser2");
5455
p.setProperty("mlRestAdminPassword", "proppassword2");
56+
p.setProperty("mlRestAuthentication", "basic");
5557
p.setProperty("mlContentForestsPerHost", "17");
5658
p.setProperty("mlModulePermissions", "some-perm,read,some-perm,update");
5759
p.setProperty("mlAdditionalBinaryExtensions", ".gradle,.properties");
@@ -87,6 +89,7 @@ public void allProperties() {
8789
assertEquals((Integer) 8765, config.getTestRestPort());
8890
assertEquals("propuser2", config.getRestAdminUsername());
8991
assertEquals("proppassword2", config.getRestAdminPassword());
92+
assertEquals(DatabaseClientFactory.Authentication.BASIC, config.getRestAuthentication());
9093
assertEquals((Integer) 17, config.getContentForestsPerHost());
9194
assertEquals("some-perm,read,some-perm,update", config.getModulePermissions());
9295
String[] extensions = config.getAdditionalBinaryExtensions();

0 commit comments

Comments
 (0)