Overview
Casbin is a powerful and efficient open-source access control library. It provides support for enforcing authorization based on various access control models.
All the languages supported by Casbin:β
Casbin | jCasbin | node-Casbin | PHP-Casbin |
production-ready | production-ready | production-ready | production-ready |
PyCasbin | Casbin.NET | Casbin-CPP | Casbin-RS |
production-ready | production-ready | production-ready | production-ready |
Feature set for different languagesβ
Feature | Go | Java | Node.js | PHP | Python | C# | Delphi | Rust | C++ | Lua | Dart | Elixir |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Enforcement | β | β | β | β | β | β | β | β | β | β | β | β |
RBAC | β | β | β | β | β | β | β | β | β | β | β | β |
ABAC | β | β | β | β | β | β | β | β | β | β | β | β |
Scaling ABAC (eval() ) | β | β | β | β | β | β | β | β | β | β | β | β |
Adapter | β | β | β | β | β | β | β | β | β | β | β | β |
Management API | β | β | β | β | β | β | β | β | β | β | β | β |
RBAC API | β | β | β | β | β | β | β | β | β | β | β | β |
Batch API | β | β | β | β | β | β | β | β | β | β | β | β |
Filtered Adapter | β | β | β | β | β | β | β | β | β | β | β | β |
Watcher | β | β | β | β | β | β | β | β | β | β | β | β |
Role Manager | β | β | β | β | β | β | β | β | β | β | β | β |
Multi-Threading | β | β | β | β | β | β | β | β | β | β | β | β |
'in' of matcher | β | β | β | β | β | β | β | β | β | β | β | β |
We are always working our best to make Casbin have the same set of features for all languages. But the reality is not that beautiful. The current progress is as the above table. β for Watcher or Role Manager only means having the interface in the core library. Whether there is an available watcher or role manager implementation is another question.
What is Casbin?β
What Casbin does:
- enforce the policy in the classic
{subject, object, action}
form or a customized form as you defined, both allow and deny authorizations are supported. - handle the storage of the access control model and its policy.
- manage the role-user mappings and role-role mappings (aka role hierarchy in RBAC).
- support built-in superuser like
root
oradministrator
. A superuser can do anything without explicit permissions. - multiple built-in operators to support the rule matching. For example,
keyMatch
can map a resource key/foo/bar
to the pattern/foo*
.
What Casbin does NOT do:
- authentication (aka verify
username
andpassword
when a user logs in) - manage the list of users or roles. I believe it's more convenient for the project itself to manage these entities. Users usually have their passwords, and Casbin is not designed as a password container. However, Casbin stores the user-role mapping for the RBAC scenario.