Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Oso | 3,187 | 11 | a month ago | 48 | April 03, 2023 | 112 | apache-2.0 | Rust | ||
Oso is a batteries-included framework for building authorization in your application. | ||||||||||
Tag Security | 1,798 | 5 days ago | 39 | other | HTML | |||||
🔐CNCF Security Technical Advisory Group -- secure access, policy control, privacy, auditing, explainability and more! | ||||||||||
Cerbos | 1,766 | 2 | 7 hours ago | 67 | July 18, 2023 | 54 | apache-2.0 | Go | ||
Cerbos is the open core, language-agnostic, scalable authorization solution that makes user permissions and authorization simple to implement and manage by writing context-aware access control policies for your application resources. | ||||||||||
Accesscontrol | 1,676 | 87 | 69 | 2 years ago | 10 | February 24, 2018 | 39 | mit | TypeScript | |
Role and Attribute based Access Control for Node.js | ||||||||||
Permify | 1,651 | 21 hours ago | 34 | July 27, 2023 | 54 | apache-2.0 | Go | |||
Permify is an open-source authorization service inspired by Google Zanzibar. | ||||||||||
Php Casbin | 1,143 | 27 | 27 | a month ago | 60 | August 31, 2023 | 4 | apache-2.0 | PHP | |
An authorization library that supports access control models like ACL, RBAC, ABAC in PHP . | ||||||||||
Caddy Security | 935 | 1 | 24 days ago | 41 | September 04, 2023 | 117 | apache-2.0 | Go | ||
🔐 Authentication, Authorization, and Accounting (AAA) App and Plugin for Caddy v2. 💎 Implements Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0 (Github, Google, Facebook, Okta, etc.), SAML Authentication. MFA/2FA with App Authenticators and Yubico. 💎 Authorization with JWT/PASETO tokens. 🔐 | ||||||||||
Freeipa | 848 | 3 days ago | 33 | gpl-3.0 | Python | |||||
Mirror of FreeIPA, an integrated security information management solution | ||||||||||
Topaz | 722 | 4 days ago | 10 | apache-2.0 | Go | |||||
Cloud-native authorization for modern applications and APIs | ||||||||||
Rbac Tool | 718 | 6 days ago | 37 | July 19, 2022 | 8 | apache-2.0 | Go | |||
Rapid7 | insightCloudSec | Kubernetes RBAC Power Toys - Visualize, Analyze, Generate & Query |
This project scaffold was built with a modified version of webpack-library-starter
Thanks to Karl Düüna (DeadAlready) and his awesome post on medium
yarn add @rbac/rbac
or npm install @rbac/rbac
RBAC is a curried function thats initially takes an object with configurations, then returns another function that takes an object with roles, finally returns an object that holds "can" property that is a function.
You can use it in many ways, below is one of them:
Property | Type | Params | Default | Description |
---|---|---|---|---|
logger | Function | role: String operation: String result: Boolean |
defaultLogger | Function that logs operations to console |
enableLogger | Boolean | true | Enable or disable logger |
RBAC expects an object with roles as property names.
Property | Type | Example | Description |
---|---|---|---|
can | Array | ['products:*'] |
Array of strings, list of operations that user can do, since 1.1.0 also support glob |
when | Function or Promise | (params , done ) => done (null , true ) |
Optional Promise that should resolve in Truthy or Falsy or Callback function that receives params and done as properties, should return done passing errors, and result |
inherits | Array | ['user'] |
Optional Array of strings, list of roles inherited by this role |
const roles = {
supervisor: {
can: [{ name: 'products:find', when: (params, done) => {
// done receives error as first argument and Truthy or Falsy value as second argument
done(error, false);
}}]
},
admin: {
can: [{name: 'products:*', when: new Promise((resolve) => {
resolve(true);
})}]
}
};
Param | Type | Example | Description |
---|---|---|---|
First | String | 'admin' |
Array of strings, list of operations that user can do |
Second | String, Glob (Wildcard), Regex | 'products:find' |
Operation to validate |
Third | Any | {registered: true} |
Optional Params that will flow to "when" callback Function |
Want more? Check out the examples folder.
yarn install
to get RBAC's dependenciesyarn build
to produce minified version of RBAC.yarn dev
. This command will generate a non-minified version of your library and will run a watcher so you get the compilation on file change.yarn test
yarn build
- produces production version of your library under the lib
folderyarn dev
- produces development version of your library and runs a watcheryarn test
- well ... it runs the tests :)yarn test:watch
- same as above but in a watch modeThis project is under MIT License [https://opensource.org/licenses/MIT]