abac-mongodb
An ABAC back-end datastore for authorizing requests against policies stored in a MongoDB collection.
Be mindful of the additional overhead of making a network call to MongoDB per request-response cycle.
Install
$ npm install abac-mongodb
Usage
Configure BackEnd and define policies
The MongoDB BackEnd requires a MongoDB connection. The action is used to find the policy document in the policies collection. A policy's rules can be defined as a boolean or a function.
var abac = mongoose = MongoDBBackEnd = BackEnd; abac;abac;
Authorize requests
Use abac.can(backend, action, options)
, specifying 'mongodb'
as the backend
. Ensure that the action
belongs to a policy defined to be stored in the MongoDB BackEnd.
Routes
var express = abac = ; app;
Control flow
var express = abac = ; app;
Tests
$ npm install
$ npm test
License
Copyright (c) 2014 Stevo <http://github.com/vovantics/>