0.22.0 • Published 6 months ago
@cerbos/http v0.22.0
@cerbos/http
Client library for interacting with the Cerbos policy decision point service over HTTP.
This is primarily intended for use in browsers, and requires fetch to be available globally.
If you're targeting old browsers, you'll need to apply a polyfill.
You can use it in server-side Node.js applications, but the gRPC client might be more appropriate.
Prerequisites
- Cerbos 0.16+
- Node.js 20+
fetch
Installation
$ npm install @cerbos/httpExample usage
import { HTTP } from "@cerbos/http";
const cerbos = new HTTP("http://localhost:3592");
await cerbos.isAllowed({
principal: {
id: "user@example.com",
roles: ["USER"],
attr: { tier: "PREMIUM" },
},
resource: {
kind: "document",
id: "1",
attr: { owner: "user@example.com" },
},
action: "view",
}); // => trueFor more details, see the HTTP class documentation.
Further reading
Get help
0.21.0
10 months ago
0.20.0
12 months ago
0.21.2
9 months ago
0.22.0
6 months ago
0.21.1
9 months ago
0.19.1
1 year ago
0.19.2
1 year ago
0.19.0
2 years ago
0.18.1
2 years ago
0.18.0
2 years ago
0.17.0
2 years ago
0.16.0
2 years ago
0.13.0
2 years ago
0.14.0
2 years ago
0.15.0
2 years ago
0.12.0
2 years ago
0.11.0
3 years ago
0.10.0
3 years ago
0.10.1
3 years ago
0.9.0
3 years ago
0.8.1
3 years ago
0.8.0
3 years ago
0.7.1
3 years ago
0.7.0
3 years ago
0.6.0
3 years ago
0.5.1
3 years ago
0.5.0
3 years ago