-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostman_collection.json
More file actions
593 lines (593 loc) · 24.4 KB
/
postman_collection.json
File metadata and controls
593 lines (593 loc) · 24.4 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
{
"info": {
"name": "Authorization API 1.0",
"description": "OpenID AuthZEN Authorization API 1.0 Implementation\n\nSpecification: https://openid.net/specs/authorization-api-1_0.html\n\n## Sample Data\n\n**Users:** alice, bob, carol, guest\n\n**Documents:** doc-public, doc-internal, doc-confidential\n\n## Policies\n\n1. Owners can always access their documents\n2. Public documents are accessible to everyone\n3. Internal documents require 'employee' role\n4. Confidential documents require same department or 'hr-admin' role",
"version": "1.0.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:8080",
"type": "string"
}
],
"item": [
{
"name": "Health & Utility",
"description": "Health check and utility endpoints",
"item": [
{
"name": "Health Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/health",
"host": ["{{baseUrl}}"],
"path": ["health"]
},
"description": "Check if the service is running."
},
"response": [
{
"name": "Healthy",
"status": "OK",
"code": 200,
"body": "{\n \"status\": \"healthy\"\n}"
}
]
},
{
"name": "Reset Database",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{baseUrl}}/reset-database",
"host": ["{{baseUrl}}"],
"path": ["reset-database"]
},
"description": "Reset the database to its initial state with seed data."
},
"response": [
{
"name": "Database Reset",
"status": "OK",
"code": 200,
"body": "{\n \"status\": \"database reset\"\n}"
}
]
}
]
},
{
"name": "Single Evaluation",
"description": "POST /access/v1/evaluation\n\nCheck if a subject can perform an action on a resource.",
"item": [
{
"name": "Alice views doc-public (PERMIT - Owner)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"alice\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-public\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Alice is the owner of doc-public, so access is granted."
},
"response": [
{
"name": "PERMIT - Owner",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": true,\n \"context\": {\n \"reason\": \"Subject is the resource owner\"\n }\n}"
}
]
},
{
"name": "Guest views doc-public (PERMIT - Public)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"guest\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-public\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Anyone can view public documents."
},
"response": [
{
"name": "PERMIT - Public",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": true,\n \"context\": {\n \"reason\": \"Resource is public\"\n }\n}"
}
]
},
{
"name": "Alice views doc-internal (PERMIT - Employee)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"alice\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-internal\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Alice has the 'employee' role, so she can view internal documents."
},
"response": [
{
"name": "PERMIT - Employee",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": true,\n \"context\": {\n \"reason\": \"Subject has 'employee' role for internal resource\"\n }\n}"
}
]
},
{
"name": "Guest views doc-internal (DENY - No Employee Role)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"guest\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-internal\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Guest doesn't have the 'employee' role, so access is denied."
},
"response": [
{
"name": "DENY - No Employee Role",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": false,\n \"context\": {\n \"reason\": \"Internal resources require 'employee' role\"\n }\n}"
}
]
},
{
"name": "Carol views doc-confidential (PERMIT - Owner)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"carol\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-confidential\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Carol is the owner of doc-confidential."
},
"response": [
{
"name": "PERMIT - Owner",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": true,\n \"context\": {\n \"reason\": \"Subject is the resource owner\"\n }\n}"
}
]
},
{
"name": "Alice views doc-confidential (DENY - Wrong Department)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"alice\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-confidential\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Alice is in engineering, but doc-confidential belongs to HR."
},
"response": [
{
"name": "DENY - Wrong Department",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": false,\n \"context\": {\n \"reason\": \"Confidential resources require same department or 'hr-admin' role\"\n }\n}"
}
]
},
{
"name": "Bob views doc-confidential (DENY - Wrong Department)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"bob\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-confidential\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Bob is a manager in engineering, but that doesn't give access to HR confidential docs."
},
"response": [
{
"name": "DENY - Wrong Department",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": false,\n \"context\": {\n \"reason\": \"Confidential resources require same department or 'hr-admin' role\"\n }\n}"
}
]
},
{
"name": "Unknown user (DENY - Not Found)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"unknown-user\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-public\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "User doesn't exist in the database."
},
"response": [
{
"name": "DENY - Not Found",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": false,\n \"context\": {\n \"reason\": \"Subject not found\"\n }\n}"
}
]
},
{
"name": "Unknown document (DENY - Not Found)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"alice\"\n },\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"unknown-doc\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Document doesn't exist in the database."
},
"response": [
{
"name": "DENY - Not Found",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": false,\n \"context\": {\n \"reason\": \"Resource not found\"\n }\n}"
}
]
},
{
"name": "Unsupported action (DENY - Not Supported)",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"subject\": {\n \"type\": \"user\",\n \"id\": \"alice\"\n },\n \"action\": {\n \"name\": \"delete\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-public\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluation",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluation"]
},
"description": "Only 'view' action is supported in this example."
},
"response": [
{
"name": "DENY - Not Supported",
"status": "OK",
"code": 200,
"body": "{\n \"decision\": false,\n \"context\": {\n \"reason\": \"Action 'delete' is not supported\"\n }\n}"
}
]
}
]
},
{
"name": "Batch Evaluation",
"description": "POST /access/v1/evaluations\n\nCheck multiple authorization requests in one API call.",
"item": [
{
"name": "Alice - All Documents",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"evaluations\": [\n {\n \"subject\": {\"type\": \"user\", \"id\": \"alice\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-public\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"alice\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-internal\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"alice\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-confidential\"}\n }\n ]\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluations",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluations"]
},
"description": "Check Alice's access to all three documents at once.\n\nExpected:\n- doc-public: PERMIT (owner)\n- doc-internal: PERMIT (employee)\n- doc-confidential: DENY (wrong department)"
},
"response": [
{
"name": "Alice - All Documents",
"status": "OK",
"code": 200,
"body": "{\n \"evaluations\": [\n {\n \"decision\": true,\n \"context\": {\"reason\": \"Subject is the resource owner\"}\n },\n {\n \"decision\": true,\n \"context\": {\"reason\": \"Subject has 'employee' role for internal resource\"}\n },\n {\n \"decision\": false,\n \"context\": {\"reason\": \"Confidential resources require same department or 'hr-admin' role\"}\n }\n ]\n}"
}
]
},
{
"name": "Guest - All Documents",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"evaluations\": [\n {\n \"subject\": {\"type\": \"user\", \"id\": \"guest\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-public\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"guest\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-internal\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"guest\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-confidential\"}\n }\n ]\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluations",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluations"]
},
"description": "Check Guest's access to all three documents.\n\nExpected:\n- doc-public: PERMIT (public)\n- doc-internal: DENY (no employee role)\n- doc-confidential: DENY (no employee role)"
},
"response": [
{
"name": "Guest - All Documents",
"status": "OK",
"code": 200,
"body": "{\n \"evaluations\": [\n {\n \"decision\": true,\n \"context\": {\"reason\": \"Resource is public\"}\n },\n {\n \"decision\": false,\n \"context\": {\"reason\": \"Internal resources require 'employee' role\"}\n },\n {\n \"decision\": false,\n \"context\": {\"reason\": \"Internal resources require 'employee' role\"}\n }\n ]\n}"
}
]
},
{
"name": "All Users - doc-internal",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"evaluations\": [\n {\n \"subject\": {\"type\": \"user\", \"id\": \"alice\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-internal\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"bob\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-internal\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"carol\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-internal\"}\n },\n {\n \"subject\": {\"type\": \"user\", \"id\": \"guest\"},\n \"action\": {\"name\": \"view\"},\n \"resource\": {\"type\": \"document\", \"id\": \"doc-internal\"}\n }\n ]\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/evaluations",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "evaluations"]
},
"description": "Check all users' access to doc-internal.\n\nExpected:\n- alice: PERMIT (employee)\n- bob: PERMIT (owner)\n- carol: PERMIT (employee)\n- guest: DENY (no employee role)"
},
"response": [
{
"name": "All Users - doc-internal",
"status": "OK",
"code": 200,
"body": "{\n \"evaluations\": [\n {\n \"decision\": true,\n \"context\": {\"reason\": \"Subject has 'employee' role for internal resource\"}\n },\n {\n \"decision\": true,\n \"context\": {\"reason\": \"Subject is the resource owner\"}\n },\n {\n \"decision\": true,\n \"context\": {\"reason\": \"Subject has 'employee' role for internal resource\"}\n },\n {\n \"decision\": false,\n \"context\": {\"reason\": \"Internal resources require 'employee' role\"}\n }\n ]\n}"
}
]
}
]
},
{
"name": "Search",
"description": "POST /access/v1/search\n\nFind all subjects that can perform an action on a resource.",
"item": [
{
"name": "Who can view doc-public?",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-public\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/search",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "search"]
},
"description": "Find all users who can view doc-public.\n\nExpected: All users (alice, bob, carol, guest) because it's public."
},
"response": [
{
"name": "All Users",
"status": "OK",
"code": 200,
"body": "{\n \"subjects\": [\n {\"type\": \"user\", \"id\": \"alice\"},\n {\"type\": \"user\", \"id\": \"bob\"},\n {\"type\": \"user\", \"id\": \"carol\"},\n {\"type\": \"user\", \"id\": \"guest\"}\n ]\n}"
}
]
},
{
"name": "Who can view doc-internal?",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-internal\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/search",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "search"]
},
"description": "Find all users who can view doc-internal.\n\nExpected: alice, bob, carol (employees only, not guest)."
},
"response": [
{
"name": "Employees Only",
"status": "OK",
"code": 200,
"body": "{\n \"subjects\": [\n {\"type\": \"user\", \"id\": \"alice\"},\n {\"type\": \"user\", \"id\": \"bob\"},\n {\"type\": \"user\", \"id\": \"carol\"}\n ]\n}"
}
]
},
{
"name": "Who can view doc-confidential?",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"doc-confidential\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/search",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "search"]
},
"description": "Find all users who can view doc-confidential.\n\nExpected: Only carol (owner and HR department)."
},
"response": [
{
"name": "Carol Only",
"status": "OK",
"code": 200,
"body": "{\n \"subjects\": [\n {\"type\": \"user\", \"id\": \"carol\"}\n ]\n}"
}
]
},
{
"name": "Who can view unknown-doc?",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"action\": {\n \"name\": \"view\"\n },\n \"resource\": {\n \"type\": \"document\",\n \"id\": \"unknown-doc\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/access/v1/search",
"host": ["{{baseUrl}}"],
"path": ["access", "v1", "search"]
},
"description": "Search for a document that doesn't exist.\n\nExpected: Empty list (no one has access to non-existent resource)."
},
"response": [
{
"name": "Empty List",
"status": "OK",
"code": 200,
"body": "{\n \"subjects\": []\n}"
}
]
}
]
}
]
}