simple-authz 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -28
- package/package.json +17 -2
- package/simple-authz-v1.0.1.tgz +0 -0
- package/simple-authz-v1.0.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
````markdown
|
|
3
1
|
# Simple Authz
|
|
4
2
|
|
|
5
3
|
A lightweight and flexible **authorization engine for Node.js** built around a simple policy language called **TOON (Token-Oriented Object Notation)**.
|
|
@@ -12,24 +10,24 @@ The goal of this project is to make authorization **simple, fast, readable, and
|
|
|
12
10
|
|
|
13
11
|
# Table of Contents
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
* Overview
|
|
14
|
+
* Why Simple Authz
|
|
15
|
+
* Key Features
|
|
16
|
+
* Installation
|
|
17
|
+
* Quick Start
|
|
18
|
+
* Core Concepts
|
|
19
|
+
* Policy Language (TOON)
|
|
20
|
+
* Policy Examples
|
|
21
|
+
* Using Conditions
|
|
22
|
+
* Working with Roles
|
|
23
|
+
* Authorization API
|
|
24
|
+
* Example Integrations
|
|
25
|
+
* Project Structure
|
|
26
|
+
* Performance
|
|
27
|
+
* Security Model
|
|
28
|
+
* Roadmap
|
|
29
|
+
* Contributing
|
|
30
|
+
* License
|
|
33
31
|
|
|
34
32
|
---
|
|
35
33
|
|
|
@@ -41,7 +39,7 @@ Most applications implement authorization like this:
|
|
|
41
39
|
if(user.role === "admin") { ... }
|
|
42
40
|
if(user.id === listing.owner_id) { ... }
|
|
43
41
|
if(user.permissions.includes("edit_listing")) { ... }
|
|
44
|
-
|
|
42
|
+
```
|
|
45
43
|
|
|
46
44
|
Over time this logic spreads across many files and becomes difficult to maintain.
|
|
47
45
|
|
|
@@ -57,7 +55,7 @@ allow user view listing
|
|
|
57
55
|
allow broker publish listing
|
|
58
56
|
|
|
59
57
|
allow broker edit listing
|
|
60
|
-
|
|
58
|
+
condition listing.owner_id == user.id
|
|
61
59
|
```
|
|
62
60
|
|
|
63
61
|
Your application then only needs to ask:
|
|
@@ -133,7 +131,7 @@ allow user view listing
|
|
|
133
131
|
allow broker publish listing
|
|
134
132
|
|
|
135
133
|
allow broker edit listing
|
|
136
|
-
|
|
134
|
+
condition listing.owner_id == user.id
|
|
137
135
|
```
|
|
138
136
|
|
|
139
137
|
---
|
|
@@ -228,14 +226,14 @@ Syntax:
|
|
|
228
226
|
|
|
229
227
|
```
|
|
230
228
|
allow <role> <action> <resource>
|
|
231
|
-
|
|
229
|
+
condition <condition>
|
|
232
230
|
```
|
|
233
231
|
|
|
234
232
|
Example:
|
|
235
233
|
|
|
236
234
|
```
|
|
237
235
|
allow broker edit listing
|
|
238
|
-
|
|
236
|
+
condition listing.owner_id == user.id
|
|
239
237
|
```
|
|
240
238
|
|
|
241
239
|
Meaning:
|
|
@@ -258,7 +256,7 @@ Example:
|
|
|
258
256
|
|
|
259
257
|
```
|
|
260
258
|
allow user edit profile
|
|
261
|
-
|
|
259
|
+
condition user.id == resource.id
|
|
262
260
|
```
|
|
263
261
|
|
|
264
262
|
---
|
|
@@ -281,7 +279,7 @@ allow broker publish listing
|
|
|
281
279
|
|
|
282
280
|
```
|
|
283
281
|
allow broker edit listing
|
|
284
|
-
|
|
282
|
+
condition listing.owner_id == user.id
|
|
285
283
|
```
|
|
286
284
|
|
|
287
285
|
---
|
|
@@ -296,7 +294,7 @@ allow user view listing
|
|
|
296
294
|
allow broker publish listing
|
|
297
295
|
|
|
298
296
|
allow broker edit listing
|
|
299
|
-
|
|
297
|
+
condition listing.owner_id == user.id
|
|
300
298
|
```
|
|
301
299
|
|
|
302
300
|
---
|
|
@@ -501,3 +499,4 @@ MIT License
|
|
|
501
499
|
Simple Authz was created to simplify authorization logic in modern Node.js applications.
|
|
502
500
|
|
|
503
501
|
|
|
502
|
+
# Keywords
|
package/package.json
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-authz",
|
|
3
|
-
"version": "v1.0.
|
|
3
|
+
"version": "v1.0.1",
|
|
4
4
|
"description": "Simple authorization engine with TOON policy language",
|
|
5
5
|
"main": "lib/core/authz.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "node bin/test.js",
|
|
8
8
|
"dev": "node lib/core/authz.js"
|
|
9
9
|
},
|
|
10
|
-
"keywords": [
|
|
10
|
+
"keywords": [
|
|
11
|
+
"authorization",
|
|
12
|
+
"access-control",
|
|
13
|
+
"auth",
|
|
14
|
+
"policy-engine",
|
|
15
|
+
"rbac",
|
|
16
|
+
"abac",
|
|
17
|
+
"permissions",
|
|
18
|
+
"nodejs-auth",
|
|
19
|
+
"authorization-library",
|
|
20
|
+
"security",
|
|
21
|
+
"policy-based-access",
|
|
22
|
+
"authz",
|
|
23
|
+
"role-based-access-control",
|
|
24
|
+
"authorization-engine"
|
|
25
|
+
],
|
|
11
26
|
"author": "Dhruvil",
|
|
12
27
|
"license": "MIT",
|
|
13
28
|
"repository": {
|
|
Binary file
|
package/simple-authz-v1.0.0.tgz
DELETED
|
Binary file
|