-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Add support for Couchbase's role based access #16389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
7f81cc1
91c798b
67270fd
74f8f57
e0aeb65
e772ad0
f098f02
38df10b
8e19ebd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,14 @@ public DefaultCouchbaseEnvironment couchbaseEnvironment() { | |
@Bean | ||
@Primary | ||
public Cluster couchbaseCluster() { | ||
return CouchbaseCluster.create(couchbaseEnvironment(), determineBootstrapHosts()); | ||
CouchbaseCluster couchbaseCluster = CouchbaseCluster | ||
.create(couchbaseEnvironment(), determineBootstrapHosts()); | ||
if (this.properties.getUsername() != null | ||
&& this.properties.getPassword() != null) { | ||
return couchbaseCluster.authenticate(this.properties.getUsername(), | ||
this.properties.getPassword()); | ||
} | ||
return couchbaseCluster; | ||
} | ||
|
||
/** | ||
|
@@ -79,6 +86,10 @@ public ClusterInfo couchbaseClusterInfo() { | |
@Bean | ||
@Primary | ||
public Bucket couchbaseClient() { | ||
if (this.properties.getUsername() != null | ||
&& this.properties.getPassword() != null) { | ||
return couchbaseCluster().openBucket(this.properties.getBucket().getName()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This condition should be inverted. If RBAC Sorry if I missed this earlier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks. I inverted it. 👍 |
||
} | ||
return couchbaseCluster().openBucket(this.properties.getBucket().getName(), | ||
this.properties.getBucket().getPassword()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
username
andpassword
properties are initialized to empty string (""
). Will they ever be null? A better check might be.isEmpty()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps how can ı miss 👎 Thanks for your awesome attention