Casbin
Plugins

Dispatchers

Dispatchers provide a way to synchronize incremental changes of policy.

Dispatchers enable synchronization of incremental policy changes across distributed Casbin enforcer instances. They rely on consistency algorithms like Raft to maintain uniform policy state across all enforcers, simplifying the creation of distributed authorization clusters.

A dispatcher's functionality is split into two parts. The first consists of methods integrated with Casbin's core. These methods are called internally by Casbin, allowing developers to use Casbin's standard API without modification.

The second part includes the dispatcher's own initialization and algorithm-specific features, such as dynamic membership management and configuration updates.

Dispatchers synchronize runtime policy changes only. They do not resolve pre-existing inconsistencies during initialization. You must ensure all enforcer instances start with identical policy states before enabling dispatchers.

Below is a list of available Casbin dispatchers. Contributions of new dispatchers are welcome—let us know, and we'll include them here.

DistributedEnforcer

DistributedEnforcer wraps SyncedEnforcer to work with dispatchers.

    e, _ := casbin.NewDistributedEnforcer("examples/basic_model.conf", "examples/basic_policy.csv")

On this page