--action, --resource, and --tenant so you can hand out least-privilege credentials that mirror the way you partition domains and services.
Tokens gate every control-socket call. They carry three main claims:
- Actions – verbs such as
aggregate.readorschema.write. - Resources – what the action can touch; defaults to
"*"unless you scope it. - Tenants – which tenants the token may access (required by
dbx token generate; repeat--tenantfor more).
*matches any length;?matches a single character.*.*(actions) and*(resources) are root-level patterns—use sparingly.
Common actions
- Aggregates (only):
aggregate.read,aggregate.create,aggregate.append,aggregate.archiveaggregate.read– list aggregates, get one, list events, list/get snapshots, select fields.aggregate.append– apply/patch events and create snapshots.aggregate.archive– archive or restore an aggregate.aggregate.create– create a new aggregate.
schema.read,schema.writetenant.manage*.*(root; equivalent to “all actions”)
schema.read,schema.write, andtenant.manageonly check the action;--resourceis ignored for these. Passing none is fine.
Resource patterns
aggregate:<type>:<id>– single aggregate (aggregate:orders:123)aggregate:<type>:*– any id of that type (aggregate:orders:*)aggregate:*:*– any aggregate*– any resource (CLI default)
schema.read), you can omit --resource; the CLI will set it to "*".
Examples
Admin (root) token for one tenant
Read-only access to one aggregate type
Writer for a service (create + append)
Narrow access to a single aggregate
Schema admin
- Prefer short TTLs and
--write-limitfor automation. - Repeat
--tenantto authorize multiple tenants; calls fail if the tenant is not present in the token. - Use
dbx token refreshto rotate without re-provisioning clients.
How this maps to other systems
- Think of
actionas an IAM “permission” (for example,aggregate.append≈ “write events”), andresourceas an IAM resource ARN-like filter (aggregate:orders:*≈ “all orders aggregates”). - Wildcards behave like glob patterns, not regex; keep them narrow to avoid overreach in audits.
- Plugins and SDKs only need bearer tokens—no cookies or sessions—so you can mint short-lived, task-specific credentials the same way you would scoped API tokens in other platforms.
- If you federate identity elsewhere (OAuth2/JWT providers), you can mint EventDBX tokens from a service role and pass tenant/action/resource scopes that mirror the upstream role’s permissions.