RBAC (Role-based access control) plugin for Fastify.
This plugin uses fast-rbac under the hood.
- v1.x.x - supports
>= fastify-1.0.0
npm i fastify-rbac --save
- Wildcard rules support
- Inheritance support
- Typescript support
- Requires fastify
>=1.0.0
. - Node.js
>=8.9.0
.
Add it to your project like regular fastify plugin. Use register
method and pass options to it.
const fastify = require('fastify');
const app = fastify();
const rbacPlugin = require('fastify-rbac');
app.register(rbacPlugin, { /* rbac options */ });
It exposes rbac
to fastify instance fastify.rbac
which you may use to check/add/remove roles and permissions.
See RBAC Options.
See plugin docs.
Also refer to RBAC docs.
See changelog.
Licensed under MIT.