diff --git a/src/main/java/io/ebean/config/DocStoreConfig.java b/src/main/java/io/ebean/config/DocStoreConfig.java index 6abf084e0..31405d3f8 100644 --- a/src/main/java/io/ebean/config/DocStoreConfig.java +++ b/src/main/java/io/ebean/config/DocStoreConfig.java @@ -33,6 +33,16 @@ public class DocStoreConfig { */ protected String url; + /** + * Credential that be used for authentication to document store. + */ + protected String username; + + /** + * Password credential that be used for authentication to document store. + */ + protected String password; + /** * Set to true such that the client allows connections to invalid/self signed SSL certificates. */ @@ -92,6 +102,34 @@ public class DocStoreConfig { return url; } + /** + * Return the user credential for connecting to the document store. + */ + public String getUsername() { + return username; + } + + /** + * Set the user credential for connecting to the document store. + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * Return the password credential for connecting to the document store. + */ + public String getPassword() { + return password; + } + + /** + * Set the password credential for connecting to the document store. + */ + public void setPassword(String password) { + this.password = password; + } + /** * Set the URL to the Document store server. *

@@ -267,6 +305,8 @@ public class DocStoreConfig { active = properties.getBoolean("docstore.active", active); url = properties.get("docstore.url", url); + username = properties.get("docstore.username", url); + password = properties.get("docstore.password", url); persist = properties.getEnum(DocStoreMode.class, "docstore.persist", persist); bulkBatchSize = properties.getInt("docstore.bulkBatchSize", bulkBatchSize); generateMapping = properties.getBoolean("docstore.generateMapping", generateMapping); diff --git a/src/test/java/io/ebean/config/DocStoreConfigTest.java b/src/test/java/io/ebean/config/DocStoreConfigTest.java index e3fe6b6a7..295d6948d 100644 --- a/src/test/java/io/ebean/config/DocStoreConfigTest.java +++ b/src/test/java/io/ebean/config/DocStoreConfigTest.java @@ -20,6 +20,8 @@ public class DocStoreConfigTest { properties.setProperty("ebean.docstore.url", "http://foo:9800"); properties.setProperty("ebean.docstore.persist", "IGNORE"); properties.setProperty("ebean.docstore.allowAllCertificates", "true"); + properties.setProperty("ebean.docstore.username", "fred"); + properties.setProperty("ebean.docstore.password", "rock"); PropertiesWrapper wrapper = new PropertiesWrapper("ebean", null, properties); @@ -30,6 +32,8 @@ public class DocStoreConfigTest { assertFalse(config.isGenerateMapping()); assertFalse(config.isDropCreate()); assertEquals("http://foo:9800", config.getUrl()); + assertEquals("fred", config.getUsername()); + assertEquals("rock", config.getPassword()); assertEquals(DocStoreMode.IGNORE, config.getPersist()); assertEquals(99, config.getBulkBatchSize()); }