@spinajs/authz-http-admin 0.0.0-stage → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +52 -2
  2. package/lib/cjs/config/authz-http-admin.d.ts +9 -0
  3. package/lib/cjs/config/authz-http-admin.d.ts.map +1 -0
  4. package/lib/cjs/config/authz-http-admin.js +16 -0
  5. package/lib/cjs/config/authz-http-admin.js.map +1 -0
  6. package/lib/cjs/controllers/AuthzAdminController.d.ts +249 -0
  7. package/lib/cjs/controllers/AuthzAdminController.d.ts.map +1 -0
  8. package/lib/cjs/controllers/AuthzAdminController.js +549 -0
  9. package/lib/cjs/controllers/AuthzAdminController.js.map +1 -0
  10. package/lib/cjs/index.d.ts +4 -0
  11. package/lib/cjs/index.d.ts.map +1 -0
  12. package/lib/cjs/index.js +20 -0
  13. package/lib/cjs/index.js.map +1 -0
  14. package/lib/cjs/package.json +1 -0
  15. package/lib/cjs/routes/decode.d.ts +11 -0
  16. package/lib/cjs/routes/decode.d.ts.map +1 -0
  17. package/lib/cjs/routes/decode.js +53 -0
  18. package/lib/cjs/routes/decode.js.map +1 -0
  19. package/lib/cjs/routes/index.d.ts +4 -0
  20. package/lib/cjs/routes/index.d.ts.map +1 -0
  21. package/lib/cjs/routes/index.js +20 -0
  22. package/lib/cjs/routes/index.js.map +1 -0
  23. package/lib/cjs/routes/query.d.ts +16 -0
  24. package/lib/cjs/routes/query.d.ts.map +1 -0
  25. package/lib/cjs/routes/query.js +128 -0
  26. package/lib/cjs/routes/query.js.map +1 -0
  27. package/lib/cjs/routes/status.d.ts +6 -0
  28. package/lib/cjs/routes/status.d.ts.map +1 -0
  29. package/lib/cjs/routes/status.js +21 -0
  30. package/lib/cjs/routes/status.js.map +1 -0
  31. package/lib/cjs/schemas/bodies.d.ts +16 -0
  32. package/lib/cjs/schemas/bodies.d.ts.map +1 -0
  33. package/lib/cjs/schemas/bodies.js +39 -0
  34. package/lib/cjs/schemas/bodies.js.map +1 -0
  35. package/lib/cjs/schemas/commands.d.ts +9 -0
  36. package/lib/cjs/schemas/commands.d.ts.map +1 -0
  37. package/lib/cjs/schemas/commands.js +64 -0
  38. package/lib/cjs/schemas/commands.js.map +1 -0
  39. package/lib/cjs/schemas/document.d.ts +19 -0
  40. package/lib/cjs/schemas/document.d.ts.map +1 -0
  41. package/lib/cjs/schemas/document.js +76 -0
  42. package/lib/cjs/schemas/document.js.map +1 -0
  43. package/lib/cjs/schemas/index.d.ts +6 -0
  44. package/lib/cjs/schemas/index.d.ts.map +1 -0
  45. package/lib/cjs/schemas/index.js +21 -0
  46. package/lib/cjs/schemas/index.js.map +1 -0
  47. package/lib/cjs/schemas/primitives.d.ts +13 -0
  48. package/lib/cjs/schemas/primitives.d.ts.map +1 -0
  49. package/lib/cjs/schemas/primitives.js +29 -0
  50. package/lib/cjs/schemas/primitives.js.map +1 -0
  51. package/lib/cjs/schemas/provider.d.ts +13 -0
  52. package/lib/cjs/schemas/provider.d.ts.map +1 -0
  53. package/lib/cjs/schemas/provider.js +62 -0
  54. package/lib/cjs/schemas/provider.js.map +1 -0
  55. package/lib/mjs/config/authz-http-admin.d.ts +9 -0
  56. package/lib/mjs/config/authz-http-admin.d.ts.map +1 -0
  57. package/lib/mjs/config/authz-http-admin.js +14 -0
  58. package/lib/mjs/config/authz-http-admin.js.map +1 -0
  59. package/lib/mjs/controllers/AuthzAdminController.d.ts +249 -0
  60. package/lib/mjs/controllers/AuthzAdminController.d.ts.map +1 -0
  61. package/lib/mjs/controllers/AuthzAdminController.js +546 -0
  62. package/lib/mjs/controllers/AuthzAdminController.js.map +1 -0
  63. package/lib/mjs/index.d.ts +4 -0
  64. package/lib/mjs/index.d.ts.map +1 -0
  65. package/lib/mjs/index.js +4 -0
  66. package/lib/mjs/index.js.map +1 -0
  67. package/lib/mjs/package.json +1 -0
  68. package/lib/mjs/routes/decode.d.ts +11 -0
  69. package/lib/mjs/routes/decode.d.ts.map +1 -0
  70. package/lib/mjs/routes/decode.js +48 -0
  71. package/lib/mjs/routes/decode.js.map +1 -0
  72. package/lib/mjs/routes/index.d.ts +4 -0
  73. package/lib/mjs/routes/index.d.ts.map +1 -0
  74. package/lib/mjs/routes/index.js +4 -0
  75. package/lib/mjs/routes/index.js.map +1 -0
  76. package/lib/mjs/routes/query.d.ts +16 -0
  77. package/lib/mjs/routes/query.d.ts.map +1 -0
  78. package/lib/mjs/routes/query.js +120 -0
  79. package/lib/mjs/routes/query.js.map +1 -0
  80. package/lib/mjs/routes/status.d.ts +6 -0
  81. package/lib/mjs/routes/status.d.ts.map +1 -0
  82. package/lib/mjs/routes/status.js +17 -0
  83. package/lib/mjs/routes/status.js.map +1 -0
  84. package/lib/mjs/schemas/bodies.d.ts +16 -0
  85. package/lib/mjs/schemas/bodies.d.ts.map +1 -0
  86. package/lib/mjs/schemas/bodies.js +36 -0
  87. package/lib/mjs/schemas/bodies.js.map +1 -0
  88. package/lib/mjs/schemas/commands.d.ts +9 -0
  89. package/lib/mjs/schemas/commands.d.ts.map +1 -0
  90. package/lib/mjs/schemas/commands.js +61 -0
  91. package/lib/mjs/schemas/commands.js.map +1 -0
  92. package/lib/mjs/schemas/document.d.ts +19 -0
  93. package/lib/mjs/schemas/document.d.ts.map +1 -0
  94. package/lib/mjs/schemas/document.js +72 -0
  95. package/lib/mjs/schemas/document.js.map +1 -0
  96. package/lib/mjs/schemas/index.d.ts +6 -0
  97. package/lib/mjs/schemas/index.d.ts.map +1 -0
  98. package/lib/mjs/schemas/index.js +5 -0
  99. package/lib/mjs/schemas/index.js.map +1 -0
  100. package/lib/mjs/schemas/primitives.d.ts +13 -0
  101. package/lib/mjs/schemas/primitives.d.ts.map +1 -0
  102. package/lib/mjs/schemas/primitives.js +24 -0
  103. package/lib/mjs/schemas/primitives.js.map +1 -0
  104. package/lib/mjs/schemas/provider.d.ts +13 -0
  105. package/lib/mjs/schemas/provider.d.ts.map +1 -0
  106. package/lib/mjs/schemas/provider.js +26 -0
  107. package/lib/mjs/schemas/provider.js.map +1 -0
  108. package/lib/tsconfig.cjs.tsbuildinfo +1 -0
  109. package/lib/tsconfig.mjs.tsbuildinfo +1 -0
  110. package/package.json +67 -4
