Redis watcher for Casbin.NET
dotnet add package Casbin.Watcher.Redis
using Casbin;
using Redis.Casbin.NET;
public class Program
{
public static void Main(string[] args)
{
// Initialize the watcher.
// Use the Redis host as parameter.
var watcher = new RedisWatcher("127.0.0.1:6379");
// Initialize the enforcer.
var enforcer = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv");
// Set the watcher for the enforcer.
enforcer.SetWatcher(watcher);
// Update the policy to test the effect.
enforcer.SavePolicy();
}
}
This project is under Apache 2.0 License. See the LICENSE file for the full license text.