@spinajs/authz-http-admin
v3.0.28
Published
Admin routes over the SpinaJS authorization management API
Readme
@spinajs/authz-http-admin
Admin routes over the SpinaJS authorization management API (AuthzAdmin,
design §6.6.5).
Routes
| Route | Runs |
|---|---|
| POST /authz/commands { commands, reason?, idempotencyKey?, dryRun? } | execute |
| GET /authz/assignments?scope=&subject=&role=&includeExpired=&limit=&offset= | list({ kind: 'assignments' }) |
| POST /authz/assignments, PATCH/DELETE /authz/assignments/:id | assignment.* |
| GET/POST /authz/links, PATCH/DELETE /authz/links/:id | link.* |
| GET /authz/rules, PUT/DELETE /authz/rules/:id | rule.* |
| GET /authz/holders?scope=&permission=&expandSets=&limit=&offset= | list({ kind: 'holders' }) |
| GET /authz/policies, PUT/DELETE /authz/policies/:id | policy.* |
| GET/PATCH/PUT /authz/scopes/:type/:id/attributes | scope.* |
- The routes check only that the caller is authenticated (401 otherwise).
The caller's principal is the actor. The inputs are DTOs checked against
closed schemas first (400
invalid_request,invalid_queryorinvalid_batchwith thefield); every permission and guard check runs insideAuthzAdmin, so a well-formed HTTP call and an in-process call get the same answer. - Query encodings:
scopeis<type>or<type>:<id>;subjectis<type>:<id>orset:<role>@<type>:<id>. On the single-command routesreason,idempotencyKeyanddryRungo in the query string. - Writes answer
{ results }; a failed command sets the status (403 forforbidden,escalation,last_holder,self_lockout,protected_role; 404not_found; 409conflict; 400 otherwise). Lists answer{ items, total }. GET /authz/holderslists who holdspermissiononscope(both required;expandSets=truealso lists set members). It answers{ items, total }, or 400invalid_queryfor a missing or unknown value, 401, and 403forbidden(the caller needsauthz:holders.readat the resource). See Holders.- A link token is shown once: only in the answer of
POST /authz/linksor of thePOST /authz/commandsbatch that created it. Both routes sendCache-Control: no-store.
Configuration
authz.http.admin.domain(defaultroot): the authz domain whoseAuthzAdminthe routes use.- The package ships no
AdminGuard;AuthzAdminruns the one named inauthz.admin.guard.service(DefaultAdminGuardfrom@spinajs/authz-rbac).
Swagger
http-swagger documents the routes, their answers and the @Body() DTOs.
Pass the built document through describeAuthzAdminDocument(doc) to add the
batch body, the attribute bodies and the query parameters, which the routes
take through their own route arguments.
