forked from honeydipper/honeydipper-config-essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi_auth.yaml
55 lines (49 loc) · 2.4 KB
/
api_auth.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
drivers:
daemon:
services:
api:
auth-providers:
- auth-simple
auth:
casbin:
models:
- |
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
g2 = _, _
g3 = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = (r.sub == p.sub && r.obj == p.obj && r.act == p.act) \
|| (g(r.sub, p.sub) && g2(r.obj, p.obj) && r.act == p.act) \
|| (g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act) \
|| (r.sub == p.sub && g2(r.obj, p.obj) && r.act == p.act) \
|| (r.sub == p.sub && r.obj == p.obj && g3(r.act, p.act)) \
|| (g(r.sub, p.sub) && g2(r.obj, p.obj) && g3(r.act, p.act)) \
|| (g(r.sub, p.sub) && r.obj == p.obj && g3(r.act, p.act)) \
|| (r.sub == p.sub && g2(r.obj, p.obj) && g3(r.act, p.act)) \
|| (r.sub == p.sub && r.obj == p.obj && g3(r.act, 'read') && p.act == 'write') \
|| (g(r.sub, p.sub) && g2(r.obj, p.obj) && g3(r.act, 'read') && p.act == 'write') \
|| (g(r.sub, p.sub) && r.obj == p.obj && g3(r.act, 'read') && p.act == 'write') \
|| (r.sub == p.sub && g2(r.obj, p.obj) && g3(r.act, 'read') && p.act == 'write') \
|| (g(r.sub, p.sub) && p.obj == 'everything' && r.act == p.act) \
|| (r.sub == p.sub && p.obj == 'everything' && r.act == p.act) \
|| (g(r.sub, p.sub) && p.obj == 'everything' && g3(r.act, p.act)) \
|| (r.sub == p.sub && p.obj == 'everything' && g3(r.act, p.act)) \
|| (g(r.sub, p.sub) && p.obj == 'everything' && g3(r.act, 'read') && p.act == 'write') \
|| (r.sub == p.sub && p.obj == 'everything' && g3(r.act, 'read') && p.act == 'write') \
|| (r.sub == 'admin')
policies:
- |
# define action groups
g3, GET, read
g3, POST, write
g3, PUT, write
# define basic policy effects
p, viewer, everything, read
p, editor, everything, write