DATACOUCH-322 - Add RBAC username and password support
Motivation
----------
Couchbase server 5.0 allows role based access control and this allows
for users to be created and granted access to use bucket. Expose this
feature in SDC.
Changes
-------
1. Couchbase configurations allow for user name to be set. The user password
property is still retrieved from bucket password property.
2. CouchbaseFactoryBean has additional constructor for the username
property.
3. Couchbase bucket schema for xml configurations also includes username
property.
4. Integration tests have been restructured majorly to accomadate for
username
- Testcontainers are used to allow for container based testing.
- Container based testing is optional, it can be configured using
resources/server.properties
Results
-------
The RBAC change has been tested with pre 5.0 and 5.0+ versions using
containers. The tests pass.
Original pull request: #158.
This commit is contained in:
@@ -108,7 +108,7 @@ public class CouchbaseBucketParserTest {
|
||||
BeanDefinition def = factory.getBeanDefinition("bucketWithNameAndPassword");
|
||||
|
||||
assertThat(def, is(notNullValue()));
|
||||
assertThat(def.getConstructorArgumentValues().getArgumentCount(), is(equalTo(3)));
|
||||
assertThat(def.getConstructorArgumentValues().getArgumentCount(), is(equalTo(4)));
|
||||
assertThat(def.getPropertyValues().size(), is(equalTo(0)));
|
||||
|
||||
ConstructorArgumentValues.ValueHolder holder = def.getConstructorArgumentValues()
|
||||
@@ -123,8 +123,15 @@ public class CouchbaseBucketParserTest {
|
||||
assertThat(nameHolder.getValue(), is(instanceOf(String.class)));
|
||||
assertThat(nameHolder.getValue().toString(), is((equalTo("test"))));
|
||||
|
||||
ConstructorArgumentValues.ValueHolder passwordHolder = def.getConstructorArgumentValues()
|
||||
|
||||
ConstructorArgumentValues.ValueHolder usernameHolder = def.getConstructorArgumentValues()
|
||||
.getArgumentValue(2, Object.class);
|
||||
assertThat(usernameHolder.getValue(), is(instanceOf(String.class)));
|
||||
assertThat(usernameHolder.getValue().toString(), is((equalTo("testuser"))));
|
||||
|
||||
|
||||
ConstructorArgumentValues.ValueHolder passwordHolder = def.getConstructorArgumentValues()
|
||||
.getArgumentValue(3, Object.class);
|
||||
assertThat(passwordHolder.getValue(), is(instanceOf(String.class)));
|
||||
assertThat(passwordHolder.getValue().toString(), is((equalTo("123"))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user