Authorization
Permissions belong to the team, not the person: a person has exactly the permissions of their team. Every action has its own key, the token carries the keys and the service checks them at the endpoint. Service-to-service calls use their own token with the narrowest scope.
Decisions and why
- Team permissions
- Moving someone to another team swaps their whole access in one step. No forgotten permission left hanging on a person.
- One action, one key
- CONVEYOR_BELT_CONTRACT_ADVANCE, not CONVEYOR_ADMIN. A role gets exactly what it needs.
- Keys are a shared enum
- libs/iam holds the catalog: the compiler catches a mistyped key in any service.
- Check in the service that owns the data
- @RequiresPermission on the endpoint and the organization filter in the query: another organization's id is a 404, without revealing it exists.
- Scoped service tokens
- notifications can only read recipients from auth (AUTH_DIRECTORY_READ). If it leaks, the damage is small.
requestresponse
Pick a scenario above to watch the message travel through the architecture.