Attribute-Based Access Control using subject properties (department, clearance level), resource properties (classification, department), and context (business hours).
| Action | Condition |
|---|---|
read |
Subject clearance >= resource classification |
write |
Subject clearance >= resource classification AND same department |
approve |
Subject has secret clearance AND within business hours (context) |
Clearance hierarchy: public < internal < confidential < secret
Running
Section titled “Running”./opa-authzen-plugin run --server \ --config-file example/abac/config.yaml \ example/abac/policy.regoExample Requests
Section titled “Example Requests”Read: clearance check
Section titled “Read: clearance check”# "confidential" clearance reading an "internal" doc — allowedcurl -s -X POST http://localhost:8181/access/v1/evaluation \ -H "Content-Type: application/json" \ -d '{ "subject": {"type": "user", "id": "alice", "properties": {"clearance": "confidential", "department": "engineering"}}, "resource": {"type": "document", "id": "doc-1", "properties": {"classification": "internal", "department": "engineering"}}, "action": {"name": "read"} }'# → {"decision":true}
# "internal" clearance reading a "secret" doc — deniedcurl -s -X POST http://localhost:8181/access/v1/evaluation \ -H "Content-Type: application/json" \ -d '{ "subject": {"type": "user", "id": "bob", "properties": {"clearance": "internal", "department": "engineering"}}, "resource": {"type": "document", "id": "doc-2", "properties": {"classification": "secret", "department": "engineering"}}, "action": {"name": "read"} }'# → {"decision":false}Write: clearance + department match
Section titled “Write: clearance + department match”# Same department, sufficient clearance — allowedcurl -s -X POST http://localhost:8181/access/v1/evaluation \ -H "Content-Type: application/json" \ -d '{ "subject": {"type": "user", "id": "alice", "properties": {"clearance": "confidential", "department": "engineering"}}, "resource": {"type": "document", "id": "doc-1", "properties": {"classification": "internal", "department": "engineering"}}, "action": {"name": "write"} }'# → {"decision":true}
# Different department — deniedcurl -s -X POST http://localhost:8181/access/v1/evaluation \ -H "Content-Type: application/json" \ -d '{ "subject": {"type": "user", "id": "alice", "properties": {"clearance": "confidential", "department": "engineering"}}, "resource": {"type": "document", "id": "doc-3", "properties": {"classification": "internal", "department": "finance"}}, "action": {"name": "write"} }'# → {"decision":false}Approve: top clearance + context
Section titled “Approve: top clearance + context”# Secret clearance during business hours — allowedcurl -s -X POST http://localhost:8181/access/v1/evaluation \ -H "Content-Type: application/json" \ -d '{ "subject": {"type": "user", "id": "carol", "properties": {"clearance": "secret", "department": "legal"}}, "resource": {"type": "document", "id": "doc-4", "properties": {"classification": "secret", "department": "legal"}}, "action": {"name": "approve"}, "context": {"business_hours": true} }'# → {"decision":true}
# Secret clearance but outside business hours — deniedcurl -s -X POST http://localhost:8181/access/v1/evaluation \ -H "Content-Type: application/json" \ -d '{ "subject": {"type": "user", "id": "carol", "properties": {"clearance": "secret", "department": "legal"}}, "resource": {"type": "document", "id": "doc-4", "properties": {"classification": "secret", "department": "legal"}}, "action": {"name": "approve"}, "context": {"business_hours": false} }'# → {"decision":false}© 2026 The opa-authzen-plugin Authors. Licensed under Apache-2.0. Part of dyokto.