@@ -0,0 +1,549 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AuthzAdminController = void 0;
16
+ const authz_1 = require("@spinajs/authz");
17
+ const configuration_1 = require("@spinajs/configuration");
18
+ const di_1 = require("@spinajs/di");
19
+ const http_1 = require("@spinajs/http");
20
+ const authz_http_1 = require("@spinajs/authz-http");
21
+ const util_1 = require("@spinajs/util");
22
+ require("../schemas/provider.js");
23
+ const decode_js_1 = require("../routes/decode.js");
24
+ const query_js_1 = require("../routes/query.js");
25
+ const status_js_1 = require("../routes/status.js");
26
+ const PATCH_KEYS = ['tags', 'addTags', 'removeTags', 'expiresAt'];
27
+ const PATCH_KINDS = { tags: 'assignment.setTags', addTags: 'assignment.addTags', removeTags: 'assignment.removeTags' };
28
+ function respond(status, body) {
29
+ switch (status) {
30
+ case 200:
31
+ return new http_1.Ok(body);
32
+ case 403:
33
+ return new http_1.ForbiddenResponse(body);
34
+ case 404:
35
+ return new http_1.NotFound(body);
36
+ case 409:
37
+ return new http_1.Conflict(body);
38
+ default:
39
+ return new http_1.BadRequestResponse(body);
40
+ }
41
+ }
42
+ function refused(e) {
43
+ return respond((0, status_js_1.adminErrorStatus)(e.code), { error: { code: e.code, message: e.message, ...(e.field === undefined ? {} : { field: e.field }) } });
44
+ }
45
+ function badRequest(message, field) {
46
+ throw new authz_1.AuthzAdminFailure('invalid_request', message, field);
47
+ }
48
+ function objectBody(body, what) {
49
+ if (!(0, util_1.isPlainObject)(body))
50
+ badRequest(`the body must be ${what}`);
51
+ return body;
52
+ }
53
+ /** The body of PUT /authz/rules/:id or /authz/policies/:id with the path id; an id in the body must equal it. */
54
+ function withPathId(body, id, what) {
55
+ const o = objectBody(body, what);
56
+ if (o.id !== undefined && o.id !== id)
57
+ badRequest(`the body id ${JSON.stringify(o.id)} is not the path id ${JSON.stringify(id)}`, 'id');
58
+ return { ...o, id };
59
+ }
60
+ const LINK_PATCH_KEYS = ['expiresAt', 'attributes', 'role', 'tags'];
61
+ /** PATCH /authz/links/:id as one link.update; like the assignment patch, a key it does not serve is refused, not ignored. */
62
+ function linkUpdate(body, id) {
63
+ const patch = withPathId(body, id, 'an object { expiresAt?, attributes?, role?, tags? }');
64
+ const unknown = Object.keys(patch).find((k) => k !== 'id' && !LINK_PATCH_KEYS.includes(k));
65
+ if (unknown !== undefined)
66
+ badRequest(`a link patch takes ${LINK_PATCH_KEYS.join(', ')}, not ${JSON.stringify(unknown)}`, unknown);
67
+ if (!LINK_PATCH_KEYS.some((k) => k in patch))
68
+ badRequest(`a link patch needs one of ${LINK_PATCH_KEYS.join(', ')}`);
69
+ return (0, decode_js_1.decodeCommand)({ ...patch, kind: 'link.update' });
70
+ }
71
+ /** For answers that may hold a link token: no proxy or browser cache may keep one. Set first, so it goes out with any answer the route gives. */
72
+ function noStore(req) {
73
+ req.res?.setHeader('Cache-Control', 'no-store');
74
+ req.res?.setHeader('Pragma', 'no-cache');
75
+ }
76
+ const query = (req) => (req.query ?? {});
77
+ const param = (req, name) => req.params[name];
78
+ const actorOf = (req) => req.storage.Principal;
79
+ const scopeOf = (req) => ({ type: param(req, 'type'), id: param(req, 'id') });
80
+ /**
81
+ * Admin routes over the management API of the configured domain (`authz.http.admin.domain`).
82
+ *
83
+ * The routes check authentication only: the actor is always the request principal, and every
84
+ * permission, validation and guard check runs in AuthzAdmin, as for an in-process caller (design
85
+ * §6.6.5). A refused request answers `{ error: { code, message, field? } }`; a write answers
86
+ * `{ results }`, one entry per command.
87
+ *
88
+ * @tags Authz admin
89
+ */
90
+ let AuthzAdminController = class AuthzAdminController extends http_1.BaseController {
91
+ /** Runs a route on the domain's AuthzAdmin; an AuthzAdminFailure becomes its status with `{ error }`, anything else propagates. */
92
+ async guarded(fn) {
93
+ const admin = (await this.Domains.service(this.AdminDomain)).admin();
94
+ try {
95
+ return await fn(admin);
96
+ }
97
+ catch (e) {
98
+ if (e instanceof authz_1.AuthzAdminFailure)
99
+ return refused(e);
100
+ throw e;
101
+ }
102
+ }
103
+ /** One batch built from the route, with the options of the query string. */
104
+ single(req, build) {
105
+ return this.guarded(async (admin) => {
106
+ const opts = (0, query_js_1.readWriteOptions)(query(req));
107
+ return results(await admin.execute(actorOf(req), build(), opts));
108
+ });
109
+ }
110
+ list(req, build) {
111
+ return this.guarded(async (admin) => respond(200, await admin.list(actorOf(req), build())));
112
+ }
113
+ /**
114
+ * Run a batch of commands
115
+ * Runs the commands in order in one transaction on the configured domain; the first failure rolls the batch back and its status is the answer.
116
+ * Body: { commands, reason?, idempotencyKey?, dryRun? } (schema AuthzAdminBatch); `commands` lists the command kinds of AuthzCommand, with dates as ISO 8601 strings. The options go in the body, not the query string.
117
+ * The result of a link.create carries the link token, shown once: every answer the route sends carries `Cache-Control: no-store` (the 401 of the authentication check comes before the route and holds no token), and a retried or dry-run batch answers without the token.
118
+ * @response 200 {AuthzAdminResults} Every command succeeded
119
+ * @response 400 {AuthzAdminError} invalid_request, invalid_batch or a validation code of the command
120
+ * @response 401 Unauthorized: a valid session or token is required
121
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
122
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
123
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
124
+ */
125
+ async commands(req) {
126
+ noStore(req);
127
+ return this.guarded(async (admin) => {
128
+ const body = objectBody(req.body, 'an object { commands, reason?, idempotencyKey?, dryRun? }');
129
+ const opts = {};
130
+ for (const key of ['reason', 'idempotencyKey', 'dryRun'])
131
+ if (key in body)
132
+ opts[key] = body[key];
133
+ return results(await admin.execute(actorOf(req), (0, decode_js_1.decodeCommands)(body.commands), opts));
134
+ });
135
+ }
136
+ /**
137
+ * List assignments
138
+ * Lists assignments, filtered by the query.
139
+ * Query: `scope` (`<type>` or `<type>:<id>`), `subject` (`<type>:<id>` or `set:<role>@<type>:<id>`), `role`, `includeExpired` (`true` or `false`), `limit`, `offset`.
140
+ * @response 200 {AuthzAdminPage} One page of rows
141
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
142
+ * @response 401 Unauthorized: a valid session or token is required
143
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
144
+ */
145
+ async listAssignments(req) {
146
+ return this.list(req, () => (0, query_js_1.readAssignmentsQuery)(query(req)));
147
+ }
148
+ /**
149
+ * List holders
150
+ * Who holds a permission on a resource through role assignments on it, its ancestors or $global; each principal is verified by a fresh check.
151
+ * Query: `scope` (`<type>:<id>`), `permission`, `expandSets` (`true` or `false`), `limit`, `offset`.
152
+ * @response 200 {AuthzAdminPage} One page of holders
153
+ * @response 400 {AuthzAdminError} invalid_query: a malformed or missing query parameter
154
+ * @response 401 Unauthorized: a valid session or token is required
155
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks authz:holders.read at the resource, or the resource is unknown
156
+ */
157
+ async listHolders(req) {
158
+ return this.list(req, () => (0, query_js_1.readHoldersQuery)(query(req)));
159
+ }
160
+ /**
161
+ * Grant a role
162
+ * Grants a role to a subject at a scope (assignment.grant).
163
+ * Body: the fields of assignment.grant without `kind` (schema AuthzAssignmentGrant).
164
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
165
+ * @response 200 {AuthzAdminResults} Every command succeeded
166
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
167
+ * @response 401 Unauthorized: a valid session or token is required
168
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
169
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
170
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
171
+ */
172
+ async grant(req) {
173
+ return this.single(req, () => [(0, decode_js_1.decodeCommand)({ ...objectBody(req.body, 'the fields of assignment.grant'), kind: 'assignment.grant' })]);
174
+ }
175
+ /**
176
+ * Change an assignment
177
+ * Changes the tags or the expiry of an assignment.
178
+ * Body: { tags?, addTags?, removeTags?, expiresAt? } with at least one key (schema AuthzAssignmentPatch); the keys run as one batch.
179
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
180
+ * @response 200 {AuthzAdminResults} Every command succeeded
181
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
182
+ * @response 401 Unauthorized: a valid session or token is required
183
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
184
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
185
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
186
+ */
187
+ async patchAssignment(req) {
188
+ return this.single(req, () => {
189
+ const body = objectBody(req.body, 'an object { tags?, addTags?, removeTags?, expiresAt? }');
190
+ const unknown = Object.keys(body).find((k) => !PATCH_KEYS.includes(k));
191
+ if (unknown !== undefined)
192
+ badRequest(`an assignment patch takes ${PATCH_KEYS.join(', ')}, not ${JSON.stringify(unknown)}`, unknown);
193
+ const id = param(req, 'id');
194
+ const commands = [];
195
+ for (const key of ['tags', 'addTags', 'removeTags'])
196
+ if (key in body)
197
+ commands.push({ kind: PATCH_KINDS[key], id, tags: body[key] });
198
+ if ('expiresAt' in body)
199
+ commands.push((0, decode_js_1.decodeCommand)({ kind: 'assignment.setExpiry', id, expiresAt: body.expiresAt }));
200
+ if (commands.length === 0)
201
+ badRequest(`an assignment patch needs one of ${PATCH_KEYS.join(', ')}`);
202
+ return commands;
203
+ });
204
+ }
205
+ /**
206
+ * Revoke an assignment
207
+ * Revokes the assignment with the path id.
208
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
209
+ * @response 200 {AuthzAdminResults} Every command succeeded
210
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
211
+ * @response 401 Unauthorized: a valid session or token is required
212
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
213
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
214
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
215
+ */
216
+ async revoke(req) {
217
+ return this.single(req, () => [{ kind: 'assignment.revoke', id: param(req, 'id') }]);
218
+ }
219
+ /**
220
+ * List share links
221
+ * Lists the share links, filtered by the query. A listing never carries a token or its hash: the token is shown once, when the link is created.
222
+ * Query: `scope` (`<type>` or `<type>:<id>`), `limit`, `offset`.
223
+ * @response 200 {AuthzAdminPage} One page of rows
224
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
225
+ * @response 401 Unauthorized: a valid session or token is required
226
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
227
+ */
228
+ async listLinks(req) {
229
+ return this.list(req, () => (0, query_js_1.readPageQuery)('links', query(req)));
230
+ }
231
+ /**
232
+ * Create a share link
233
+ * Creates a share link that grants a role at a scope (link.create). The result carries the link id and its token: the token is shown once, here, and every answer the route sends carries `Cache-Control: no-store` (the 401 of the authentication check comes before the route and holds no token). A dry run or a retried request (same idempotency key) answers without the token.
234
+ * Body: the fields of link.create without `kind` (schema AuthzLinkCreate).
235
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
236
+ * @response 200 {AuthzAdminResults} The link was created; results[0] holds its id and token
237
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
238
+ * @response 401 Unauthorized: a valid session or token is required
239
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
240
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
241
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
242
+ */
243
+ async createLink(req) {
244
+ noStore(req);
245
+ return this.single(req, () => [(0, decode_js_1.decodeCommand)({ ...objectBody(req.body, 'the fields of link.create'), kind: 'link.create' })]);
246
+ }
247
+ /**
248
+ * Change a share link
249
+ * Changes the expiry, attributes, role or tags of the link with the path id (link.update). The answer never carries the token.
250
+ * Body: { expiresAt?, attributes?, role?, tags? } with at least one key (schema AuthzLinkPatch); an `id` in the body must equal the path id.
251
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
252
+ * @response 200 {AuthzAdminResults} Every command succeeded
253
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
254
+ * @response 401 Unauthorized: a valid session or token is required
255
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
256
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
257
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
258
+ */
259
+ async patchLink(req) {
260
+ return this.single(req, () => [linkUpdate(req.body, param(req, 'id'))]);
261
+ }
262
+ /**
263
+ * Revoke a share link
264
+ * Revokes the link with the path id and the role it grants (link.revoke); its token opens nothing from then on.
265
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
266
+ * @response 200 {AuthzAdminResults} Every command succeeded
267
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
268
+ * @response 401 Unauthorized: a valid session or token is required
269
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
270
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
271
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
272
+ */
273
+ async revokeLink(req) {
274
+ return this.single(req, () => [{ kind: 'link.revoke', id: param(req, 'id') }]);
275
+ }
276
+ /**
277
+ * List rules
278
+ * Lists the RBAC rules held as rows.
279
+ * Query: `scope` (`<type>` or `<type>:<id>`), `limit`, `offset`.
280
+ * @response 200 {AuthzAdminPage} One page of rows
281
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
282
+ * @response 401 Unauthorized: a valid session or token is required
283
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
284
+ */
285
+ async listRules(req) {
286
+ return this.list(req, () => (0, query_js_1.readPageQuery)('rules', query(req)));
287
+ }
288
+ /**
289
+ * Put a rule
290
+ * Inserts or replaces the RBAC rule with the path id.
291
+ * Body: a rule (schema AuthzRuleBody); an `id` in the body must equal the path id.
292
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
293
+ * @response 200 {AuthzAdminResults} Every command succeeded
294
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
295
+ * @response 401 Unauthorized: a valid session or token is required
296
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
297
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
298
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
299
+ */
300
+ async putRule(req) {
301
+ return this.single(req, () => [(0, decode_js_1.decodeCommand)({ kind: 'rule.put', rule: withPathId(req.body, param(req, 'id'), 'a rule') })]);
302
+ }
303
+ /**
304
+ * Delete a rule
305
+ * Deletes the RBAC rule with the path id.
306
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
307
+ * @response 200 {AuthzAdminResults} Every command succeeded
308
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
309
+ * @response 401 Unauthorized: a valid session or token is required
310
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
311
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
312
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
313
+ */
314
+ async deleteRule(req) {
315
+ return this.single(req, () => [{ kind: 'rule.delete', id: param(req, 'id') }]);
316
+ }
317
+ /**
318
+ * List policies
319
+ * Lists the ABAC policies held as rows.
320
+ * Query: `scope` (`<type>` or `<type>:<id>`), `limit`, `offset`.
321
+ * @response 200 {AuthzAdminPage} One page of rows
322
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
323
+ * @response 401 Unauthorized: a valid session or token is required
324
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
325
+ */
326
+ async listPolicies(req) {
327
+ return this.list(req, () => (0, query_js_1.readPageQuery)('policies', query(req)));
328
+ }
329
+ /**
330
+ * Put a policy
331
+ * Inserts or replaces the ABAC policy with the path id.
332
+ * Body: a policy (schema AuthzPolicyBody); an `id` in the body must equal the path id.
333
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
334
+ * @response 200 {AuthzAdminResults} Every command succeeded
335
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
336
+ * @response 401 Unauthorized: a valid session or token is required
337
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
338
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
339
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
340
+ */
341
+ async putPolicy(req) {
342
+ return this.single(req, () => [(0, decode_js_1.decodeCommand)({ kind: 'policy.put', policy: withPathId(req.body, param(req, 'id'), 'a policy') })]);
343
+ }
344
+ /**
345
+ * Delete a policy
346
+ * Deletes the ABAC policy with the path id.
347
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
348
+ * @response 200 {AuthzAdminResults} Every command succeeded
349
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
350
+ * @response 401 Unauthorized: a valid session or token is required
351
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
352
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
353
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
354
+ */
355
+ async deletePolicy(req) {
356
+ return this.single(req, () => [{ kind: 'policy.delete', id: param(req, 'id') }]);
357
+ }
358
+ /**
359
+ * Read scope attributes
360
+ * Returns the attributes of the scope node `<type>:<id>`.
361
+ * @response 200 {AuthzAdminPage} items holds one entry, the attributes object of the scope; total is 1
362
+ * @response 400 {AuthzAdminError} invalid_query: a malformed query parameter
363
+ * @response 401 Unauthorized: a valid session or token is required
364
+ * @response 403 {AuthzAdminError} forbidden: the caller lacks the read permission at the scope
365
+ */
366
+ async attributes(req) {
367
+ return this.list(req, () => ({ kind: 'attributes', scope: scopeOf(req) }));
368
+ }
369
+ /**
370
+ * Merge scope attributes
371
+ * Deep-merges the body into the attributes of the scope node; null deletes a path.
372
+ * Body: an object (schema AuthzAttributesPatch).
373
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
374
+ * @response 200 {AuthzAdminResults} Every command succeeded
375
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
376
+ * @response 401 Unauthorized: a valid session or token is required
377
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
378
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
379
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
380
+ */
381
+ async patchAttributes(req) {
382
+ return this.single(req, () => [{ kind: 'scope.setAttributes', scope: scopeOf(req), patch: req.body }]);
383
+ }
384
+ /**
385
+ * Replace scope attributes
386
+ * Replaces all attributes of the scope node with the body.
387
+ * Body: an object (schema AuthzAttributesBody).
388
+ * Query: `reason` (audit text), `idempotencyKey`, `dryRun` (`true` validates and guards, then rolls back).
389
+ * @response 200 {AuthzAdminResults} Every command succeeded
390
+ * @response 400 {AuthzAdminError} invalid_request, invalid_query (an option of the query string), invalid_batch or a validation code of the command
391
+ * @response 401 Unauthorized: a valid session or token is required
392
+ * @response 403 {AuthzAdminError} forbidden, escalation, last_holder, self_lockout or protected_role
393
+ * @response 404 {AuthzAdminError} not_found: a row the command names does not exist
394
+ * @response 409 {AuthzAdminError} conflict: the row changed or exists already
395
+ */
396
+ async replaceAttributes(req) {
397
+ return this.single(req, () => [{ kind: 'scope.replaceAttributes', scope: scopeOf(req), attributes: req.body }]);
398
+ }
399
+ };
400
+ exports.AuthzAdminController = AuthzAdminController;
401
+ __decorate([
402
+ (0, configuration_1.Config)('authz.http.admin.domain'),
403
+ __metadata("design:type", String)
404
+ ], AuthzAdminController.prototype, "AdminDomain", void 0);
405
+ __decorate([
406
+ (0, di_1.Autoinject)(authz_1.AuthzDomains),
407
+ __metadata("design:type", authz_1.AuthzDomains)
408
+ ], AuthzAdminController.prototype, "Domains", void 0);
409
+ __decorate([
410
+ (0, http_1.Post)('commands'),
411
+ __param(0, (0, http_1.Req)()),
412
+ __metadata("design:type", Function),
413
+ __metadata("design:paramtypes", [Object]),
414
+ __metadata("design:returntype", Promise)
415
+ ], AuthzAdminController.prototype, "commands", null);
416
+ __decorate([
417
+ (0, http_1.Get)('assignments'),
418
+ __param(0, (0, http_1.Req)()),
419
+ __metadata("design:type", Function),
420
+ __metadata("design:paramtypes", [Object]),
421
+ __metadata("design:returntype", Promise)
422
+ ], AuthzAdminController.prototype, "listAssignments", null);
423
+ __decorate([
424
+ (0, http_1.Get)('holders'),
425
+ __param(0, (0, http_1.Req)()),
426
+ __metadata("design:type", Function),
427
+ __metadata("design:paramtypes", [Object]),
428
+ __metadata("design:returntype", Promise)
429
+ ], AuthzAdminController.prototype, "listHolders", null);
430
+ __decorate([
431
+ (0, http_1.Post)('assignments'),
432
+ __param(0, (0, http_1.Req)()),
433
+ __metadata("design:type", Function),
434
+ __metadata("design:paramtypes", [Object]),
435
+ __metadata("design:returntype", Promise)
436
+ ], AuthzAdminController.prototype, "grant", null);
437
+ __decorate([
438
+ (0, http_1.Patch)('assignments/:id'),
439
+ __param(0, (0, http_1.Req)()),
440
+ __metadata("design:type", Function),
441
+ __metadata("design:paramtypes", [Object]),
442
+ __metadata("design:returntype", Promise)
443
+ ], AuthzAdminController.prototype, "patchAssignment", null);
444
+ __decorate([
445
+ (0, http_1.Del)('assignments/:id'),
446
+ __param(0, (0, http_1.Req)()),
447
+ __metadata("design:type", Function),
448
+ __metadata("design:paramtypes", [Object]),
449
+ __metadata("design:returntype", Promise)
450
+ ], AuthzAdminController.prototype, "revoke", null);
451
+ __decorate([
452
+ (0, http_1.Get)('links'),
453
+ __param(0, (0, http_1.Req)()),
454
+ __metadata("design:type", Function),
455
+ __metadata("design:paramtypes", [Object]),
456
+ __metadata("design:returntype", Promise)
457
+ ], AuthzAdminController.prototype, "listLinks", null);
458
+ __decorate([
459
+ (0, http_1.Post)('links'),
460
+ __param(0, (0, http_1.Req)()),
461
+ __metadata("design:type", Function),
462
+ __metadata("design:paramtypes", [Object]),
463
+ __metadata("design:returntype", Promise)
464
+ ], AuthzAdminController.prototype, "createLink", null);
465
+ __decorate([
466
+ (0, http_1.Patch)('links/:id'),
467
+ __param(0, (0, http_1.Req)()),
468
+ __metadata("design:type", Function),
469
+ __metadata("design:paramtypes", [Object]),
470
+ __metadata("design:returntype", Promise)
471
+ ], AuthzAdminController.prototype, "patchLink", null);
472
+ __decorate([
473
+ (0, http_1.Del)('links/:id'),
474
+ __param(0, (0, http_1.Req)()),
475
+ __metadata("design:type", Function),
476
+ __metadata("design:paramtypes", [Object]),
477
+ __metadata("design:returntype", Promise)
478
+ ], AuthzAdminController.prototype, "revokeLink", null);
479
+ __decorate([
480
+ (0, http_1.Get)('rules'),
481
+ __param(0, (0, http_1.Req)()),
482
+ __metadata("design:type", Function),
483
+ __metadata("design:paramtypes", [Object]),
484
+ __metadata("design:returntype", Promise)
485
+ ], AuthzAdminController.prototype, "listRules", null);
486
+ __decorate([
487
+ (0, http_1.Put)('rules/:id'),
488
+ __param(0, (0, http_1.Req)()),
489
+ __metadata("design:type", Function),
490
+ __metadata("design:paramtypes", [Object]),
491
+ __metadata("design:returntype", Promise)
492
+ ], AuthzAdminController.prototype, "putRule", null);
493
+ __decorate([
494
+ (0, http_1.Del)('rules/:id'),
495
+ __param(0, (0, http_1.Req)()),
496
+ __metadata("design:type", Function),
497
+ __metadata("design:paramtypes", [Object]),
498
+ __metadata("design:returntype", Promise)
499
+ ], AuthzAdminController.prototype, "deleteRule", null);
500
+ __decorate([
501
+ (0, http_1.Get)('policies'),
502
+ __param(0, (0, http_1.Req)()),
503
+ __metadata("design:type", Function),
504
+ __metadata("design:paramtypes", [Object]),
505
+ __metadata("design:returntype", Promise)
506
+ ], AuthzAdminController.prototype, "listPolicies", null);
507
+ __decorate([
508
+ (0, http_1.Put)('policies/:id'),
509
+ __param(0, (0, http_1.Req)()),
510
+ __metadata("design:type", Function),
511
+ __metadata("design:paramtypes", [Object]),
512
+ __metadata("design:returntype", Promise)
513
+ ], AuthzAdminController.prototype, "putPolicy", null);
514
+ __decorate([
515
+ (0, http_1.Del)('policies/:id'),
516
+ __param(0, (0, http_1.Req)()),
517
+ __metadata("design:type", Function),
518
+ __metadata("design:paramtypes", [Object]),
519
+ __metadata("design:returntype", Promise)
520
+ ], AuthzAdminController.prototype, "deletePolicy", null);
521
+ __decorate([
522
+ (0, http_1.Get)('scopes/:type/:id/attributes'),
523
+ __param(0, (0, http_1.Req)()),
524
+ __metadata("design:type", Function),
525
+ __metadata("design:paramtypes", [Object]),
526
+ __metadata("design:returntype", Promise)
527
+ ], AuthzAdminController.prototype, "attributes", null);
528
+ __decorate([
529
+ (0, http_1.Patch)('scopes/:type/:id/attributes'),
530
+ __param(0, (0, http_1.Req)()),
531
+ __metadata("design:type", Function),
532
+ __metadata("design:paramtypes", [Object]),
533
+ __metadata("design:returntype", Promise)
534
+ ], AuthzAdminController.prototype, "patchAttributes", null);
535
+ __decorate([
536
+ (0, http_1.Put)('scopes/:type/:id/attributes'),
537
+ __param(0, (0, http_1.Req)()),
538
+ __metadata("design:type", Function),
539
+ __metadata("design:paramtypes", [Object]),
540
+ __metadata("design:returntype", Promise)
541
+ ], AuthzAdminController.prototype, "replaceAttributes", null);
542
+ exports.AuthzAdminController = AuthzAdminController = __decorate([
543
+ (0, http_1.Policy)(authz_http_1.IsAuthenticated),
544
+ (0, http_1.BasePath)('authz')
545
+ ], AuthzAdminController);
546
+ function results(r) {
547
+ return respond((0, status_js_1.resultsStatus)(r), { results: r });
548
+ }
549
+ //# sourceMappingURL=AuthzAdminController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthzAdminController.js","sourceRoot":"","sources":["../../../src/controllers/AuthzAdminController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAAiE;AACjE,0DAAgD;AAChD,oCAAyC;AAEzC,wCAAiK;AAEjK,oDAAsD;AACtD,wCAA8C;AAE9C,kCAAgC;AAChC,mDAAoE;AACpE,iDAA6G;AAE7G,mDAAsE;AAEtE,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,CAAU,CAAC;AAC3E,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,uBAAuB,EAAW,CAAC;AAEhI,SAAS,OAAO,CAAC,MAAc,EAAE,IAAa;IAC5C,QAAQ,MAAM,EAAE,CA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,EAAC,OAAO,CAAC;GACL,oBAAoB,CA0VhC;AAED,SAAS,OAAO,CAAC,CAA6C;IAC5D,OAAO,OAAO,CAAC,IAAA,yBAAa,EAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './controllers/AuthzAdminController.js';
2
+ export * from './routes/index.js';
3
+ export * from './schemas/index.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./controllers/AuthzAdminController.js"), exports);
18
+ __exportStar(require("./routes/index.js"), exports);
19
+ __exportStar(require("./schemas/index.js"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wEAAsD;AACtD,oDAAkC;AAClC,qDAAmC"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,11 @@
1
+ /** Date, time (seconds and fraction optional) and `Z` or an offset: the only strings read as a Date. */
2
+ export declare const ISO_DATE_TIME: RegExp;
3
+ /**
4
+ * A command as JSON carries its expiry dates as strings; this copy holds Dates at the known expiry
5
+ * paths. Anything else, including a string that is not an ISO date-time, stays as it came, so
6
+ * AuthzAdmin refuses it as it would refuse it in-process.
7
+ */
8
+ export declare function decodeCommand(command: unknown): unknown;
9
+ /** decodeCommand for each entry of a list; anything else goes through for AuthzAdmin to refuse. */
10
+ export declare function decodeCommands(commands: unknown): unknown;
11
+ //# sourceMappingURL=decode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/routes/decode.ts"],"names":[],"mappings":"AAEA,wGAAwG;AACxG,eAAO,MAAM,aAAa,QAAkG,CAAC;AA+B7H;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAMvD;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAEzD"}