fastify-rbac
v1.0.3
Published
RBAC plugin for Fastify
Downloads
665
Maintainers
Readme
fastify-rbac
RBAC (Role-based access control) plugin for Fastify.
This plugin uses fast-rbac under the hood.
ToC
Fastify support
- v1.x.x - supports
>= fastify-1.0.0
Installation
npm i fastify-rbac --save
Features and requirements
- Wildcard rules support
- Inheritance support
- Typescript support
- Requires fastify
>=1.0.0
. - Node.js
>=8.9.0
.
Usage
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.
Plugin options
See RBAC Options.
Docs
See plugin docs.
Also refer to RBAC docs.
Changelog
See changelog.
See also
License
Licensed under MIT.