All Projects → casbin → Etcd Watcher

casbin / Etcd Watcher

Licence: apache-2.0
Etcd watcher for Casbin

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Etcd Watcher

Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Golang
Stars: ✭ 10,872 (+6824.84%)
Mutual labels:  etcd, authorization, access-control, casbin
Xorm Adapter
Xorm adapter for Casbin
Stars: ✭ 329 (+109.55%)
Mutual labels:  authorization, access-control, casbin
Casbin Editor
Web-based model & policy editor for Casbin
Stars: ✭ 45 (-71.34%)
Mutual labels:  authorization, access-control, casbin
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (-13.38%)
Mutual labels:  authorization, access-control, casbin
Casbin4D
An authorization library that supports access control models like ACL, RBAC, ABAC in Delphi
Stars: ✭ 25 (-84.08%)
Mutual labels:  authorization, access-control, casbin
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (-67.52%)
Mutual labels:  authorization, access-control, casbin
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (+137.58%)
Mutual labels:  authorization, access-control, casbin
lua-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (OpenResty)
Stars: ✭ 43 (-72.61%)
Mutual labels:  authorization, access-control, casbin
Casbin.net
An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)
Stars: ✭ 535 (+240.76%)
Mutual labels:  authorization, access-control, casbin
Node Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Node.js and Browser
Stars: ✭ 1,757 (+1019.11%)
Mutual labels:  authorization, access-control, casbin
Casbin Cpp
An authorization library that supports access control models like ACL, RBAC, ABAC in C/C++
Stars: ✭ 113 (-28.03%)
Mutual labels:  authorization, access-control, casbin
Negroni Authz
negroni-authz is an authorization middleware for Negroni
Stars: ✭ 152 (-3.18%)
Mutual labels:  authorization, access-control, casbin
casbin-ex
An authorization library that supports access control models like ACL, RBAC, ABAC in Elixir
Stars: ✭ 37 (-76.43%)
Mutual labels:  authorization, access-control, casbin
Openstack Policy Editor
A Casbin Policy Editor for OpenStack
Stars: ✭ 28 (-82.17%)
Mutual labels:  authorization, access-control, casbin
dart-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Dart/Flutter
Stars: ✭ 30 (-80.89%)
Mutual labels:  authorization, access-control, casbin
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+750.32%)
Mutual labels:  authorization, access-control, casbin
Caddy Authz
Caddy-authz is a middleware for Caddy that blocks or allows requests based on access control policies.
Stars: ✭ 221 (+40.76%)
Mutual labels:  authorization, access-control, casbin
Chi Authz
chi-authz is an authorization middleware for Chi
Stars: ✭ 248 (+57.96%)
Mutual labels:  authorization, access-control, casbin
Casbin Rs
An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
Stars: ✭ 375 (+138.85%)
Mutual labels:  authorization, access-control, casbin
Pycasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Python
Stars: ✭ 625 (+298.09%)
Mutual labels:  authorization, access-control, casbin

Etcd Watcher Build Status Coverage Status Godoc

Etcd Watcher is the Etcd watcher for Casbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.

Installation

go get github.com/casbin/etcd-watcher

Simple Example

package main

import (
    "log"

    "github.com/casbin/casbin"
    "github.com/casbin/etcd-watcher"
)

func updateCallback(rev string) {
    log.Println("New revision detected:", rev)
}

func main() {
    // Initialize the watcher.
    // Use the endpoint of etcd cluster as parameter.
    w, _ := etcdwatcher.NewWatcher("http://127.0.0.1:2379")
    
    // Initialize the enforcer.
    e, _ := casbin.NewEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")
    
    // Set the watcher for the enforcer.
    e.SetWatcher(w)
    
    // By default, the watcher's callback is automatically set to the
    // enforcer's LoadPolicy() in the SetWatcher() call.
    // We can change it by explicitly setting a callback.
    w.SetUpdateCallback(updateCallback)
    
    // Update the policy to test the effect.
    // You should see "[New revision detected: X]" in the log.
    e.SavePolicy()
}

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].