[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4810":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":43,"readmeContent":44,"aiSummary":45,"trendingCount":16,"starSnapshotCount":16,"syncStatus":46,"lastSyncTime":47,"discoverSource":48},4810,"casbin","apache\u002Fcasbin","apache","Apache Casbin: an authorization library that supports access control models like ACL, RBAC, ABAC.","https:\u002F\u002Fcasbin.apache.org\u002F",null,"Go",20183,1742,236,46,0,4,15,84,13,93.62,"Apache License 2.0",false,"master",true,[27,28,29,7,30,31,32,33,34,35,5,36,37,38,39,40,41,42],"abac","access-control","acl","auth","authentication","authn","authorization","authz","cas","iam","oauth","oidc","permission","rbac","saml","sso","2026-06-12 04:00:22","Casbin\n====\n\n[![Go Report Card](https:\u002F\u002Fgoreportcard.com\u002Fbadge\u002Fgithub.com\u002Fcasbin\u002Fcasbin)](https:\u002F\u002Fgoreportcard.com\u002Freport\u002Fgithub.com\u002Fcasbin\u002Fcasbin)\n[![Build](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Factions\u002Fworkflows\u002Fdefault.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Factions\u002Fworkflows\u002Fdefault.yml)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002Fcasbin\u002Fcasbin\u002Fbadge.svg?branch=master)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002Fcasbin\u002Fcasbin?branch=master)\n[![Godoc](https:\u002F\u002Fgodoc.org\u002Fgithub.com\u002Fcasbin\u002Fcasbin?status.svg)](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fv2)\n[![Release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fcasbin\u002Fcasbin.svg)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Freleases\u002Flatest)\n[![Discord](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1022748306096537660?logo=discord&label=discord&color=5865F2)](https:\u002F\u002Fdiscord.gg\u002FS5UjpzGZjN)\n[![Sourcegraph](https:\u002F\u002Fsourcegraph.com\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002F-\u002Fbadge.svg)](https:\u002F\u002Fsourcegraph.com\u002Fgithub.com\u002Fcasbin\u002Fcasbin?badge)\n\n**News**: still worry about how to write the correct Casbin policy? ``Casbin online editor`` is coming to help! Try it at: https:\u002F\u002Fcasbin.org\u002Feditor\u002F\n\n![casbin Logo](casbin-logo.png)\n\nCasbin is a powerful and efficient open-source access control library for Golang projects. It provides support for enforcing authorization based on various [access control models](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FComputer_security_model).\n\n## All the languages supported by Casbin:\n\n| [![golang](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fgolang.png)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin) | [![java](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fjava.png)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fjcasbin) | [![nodejs](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fnodejs.png)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fnode-casbin) | [![php](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fphp.png)](https:\u002F\u002Fgithub.com\u002Fphp-casbin\u002Fphp-casbin) |\n|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|\n| [Casbin](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin)                                             | [jCasbin](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fjcasbin)                                        | [node-Casbin](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fnode-casbin)                                        | [PHP-Casbin](https:\u002F\u002Fgithub.com\u002Fphp-casbin\u002Fphp-casbin)                                   |\n| production-ready                                                                       | production-ready                                                                    | production-ready                                                                            | production-ready                                                                         |\n\n| [![python](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fpython.png)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fpycasbin) | [![dotnet](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fdotnet.png)](https:\u002F\u002Fgithub.com\u002Fcasbin-net\u002FCasbin.NET) | [![c++](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Fcpp.png)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin-cpp) | [![rust](https:\u002F\u002Fcasbin.org\u002Fimg\u002Flangs\u002Frust.png)](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin-rs) |\n|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| [PyCasbin](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fpycasbin)                                           | [Casbin.NET](https:\u002F\u002Fgithub.com\u002Fcasbin-net\u002FCasbin.NET)                                         | [Casbin-CPP](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin-cpp)                                   | [Casbin-RS](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin-rs)                                      |\n| production-ready                                                                         | production-ready                                                                               | production-ready                                                                     | production-ready                                                                      |\n\n## Table of contents\n\n- [Supported models](#supported-models)\n- [How it works?](#how-it-works)\n- [Features](#features)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Online editor](#online-editor)\n- [Tutorials](#tutorials)\n- [Get started](#get-started)\n- [Policy management](#policy-management)\n- [Policy persistence](#policy-persistence)\n- [Policy consistence between multiple nodes](#policy-consistence-between-multiple-nodes)\n- [Role manager](#role-manager)\n- [Benchmarks](#benchmarks)\n- [Examples](#examples)\n- [Middlewares](#middlewares)\n- [Our adopters](#our-adopters)\n\n## Supported models\n\n1. [**ACL (Access Control List)**](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FAccess_control_list)\n2. **ACL with [superuser](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FSuperuser)**\n3. **ACL without users**: especially useful for systems that don't have authentication or user log-ins.\n3. **ACL without resources**: some scenarios may target for a type of resources instead of an individual resource by using permissions like ``write-article``, ``read-log``. It doesn't control the access to a specific article or log.\n4. **[RBAC (Role-Based Access Control)](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRole-based_access_control)**\n5. **RBAC with resource roles**: both users and resources can have roles (or groups) at the same time.\n6. **RBAC with domains\u002Ftenants**: users can have different role sets for different domains\u002Ftenants.\n7. **[ABAC (Attribute-Based Access Control)](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FAttribute-Based_Access_Control)**: syntax sugar like ``resource.Owner`` can be used to get the attribute for a resource.\n8. **[RESTful](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRepresentational_state_transfer)**: supports paths like ``\u002Fres\u002F*``, ``\u002Fres\u002F:id`` and HTTP methods like ``GET``, ``POST``, ``PUT``, ``DELETE``.\n9. **Deny-override**: both allow and deny authorizations are supported, deny overrides the allow.\n10. **Priority**: the policy rules can be prioritized like firewall rules.\n\n## How it works?\n\nIn Casbin, an access control model is abstracted into a CONF file based on the **PERM metamodel (Policy, Effect, Request, Matchers)**. So switching or upgrading the authorization mechanism for a project is just as simple as modifying a configuration. You can customize your own access control model by combining the available models. For example, you can get RBAC roles and ABAC attributes together inside one model and share one set of policy rules.\n\nThe most basic and simplest model in Casbin is ACL. ACL's model CONF is:\n\n```ini\n# Request definition\n[request_definition]\nr = sub, obj, act\n\n# Policy definition\n[policy_definition]\np = sub, obj, act\n\n# Policy effect\n[policy_effect]\ne = some(where (p.eft == allow))\n\n# Matchers\n[matchers]\nm = r.sub == p.sub && r.obj == p.obj && r.act == p.act\n\n```\n\nAn example policy for ACL model is like:\n\n```\np, alice, data1, read\np, bob, data2, write\n```\n\nIt means:\n\n- alice can read data1\n- bob can write data2\n\nWe also support multi-line mode by appending '\\\\'  in the end:\n\n```ini\n# Matchers\n[matchers]\nm = r.sub == p.sub && r.obj == p.obj \\\n  && r.act == p.act\n```\n\nFurther more, if you are using ABAC,  you can try operator `in` like following in Casbin **golang** edition (jCasbin and Node-Casbin are not supported yet):\n\n```ini\n# Matchers\n[matchers]\nm = r.obj == p.obj && r.act == p.act || r.obj in ('data2', 'data3')\n```\n\nBut you **SHOULD** make sure that the length of the array is **MORE** than **1**, otherwise there will cause it to panic.\n\nFor more operators, you may take a look at [govaluate](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fgovaluate)\n\n## Features\n\nWhat Casbin does:\n\n1. enforce the policy in the classic ``{subject, object, action}`` form or a customized form as you defined, both allow and deny authorizations are supported.\n2. handle the storage of the access control model and its policy.\n3. manage the role-user mappings and role-role mappings (aka role hierarchy in RBAC).\n4. support built-in superuser like ``root`` or ``administrator``. A superuser can do anything without explicit permissions.\n5. multiple built-in operators to support the rule matching. For example, ``keyMatch`` can map a resource key ``\u002Ffoo\u002Fbar`` to the pattern ``\u002Ffoo*``.\n\nWhat Casbin does NOT do:\n\n1. authentication (aka verify ``username`` and ``password`` when a user logs in)\n2. 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.\n\n## Installation\n\n```\ngo get github.com\u002Fcasbin\u002Fcasbin\u002Fv3\n```\n\n## Documentation\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Foverview\n\n## Online editor\n\nYou can also use the online editor (https:\u002F\u002Fcasbin.org\u002Feditor\u002F) to write your Casbin model and policy in your web browser. It provides functionality such as ``syntax highlighting`` and ``code completion``, just like an IDE for a programming language.\n\n## Tutorials\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Ftutorials\n\n## Get started\n\n1. New a Casbin enforcer with a model file and a policy file:\n\n    ```go\n    e, _ := casbin.NewEnforcer(\"path\u002Fto\u002Fmodel.conf\", \"path\u002Fto\u002Fpolicy.csv\")\n    ```\n\nNote: you can also initialize an enforcer with policy in DB instead of file, see [Policy-persistence](#policy-persistence) section for details.\n\n2. Add an enforcement hook into your code right before the access happens:\n\n    ```go\n    sub := \"alice\" \u002F\u002F the user that wants to access a resource.\n    obj := \"data1\" \u002F\u002F the resource that is going to be accessed.\n    act := \"read\" \u002F\u002F the operation that the user performs on the resource.\n\n    if res, _ := e.Enforce(sub, obj, act); res {\n        \u002F\u002F permit alice to read data1\n    } else {\n        \u002F\u002F deny the request, show an error\n    }\n    ```\n\n3. Besides the static policy file, Casbin also provides API for permission management at run-time. For example, You can get all the roles assigned to a user as below:\n\n    ```go\n    roles, _ := e.GetImplicitRolesForUser(sub)\n    ```\n\nSee [Policy management APIs](#policy-management) for more usage.\n\n## Policy management\n\nCasbin provides two sets of APIs to manage permissions:\n\n- [Management API](https:\u002F\u002Fcasbin.org\u002Fdocs\u002Fmanagement-api): the primitive API that provides full support for Casbin policy management.\n- [RBAC API](https:\u002F\u002Fcasbin.org\u002Fdocs\u002Frbac-api): a more friendly API for RBAC. This API is a subset of Management API. The RBAC users could use this API to simplify the code.\n\nWe also provide a [web-based UI](https:\u002F\u002Fcasbin.org\u002Fdocs\u002Fadmin-portal) for model management and policy management:\n\n![model editor](https:\u002F\u002Fhsluoyz.github.io\u002Fcasbin\u002Fui_model_editor.png)\n\n![policy editor](https:\u002F\u002Fhsluoyz.github.io\u002Fcasbin\u002Fui_policy_editor.png)\n\n## Policy persistence\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Fadapters\n\n## Policy consistence between multiple nodes\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Fwatchers\n\n## Role manager\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Frole-managers\n\n## Benchmarks\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Fbenchmark\n\n## Examples\n\n| Model                     | Model file                                                                                                                       | Policy file                                                                                                                      |\n|---------------------------|----------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| ACL                       | [basic_model.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_model.conf)                                       | [basic_policy.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_policy.csv)                                       |\n| ACL with superuser        | [basic_model_with_root.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_with_root_model.conf)                   | [basic_policy.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_policy.csv)                                       |\n| ACL without users         | [basic_model_without_users.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_without_users_model.conf)           | [basic_policy_without_users.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_without_users_policy.csv)           |\n| ACL without resources     | [basic_model_without_resources.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_without_resources_model.conf)   | [basic_policy_without_resources.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fbasic_without_resources_policy.csv)   |\n| RBAC                      | [rbac_model.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_model.conf)                                         | [rbac_policy.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_policy.csv)                                         |\n| RBAC with resource roles  | [rbac_model_with_resource_roles.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_with_resource_roles_model.conf) | [rbac_policy_with_resource_roles.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_with_resource_roles_policy.csv) |\n| RBAC with domains\u002Ftenants | [rbac_model_with_domains.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_with_domains_model.conf)               | [rbac_policy_with_domains.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_with_domains_policy.csv)               |\n| ABAC                      | [abac_model.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fabac_model.conf)                                         | N\u002FA                                                                                                                              |\n| RESTful                   | [keymatch_model.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fkeymatch_model.conf)                                 | [keymatch_policy.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fkeymatch_policy.csv)                                 |\n| Deny-override             | [rbac_model_with_deny.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_with_deny_model.conf)                     | [rbac_policy_with_deny.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Frbac_with_deny_policy.csv)                     |\n| Priority                  | [priority_model.conf](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fpriority_model.conf)                                 | [priority_policy.csv](https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fblob\u002Fmaster\u002Fexamples\u002Fpriority_policy.csv)                                 |\n\n## Middlewares\n\nAuthz middlewares for web frameworks: https:\u002F\u002Fcasbin.org\u002Fdocs\u002Fmiddlewares\n\n## Our adopters\n\nhttps:\u002F\u002Fcasbin.org\u002Fdocs\u002Fadopters\n\n## How to Contribute\n\nPlease read the [contributing guide](CONTRIBUTING.md).\n\n## Contributors\n\nThis project exists thanks to all the people who contribute.\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fgraphs\u002Fcontributors\">\u003Cimg src=\"https:\u002F\u002Fopencollective.com\u002Fcasbin\u002Fcontributors.svg?width=890&button=false\" \u002F>\u003C\u002Fa>\n\n## Star History\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=casbin\u002Fcasbin&type=Date)](https:\u002F\u002Fstar-history.com\u002F#casbin\u002Fcasbin&Date)\n\n## License\n\nThis project is licensed under the [Apache 2.0 license](LICENSE).\n\n## Contact\n\nIf you have any issues or feature requests, please contact us. PR is welcomed.\n- https:\u002F\u002Fgithub.com\u002Fcasbin\u002Fcasbin\u002Fissues\n- https:\u002F\u002Fdiscord.gg\u002FS5UjpzGZjN\n","Apache Casbin 是一个支持多种访问控制模型（如ACL、RBAC、ABAC）的授权库。其核心功能包括灵活的策略配置和高效的权限验证，允许开发者通过简单的配置文件定义复杂的访问控制逻辑。Casbin 使用 Go 语言编写，具备良好的性能和可扩展性，并且支持多种编程语言环境下的使用。它适用于需要实现细粒度权限管理的应用场景，例如企业级应用、云服务以及任何需要严格控制用户访问权限的服务中。",2,"2026-06-11 03:00:35","top_language"]