-
Notifications
You must be signed in to change notification settings - Fork 41.1k
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 4 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 |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.boot.autoconfigure.couchbase; | ||
|
||
import java.time.Duration; | ||
|
@@ -70,6 +69,16 @@ public static class Bucket { | |
*/ | ||
private String password = ""; | ||
|
||
/** | ||
* Username of the bucket. | ||
*/ | ||
private String userName = ""; | ||
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. RBAC credentials are for the whole cluster, not just one bucket. Instead of adding the username to the bucket, please add Please keep the separate bucket password for backwards compatibility with non-RBAC clusters. 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. moved username and password to top level of properties. |
||
|
||
/** | ||
* RoleBaseAccessEnable for support Couchbase bucket after version 5.0. | ||
*/ | ||
private boolean roleBaseAccessEnabled = false; | ||
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. Rather than requiring the user to explicitly enable RBAC, RABC should automtatically be enabled when the username is set. 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. removed roleBaseAccessEnabled properties. |
||
|
||
public String getName() { | ||
return this.name; | ||
} | ||
|
@@ -86,6 +95,22 @@ public void setPassword(String password) { | |
this.password = password; | ||
} | ||
|
||
public String getUserName() { | ||
return this.userName; | ||
} | ||
|
||
public void setUserName(String userName) { | ||
this.userName = userName; | ||
} | ||
|
||
public boolean isRoleBaseAccessEnabled() { | ||
return this.roleBaseAccessEnabled; | ||
} | ||
|
||
public void setRoleBaseAccessEnabled(boolean roleBaseAccessEnabled) { | ||
this.roleBaseAccessEnabled = roleBaseAccessEnabled; | ||
} | ||
|
||
} | ||
|
||
public static class Env { | ||
|
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.
Also need to change
CouchbaseConfiguration.couchbaseClient()
to callopenBucket(bucket.name)
if RBAC is enabled oropenBucket(bucket.name, bucket.password)
if RBAC is disabled. Otherwise the client will throwMixedAuthenticationException
.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.
Right thanks :)
added also here with RBAC control.