Should be done with OPA https://www.openpolicyagent.org/docs/latest/ Policies should be defined externally of ScriptBee WebApp ---- [ Request with Bearer Token ] │ ▼ 1. JWT Validation (Signature, exp, aud) │ ▼ 2. IClaimsTransformation ├─ Read External ID (sub / oid) ├─ Memory Cache Hit? ──(Yes)──► Attach InternalUserId Claim └─ Cache Miss? ────────(No)───► Find/Create in Users DB ──► Cache ──► Attach Claim │ ▼ 3. Custom Authorization Handler └─ Check: Does InternalUserId have Permission X in Route's ProjectId? │ ▼ 4. Minimal API Endpoint Executes
Activity