Skip to content

Commit

Permalink
fix: Update the README.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
shy1st committed Apr 23, 2021
1 parent 0babe49 commit 714af60
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: ossrh
server-username: OSSRH_JIRA_USERNAME
server-password: OSSRH_JIRA_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Build with Maven
run: mvn clean test cobertura:cobertura
Expand Down
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
# redis-adapter
# Redis Adapter

[![codebeat badge](https://codebeat.co/badges/560a67fc-53b6-4a10-8e1b-989f3bb4e5cb)](https://codebeat.co/projects/github-com-jcasbin-redis-adapter-master)
[![codecov](https://codecov.io/gh/jcasbin/redis-adapter/branch/master/graph/badge.svg?token=5wzDaTC9UV)](https://codecov.io/gh/jcasbin/redis-adapter)
[![Javadocs](https://www.javadoc.io/badge/org.casbin/shiro-casbin.svg)](https://www.javadoc.io/doc/org.casbin/shiro-casbin)
[![Maven Central](https://img.shields.io/maven-central/v/org.casbin/shiro-casbin.svg)](https://mvnrepository.com/artifact/org.casbin/shiro-casbin/latest)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/casbin/lobby)

Redis Adapter is the [Redis](https://redis.io/) adapter for [jCasbin](https://github.com/casbin/jcasbin). With this library, Casbin can load policy from Redis or save policy to it.

## Installation

```xml
<dependency>
<groupId>org.casbin</groupId>
<artifactId>redis-adapter</artifactId>
<version>1.0.0</version>
</dependency>
```

## Simple Example

```java
package org.casbin.adapter;

import org.casbin.jcasbin.main.Enforcer;

public class Main {
public static void main(String[] args) {
// Initialize a Redis adapter and use it in a jCasbin enforcer:
RedisAdapter a = new RedisAdapter("localhost", 6379);
// Use the following if Redis has password like "123"
// RedisAdapter a = new RedisAdapter("localhost", 6379, "123");
Enforcer e = new Enforcer("examples/rbac_model.conf", a);

// Load the policy from DB.
e.loadPolicy();

// Check the permission.
e.enforce("alice", "data1", "read");

// Modify the policy.
// e.addPolicy(...);
// e.removePolicy(...);

// Save the policy back to DB.
e.savePolicy();
}
}
```

## Getting Help

- [jCasbin](https://github.com/casbin/jcasbin)

## License

This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Include zipped source code in releases -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- Automatically close and deploy from OSSRH -->
<groupId>org.sonatype.plugins</groupId>
Expand Down

0 comments on commit 714af60

Please sign in to comment.