An authorization library that supports access control models like ACL, RBAC, ABAC
open sourceApache-2.0free
Casbin is an access control library that enforces authorization policies in your application, with implementations in Go, Java, Node.js, Python, PHP, .NET, Rust, C++, Lua and more that share the same API and behaviour. Access control models (ACL, RBAC, ABAC and variants) are written as configuration files on its PERM metamodel (policy, effect, request, matchers), so a model can change without rewriting code. Policies live in memory, files or databases through adapters for MySQL, Postgres, Oracle, MongoDB, Redis, Cassandra, S3 and others, with filtered loading for large multi-tenant systems, and role managers can read roles from LDAP, Okta, Auth0 or Azure AD. It's Apache-2.0 licensed and an Apache Software Foundation incubating project; its site lists AWS, Intel, NVIDIA, Docker and Cisco among users.
Problems it solves
- add role-based access control to my Go API without writing permission checks everywhere
- enforce the same authorization rules across services written in different languages
- change our permission model from roles to attributes without rewriting the code
- store authorization policies in Postgres and change them at runtime
- check whether a user can perform an action on a resource with one function call
- multi-tenant permissions where each customer defines its own roles
- pull users' roles from LDAP or Okta into our app's permission checks
- protect REST endpoints by path and HTTP method with a policy file
Features
- ACL, RBAC and ABAC models
- models as CONF files on the PERM metamodel
- implementations in Go, Java, Node.js, front-end JavaScript, Python, PHP, .NET, Rust, C++, Ruby, Swift, Lua, Dart, Elixir and Delphi
- same API and behaviour across implementations
- policy adapters for files, MySQL, Postgres, Oracle, MongoDB, Redis, Cassandra and S3
- filtered policy loading for multi-tenant systems
- role managers backed by LDAP, Okta, Auth0 or Azure AD
- integrations for Kubernetes, Istio, Envoy, OpenResty, Kong and APISIX
Capabilities
| Takes plugins | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Apache Casbin does.
- Cerbos Authorize every identity. Govern every action.
- OpenFGA Fine-grained authorization
- Open Policy Agent An open source, general-purpose policy engine that unifies policy enforcement across the stack
- Pundit Minimal authorization through OO design and pure Ruby classes
- CanCanCan The authorization Gem for Ruby on Rails
- SpiceDB Open-source, Google Zanzibar-inspired database for fine-grained authorization
