Casbin CouchDB Adapter is an adapter for jCasbin, a robust authorization library that supports access control models like ACL, RBAC, ABAC in Java, using CouchDB as a storage backend.
- Efficient and secure data handling with CouchDB.
- Easy integration with jCasbin.
- Scalable for large datasets.
- Support for all jCasbin models (ACL, RBAC, ABAC).
Requirements:
- JDK 17
./gradlew build
To install the casbin-couchdb-adapter
, add the following dependency to your build.gradle
file:
dependencies {
implementation 'io.github.java-casbin:casbin-couchdb-adapter'
}
Or if you are using Maven, add the following dependency to your pom.xml
file:
<dependency>
<groupId>io.github.java-casbin</groupId>
<artifactId>casbin-couchdb-adapter</artifactId>
</dependency>
Here's a basic example of how to use the casbin-couchdb-adapter
with jCasbin:
import org.casbin.jcasbin.main.Enforcer;
import com.github.yourusername.casbin.CouchDBAdapter;
public class Main {
public static void main(String[] args) {
CouchDbProperties properties = new CouchDbProperties()
.setDbName("test_db")
.setCreateDbIfNotExist(true)
.setUsername("admin")
.setPassword("admin")
.setProtocol("http")
.setHost("localhost")
.setPort(5984)
.setMaxConnections(100)
.setConnectionTimeout(0);
couchDbClient = new CouchDbClient(properties);
String modelPath = "path/to/model.conf";
CouchDBAdapter adapter = new CouchDBAdapter(couchDbClient, "policies");
Enforcer enforcer = new Enforcer(modelPath, adapter);
// use the enforcer...
}
}
Contributions to casbin-couchdb-adapter
are welcome! Please feel free to open an issue or submit a pull request if you
have any questions or suggestions.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
- Change the version to the next release version in
build.gradle
. - Run
./bundle.sh
to build the bundle file. The bundle file will be located atbuild/bundle.zip
. - Upload the bundle file to https://central.sonatype.com/
- Create a new release on GitHub with the release notes