Skip to main content


一个支持如ACL, RBAC, ABAC等访问模型,可用于Golang, Java, C/C++, Node.js, Javascript, PHP, Laravel, Python, .NET (C#), Delphi, Rust, Ruby, Lua (OpenResty), Dart (Flutter)和Elixir的授权库。



在Casbin,访问控制模型是基于PERM元模型 (Policy, Effect, Request, Matchers) 压缩而成的一个CONF文件。 因此,项目授权机制的转换或升级就像修改配置一样简单。


除了内存和文件外,Casbin策略还可以存储在许多地方。 目前Casbin已经支持了从MySQL、Postgres、Oracle到MongoDB、Redis、Cassandra、AWS S3等数十种数据库。请在此查看完整的支持列表:适配器.

跨语言 & 跨平台

Casbin已经使用Golang、Java、PHP和Node.js等等语言实现。 所有的实现共享相同的 API 和行为。学习一次即可到处使用。

Policy Persistence

In Casbin, the policy storage is implemented as an adapter(aka middleware for Casbin). To keep light-weight, we don't put adapter code in the main library (except the default file adapter). A complete list of Casbin adapters is provided as below. Any 3rd-party contribution on a new adapter is welcomed, please inform us and I will put it in this list:) For details of adapters, please refer to the documentation: 适配器.
Policy Persistence
Policy enforcement at scale

Policy enforcement at scale

Some adapters support filtered policy management. This means that the policy loaded by Casbin is a subset of the policy in storage based on a given filter. This allows for efficient policy enforcement in large, multi-tenant environments when parsing the entire policy becomes a performance bottleneck.


The role manager is used to manage the RBAC role hierarchy (user-role mapping) in Casbin. A role manager can retrieve the role data from Casbin policy rules or external sources such as LDAP, Okta, Auth0, Azure AD, etc. We support different implementations of a role manager. To keep light-weight, we don't put role manager code in the main library (except the default role manager). A complete list of Casbin role managers is provided as: role-managers .
Role manager


Hundreds of projects are using Casbin, from established Fortune 500 companies to hot new startups.If you're curious to see what can be accomplished Casbin, 请查看这些应用程序吧!