Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/casbin-net/redis-adapter
Redis adapter for Casbin.NET
https://github.com/casbin-net/redis-adapter
abac acl adapter auth authorization authz casbin casbin-net csharp dotnet rbac redis
Last synced: 22 days ago
JSON representation
Redis adapter for Casbin.NET
- Host: GitHub
- URL: https://github.com/casbin-net/redis-adapter
- Owner: casbin-net
- License: apache-2.0
- Created: 2022-07-03T09:01:57.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-01T09:11:42.000Z (over 1 year ago)
- Last Synced: 2024-08-05T17:25:57.224Z (4 months ago)
- Topics: abac, acl, adapter, auth, authorization, authz, casbin, casbin-net, csharp, dotnet, rbac, redis
- Language: C#
- Homepage: https://github.com/casbin/Casbin.NET
- Size: 37.1 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - casbin-net/redis-adapter - Redis adapter for Casbin.NET (C# #)
README
# Casbin.NET Redis Adapter
[![Actions Status](https://github.com/casbin-net/Redis-Adapter/workflows/Build/badge.svg)](https://github.com/casbin-net/Redis-Adapter/actions)
[![Coverage Status](https://coveralls.io/repos/github/casbin-net/Redis-Adapter/badge.svg?branch=master)](https://coveralls.io/github/casbin-net/Redis-Adapter?branch=master)
[![NuGet](https://buildstats.info/nuget/Casbin.NET.Adapter.Redis)](https://www.nuget.org/packages/Casbin.NET.Adapter.Redis)Redis Adapter is the [Redis](https://redis.io/) adapter for [Casbin](https://github.com/casbin/casbin). With this library, Casbin can load policy from Redis or save policy to it.
## Installation
```
dotnet add package Casbin.NET.Adapter.Redis
```## Simple Example
```csharp
using Casbin.Adapter.Redis;
using NetCasbin;namespace ConsoleAppExample
{
public class Program
{
public static void Main(string[] args)
{
// Initialize a Redis adapter and use it in a Casbin enforcer:
var redisAdapter = new RedisAdapter("localhost:6379");
var e = new Enforcer("examples/rbac_model.conf", redisAdapter);// Load the policy from Redis.
e.LoadPolicy();// Check the permission.
e.Enforce("alice", "data1", "read");
// Modify the policy.
// e.AddPolicy(...)
// e.RemovePolicy(...)
// Save the policy back to Redis.[README.md](..%2Fcasbin-aspnetcore%2FREADME.md)
e.SavePolicy();
}
}
}
```## Getting Help
- [Casbin.NET](https://github.com/casbin/Casbin.NET)
## License
This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.