@fabrika/iam-contract 0.9.0-dev.4 → 0.9.0-dev.40
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.
- package/package.json +7 -4
- package/src/access.ts +3 -0
- package/src/index.ts +343 -22
- package/src/oauth.ts +218 -17
- package/src/password-policy.ts +43 -0
- package/types/src/access.d.ts +2 -0
- package/types/src/index.d.ts +309 -22
- package/types/src/oauth.d.ts +91 -6
- package/types/src/password-policy.d.ts +34 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/iam-contract",
|
|
3
|
-
"version": "0.9.0-dev.
|
|
3
|
+
"version": "0.9.0-dev.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"src",
|
|
15
|
+
"!src/**/__tests__/**",
|
|
15
16
|
"types"
|
|
16
17
|
],
|
|
17
18
|
"exports": {
|
|
@@ -22,10 +23,12 @@
|
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
"scripts": {
|
|
25
|
-
"typecheck": "
|
|
26
|
+
"typecheck": "tsrs --build tsconfig.test.json",
|
|
27
|
+
"test": "bun test"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@fabrika/app": "0.9.0-dev.
|
|
29
|
-
"@fabrika/auth-core": "0.9.0-dev.
|
|
30
|
+
"@fabrika/app": "0.9.0-dev.40",
|
|
31
|
+
"@fabrika/auth-core": "0.9.0-dev.40",
|
|
32
|
+
"@fabrika/proxy-core": "0.9.0-dev.40"
|
|
30
33
|
}
|
|
31
34
|
}
|
package/src/access.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const IAM_ACTIONS = Object.freeze({
|
|
|
11
11
|
ADMIN: 'iam.admin',
|
|
12
12
|
/** Manage the people of applications, never of the installation's own apps. Global, or in `app` values. */
|
|
13
13
|
USERS_MANAGE: 'iam.users.manage',
|
|
14
|
+
/** Enrol a browser as a terminal (ADR-0067). Global only; its profile and revocation stay `iam.admin`'s. */
|
|
15
|
+
TERMINALS_MANAGE: 'iam.terminals.manage',
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
export const IAM_SCOPES = Object.freeze({
|
|
@@ -40,6 +42,7 @@ export const IAM_APP_SCHEMA: AppSchema = {
|
|
|
40
42
|
actions: [
|
|
41
43
|
{ action: IAM_ACTIONS.ADMIN, description: 'Administer identity and access for the installation' },
|
|
42
44
|
{ action: IAM_ACTIONS.USERS_MANAGE, description: 'Manage the people of applications: invite, sign out, reset, grant and revoke' },
|
|
45
|
+
{ action: IAM_ACTIONS.TERMINALS_MANAGE, description: 'Enrol a shared computer as a terminal' },
|
|
43
46
|
],
|
|
44
47
|
roles: {
|
|
45
48
|
[USER_ADMIN_ROLE]: {
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
AppMemberItem,
|
|
17
17
|
AppSchema,
|
|
18
18
|
AppScopeDef,
|
|
19
|
+
DimensionValue,
|
|
19
20
|
Locale,
|
|
20
21
|
PermissionEntry,
|
|
21
22
|
PermissionSource,
|
|
@@ -24,6 +25,8 @@ import type {
|
|
|
24
25
|
RoleDef,
|
|
25
26
|
WorkloadKind,
|
|
26
27
|
} from '@fabrika/auth-core'
|
|
28
|
+
import type { InstallationBrand } from '@fabrika/proxy-core/brand'
|
|
29
|
+
import type { PasswordPolicyDto, SetPasswordPolicyRequest } from './password-policy'
|
|
27
30
|
|
|
28
31
|
// ── Common wrappers ───────────────────────────────────────────────────────────
|
|
29
32
|
|
|
@@ -67,8 +70,10 @@ export interface GrantDto {
|
|
|
67
70
|
permissions: string[] | null
|
|
68
71
|
/** Scope dimension; null = global (both rise/fall together). */
|
|
69
72
|
scopeType: string | null
|
|
70
|
-
/** Opaque, app-owned scope value; null = global. */
|
|
73
|
+
/** Opaque, app-owned scope value; null = global. The first of `scopeValues` (ADR-0085). */
|
|
71
74
|
scopeValue: string | null
|
|
75
|
+
/** Every value of `scopeType` the grant holds, sorted; null = global. A grant of one value lists one. */
|
|
76
|
+
scopeValues: string[] | null
|
|
72
77
|
/** App id this grant applies to; null = all apps (cross-app). */
|
|
73
78
|
app: string | null
|
|
74
79
|
grantedBy: string | null
|
|
@@ -81,17 +86,40 @@ export interface GrantDto {
|
|
|
81
86
|
export interface PrincipalDetail extends PrincipalListItem {
|
|
82
87
|
/** The mailbox is listed in `IAM_BOOTSTRAP_ADMINS`: an internal user with it is an installation admin. */
|
|
83
88
|
bootstrapMailbox: boolean
|
|
84
|
-
grants:
|
|
85
|
-
/**
|
|
89
|
+
grants: PrincipalGrantDto[]
|
|
90
|
+
/** Permissions at IAM only. Prefer `access` for the per-application view. */
|
|
86
91
|
permissions: PermissionEntry[]
|
|
92
|
+
access: PrincipalAppAccess[]
|
|
93
|
+
/** Presentation capabilities. Every mutation still checks the caller live. */
|
|
94
|
+
management: { account: boolean; passwordLinks: boolean; audit: boolean }
|
|
95
|
+
activatedAt: number | null
|
|
96
|
+
disabledAt: number | null
|
|
87
97
|
authentication: {
|
|
88
98
|
/** OIDC is linked when this user has claimed an identity-provider subject. */
|
|
89
99
|
oidc: { state: 'unavailable' | 'unlinked' | 'linked' }
|
|
90
100
|
/** Password access is globally opt-in and then enabled per user. */
|
|
91
|
-
password: {
|
|
101
|
+
password: {
|
|
102
|
+
state: 'unavailable' | 'disabled' | 'pending' | 'enabled'
|
|
103
|
+
delivery: 'email' | 'manual'
|
|
104
|
+
latestAction: { purpose: 'enrollment' | 'reset'; createdAt: number; expiresAt: number; closedAt: number | null } | null
|
|
105
|
+
}
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
108
|
|
|
109
|
+
export interface PrincipalGrantDto extends GrantDto {
|
|
110
|
+
roleName: string | null
|
|
111
|
+
rolePermissions: string[]
|
|
112
|
+
grantedByLabel: string | null
|
|
113
|
+
canManage: boolean
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface PrincipalAppAccess {
|
|
117
|
+
app: string
|
|
118
|
+
/** Resolved by IAM using the same per-app resolver as token issuance; empty for a disabled account. */
|
|
119
|
+
permissions: PermissionEntry[]
|
|
120
|
+
lastSignInAt: number | null
|
|
121
|
+
}
|
|
122
|
+
|
|
95
123
|
export interface InviteRequest {
|
|
96
124
|
email: string
|
|
97
125
|
/** Omitted: `internal`. An `external` user signs in by password only, and OIDC never claims it. */
|
|
@@ -111,8 +139,11 @@ export interface UpdatePrincipalRequest {
|
|
|
111
139
|
export interface SessionDto {
|
|
112
140
|
id: string
|
|
113
141
|
principalId: string
|
|
114
|
-
/**
|
|
115
|
-
|
|
142
|
+
/**
|
|
143
|
+
* How the human proved who they were; `local_dev` is IAM's `LOCAL_DEV_LOGIN` bypass, `terminal_assertion` an
|
|
144
|
+
* application's word about who stands at an enrolled terminal.
|
|
145
|
+
*/
|
|
146
|
+
authenticationMethod: 'oidc' | 'password' | 'local_dev' | 'terminal_assertion'
|
|
116
147
|
/** The app this session is bound to (an ADR-0022 child); null = the IAM session itself. */
|
|
117
148
|
app: string | null
|
|
118
149
|
/** The IAM session this was derived from; null on an IAM session. Revoking that one revokes this. */
|
|
@@ -122,10 +153,20 @@ export interface SessionDto {
|
|
|
122
153
|
createdAt: number
|
|
123
154
|
expiresAt: number
|
|
124
155
|
revokedAt: number | null
|
|
156
|
+
/** Why this session cannot be used now, independently of its own stored lifecycle. */
|
|
157
|
+
unavailableReason: 'revoked' | 'expired' | 'parent_ended' | 'account_disabled' | 'method_disabled' | null
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface SessionList extends CursorList<SessionDto> {
|
|
161
|
+
/** App sessions belonging to the sign-ins on this page, when `signInsOnly` is requested. */
|
|
162
|
+
applications: SessionDto[]
|
|
125
163
|
}
|
|
126
164
|
|
|
127
165
|
// ── Grants ────────────────────────────────────────────────────────────────────
|
|
128
166
|
|
|
167
|
+
/** The most scope values one grant holds (ADR-0085). */
|
|
168
|
+
export const MAX_GRANT_SCOPE_VALUES = 100
|
|
169
|
+
|
|
129
170
|
export interface CreateGrantRequest {
|
|
130
171
|
principalId: string
|
|
131
172
|
/** A named role/policy key — XOR `permissions` (supply exactly one). */
|
|
@@ -136,14 +177,94 @@ export interface CreateGrantRequest {
|
|
|
136
177
|
scopeType?: string | null
|
|
137
178
|
/** Opaque, app-owned scope value; null / omitted = global. */
|
|
138
179
|
scopeValue?: string | null
|
|
180
|
+
/** Several values of `scopeType`, one grant (ADR-0085); XOR `scopeValue`, at most `MAX_GRANT_SCOPE_VALUES`. */
|
|
181
|
+
scopeValues?: string[]
|
|
139
182
|
/** App id (a registered app id); null / omitted = all apps (cross-app). */
|
|
140
183
|
app?: string | null
|
|
141
184
|
expiresAt?: number | null
|
|
142
185
|
}
|
|
143
186
|
|
|
187
|
+
/** Change access within its original application, preserving the grant's identity and author. */
|
|
188
|
+
export interface UpdateGrantInput extends Omit<CreateGrantRequest, 'principalId' | 'app'> {
|
|
189
|
+
id: string
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ── Grant requests: a console grant that waits for a second administrator (ADR-0083) ───────
|
|
193
|
+
|
|
194
|
+
/** How long a grant request stays open for a decision. */
|
|
195
|
+
export const GRANT_REQUEST_TTL_SECONDS = 7 * 24 * 60 * 60
|
|
196
|
+
|
|
197
|
+
export const GRANT_REQUEST_KINDS = ['create', 'update', 'revoke'] as const
|
|
198
|
+
export type GrantRequestKind = (typeof GRANT_REQUEST_KINDS)[number]
|
|
199
|
+
|
|
200
|
+
/** `failed`: approved, but the change no longer applied when the approval wrote it. `expired`: no decision in time. */
|
|
201
|
+
export const GRANT_REQUEST_STATUSES = ['pending', 'approved', 'rejected', 'failed', 'expired'] as const
|
|
202
|
+
export type GrantRequestStatus = (typeof GRANT_REQUEST_STATUSES)[number]
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* A grant, grant edit or revocation at an application whose console grants wait for approval: it has no effect until
|
|
206
|
+
* another administrator of the application approves it (ADR-0083 §4). The grant fields are the change's: the new grant
|
|
207
|
+
* for `create` and `update`, the revoked one for `revoke`.
|
|
208
|
+
*/
|
|
209
|
+
export interface GrantRequestDto {
|
|
210
|
+
id: string
|
|
211
|
+
app: string
|
|
212
|
+
kind: GrantRequestKind
|
|
213
|
+
principalId: string
|
|
214
|
+
/** The principal's label as an administrator sees it; null when the principal is gone. */
|
|
215
|
+
principalLabel: string | null
|
|
216
|
+
/** The grant an `update` edits or a `revoke` removes; null for `create`. */
|
|
217
|
+
grantId: string | null
|
|
218
|
+
roleKey: string | null
|
|
219
|
+
permissions: string[] | null
|
|
220
|
+
scopeType: string | null
|
|
221
|
+
/** The first requested value; `scopeValues` holds every one. */
|
|
222
|
+
scopeValue: string | null
|
|
223
|
+
/** Every requested value, sorted (ADR-0085); null for a global grant. */
|
|
224
|
+
scopeValues: string[] | null
|
|
225
|
+
/** The grant's own expiry; null for none. */
|
|
226
|
+
grantExpiresAt: number | null
|
|
227
|
+
requestedBy: string
|
|
228
|
+
requestedByLabel: string | null
|
|
229
|
+
requestedAt: number
|
|
230
|
+
/** When the request lapses without a decision. */
|
|
231
|
+
expiresAt: number
|
|
232
|
+
status: GrantRequestStatus
|
|
233
|
+
decidedBy: string | null
|
|
234
|
+
decidedAt: number | null
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** What a grant change answers at an application whose grants wait: the request, and nothing changed. */
|
|
238
|
+
export interface PendingGrantChange {
|
|
239
|
+
pending: GrantRequestDto
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** `grants.create` and `grants.update`: the grant, or the request when the application's grants wait. */
|
|
243
|
+
export type GrantChangeResponse = GrantDto | PendingGrantChange
|
|
244
|
+
|
|
245
|
+
export interface ListGrantRequestsInput {
|
|
246
|
+
/** One application's requests; omitted, every application the caller administers. */
|
|
247
|
+
app?: string
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface DecideGrantRequestInput {
|
|
251
|
+
id: string
|
|
252
|
+
decision: 'approve' | 'reject'
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Whether an application's console grants wait for approval; Control's to set with the provisioning key (ADR-0083).
|
|
257
|
+
* `revision` is the environment's protection revision: IAM ignores one older than it holds, and answers what it holds.
|
|
258
|
+
*/
|
|
259
|
+
export interface SetGrantApprovalRequest {
|
|
260
|
+
app: string
|
|
261
|
+
required: boolean
|
|
262
|
+
revision: number
|
|
263
|
+
}
|
|
264
|
+
|
|
144
265
|
// ── Apps (read-only; the live registry derived from the schema tables) ────────
|
|
145
266
|
|
|
146
|
-
/** The set of app ids
|
|
267
|
+
/** The set of app ids IAM knows about — the choices for a grant's `app`. */
|
|
147
268
|
export interface AppDto {
|
|
148
269
|
id: string
|
|
149
270
|
/** The name the app's schema declares for people; null when it declares none. */
|
|
@@ -155,11 +276,8 @@ export interface AppDto {
|
|
|
155
276
|
// ── Roles & policies (per-app, DB-backed) ─────────────────────────────────────
|
|
156
277
|
|
|
157
278
|
/** A role available for the calling app — a built-in or a DB row (app/custom). */
|
|
158
|
-
export interface RoleDto {
|
|
279
|
+
export interface RoleDto extends RoleDef {
|
|
159
280
|
key: string
|
|
160
|
-
name: string
|
|
161
|
-
description?: string
|
|
162
|
-
permissions: string[]
|
|
163
281
|
/** 'builtin' (cross-app, e.g. admin), 'app' (reconciled), or 'custom' (admin-made). */
|
|
164
282
|
origin: 'builtin' | 'app' | 'custom'
|
|
165
283
|
}
|
|
@@ -192,6 +310,8 @@ export interface AppSchemaDto {
|
|
|
192
310
|
members?: { manage: string; list: string }
|
|
193
311
|
/** `labels` when the app's directory shows labels to `members.list` holders. */
|
|
194
312
|
directory?: 'labels'
|
|
313
|
+
/** The app's identification page at a terminal (ADR-0067); absent when the app declares none. */
|
|
314
|
+
terminal?: { identify: string }
|
|
195
315
|
}
|
|
196
316
|
|
|
197
317
|
// ── Policies (origin='custom' roles, admin-composed) ──────────────────────────
|
|
@@ -231,14 +351,26 @@ export interface ApiKeyDto {
|
|
|
231
351
|
}
|
|
232
352
|
|
|
233
353
|
/**
|
|
234
|
-
* One API key with its live credential
|
|
235
|
-
* `grants.delete` by an installation administrator and read again at every
|
|
354
|
+
* One API key with its live credential, as `apiKeys.get` and each row of `apiKeys.list` answer it. Its permissions are
|
|
355
|
+
* its grants, edited with `grants.create`, `grants.update` and `grants.delete` by an installation administrator and read again at every
|
|
356
|
+
* token exchange. An IAM older than the list's credential answers list rows without `credential`.
|
|
236
357
|
*/
|
|
237
358
|
export interface ApiKeyDetail extends ApiKeyDto {
|
|
238
359
|
/** The key's live credential, or null when none is live (a revoked key). */
|
|
239
360
|
credential: ApiKeyCredentialDto | null
|
|
240
361
|
}
|
|
241
362
|
|
|
363
|
+
/** A grant of `apiKeys.get`'s key, naming who granted it. */
|
|
364
|
+
export interface ApiKeyGrantDto extends GrantDto {
|
|
365
|
+
/** The granting principal's label, or its id when IAM no longer knows it; null when nobody granted it. */
|
|
366
|
+
grantedByLabel: string | null
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** `apiKeys.get`: one key whose grants name who granted them. */
|
|
370
|
+
export interface GetApiKeyResponse extends ApiKeyDetail {
|
|
371
|
+
grants: ApiKeyGrantDto[]
|
|
372
|
+
}
|
|
373
|
+
|
|
242
374
|
export interface ApiKeyCredentialDto {
|
|
243
375
|
/** The app the key mints tokens for; null = every app. A grant at another app never reaches the key's token. */
|
|
244
376
|
app: string | null
|
|
@@ -256,6 +388,8 @@ export interface ProvisionApiKeyRequest {
|
|
|
256
388
|
scopeType?: string | null
|
|
257
389
|
/** Opaque, app-owned scope value; null / omitted = global. */
|
|
258
390
|
scopeValue?: string | null
|
|
391
|
+
/** Several values of `scopeType`, one grant (ADR-0085); XOR `scopeValue`, at most `MAX_GRANT_SCOPE_VALUES`. */
|
|
392
|
+
scopeValues?: string[]
|
|
259
393
|
/** App id (a registered app id); null / omitted = all apps. */
|
|
260
394
|
app?: string | null
|
|
261
395
|
expiresAt?: number | null
|
|
@@ -264,7 +398,7 @@ export interface ProvisionApiKeyRequest {
|
|
|
264
398
|
/**
|
|
265
399
|
* Provisioning result. `apiKey` (a `px_…` credential bound to the new service principal) is shown
|
|
266
400
|
* exactly ONCE — copy it now, it is not retrievable later. Carried as a bearer (or a declared
|
|
267
|
-
* header) directly to apps on the
|
|
401
|
+
* header) directly to apps on the IAM-native path (`mintFromKey`), no Cloudflare Access in
|
|
268
402
|
* front.
|
|
269
403
|
*/
|
|
270
404
|
export interface ProvisionApiKeyResponse {
|
|
@@ -398,6 +532,7 @@ export interface PrincipalIdInput {
|
|
|
398
532
|
export interface ListSessionsInput extends PageInput {
|
|
399
533
|
/** Whose sessions to list. */
|
|
400
534
|
principalId: string
|
|
535
|
+
signInsOnly?: boolean
|
|
401
536
|
}
|
|
402
537
|
|
|
403
538
|
export interface SessionIdInput {
|
|
@@ -424,6 +559,28 @@ export interface AppInput {
|
|
|
424
559
|
app: string
|
|
425
560
|
}
|
|
426
561
|
|
|
562
|
+
// ── Live scope values (ADR-0085 §4) ────────────────────────────────────────────
|
|
563
|
+
|
|
564
|
+
export interface ListScopeValuesInput {
|
|
565
|
+
/** The application id, `<app>@<env>`. */
|
|
566
|
+
app: string
|
|
567
|
+
/** The dimension whose values the console offers. */
|
|
568
|
+
scopeType: string
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Why the application's own list is not there, so the console falls back to the listed values or free text:
|
|
573
|
+
* `no_source` (the dimension names no procedure), `not_held` (the administrator holds the procedure's action nowhere at
|
|
574
|
+
* the application), `no_origin` (IAM knows no address of it), `refused` (its proxy or the application answered
|
|
575
|
+
* 401/403/404), `timeout`, `unreachable` (any other failure to answer) or `malformed` (an answer that is no list).
|
|
576
|
+
*/
|
|
577
|
+
export type ScopeValuesUnavailable = 'no_source' | 'not_held' | 'no_origin' | 'refused' | 'timeout' | 'unreachable' | 'malformed'
|
|
578
|
+
|
|
579
|
+
/** What the application answered as the administrator, or why it could not be asked. Information, never a check. */
|
|
580
|
+
export type ScopeValuesResult =
|
|
581
|
+
| { source: 'application'; values: DimensionValue[] }
|
|
582
|
+
| { source: 'unavailable'; reason: ScopeValuesUnavailable }
|
|
583
|
+
|
|
427
584
|
/**
|
|
428
585
|
* The public origins IAM will hand this app a session at (ADR-0022). Declarative: the whole set is
|
|
429
586
|
* stated, so removing one is the same call as adding one and a stale entry cannot survive a deploy.
|
|
@@ -471,7 +628,14 @@ export interface ListAuditInput {
|
|
|
471
628
|
resourceType?: string
|
|
472
629
|
resourceId?: string
|
|
473
630
|
principalId?: string
|
|
631
|
+
/** The person affected by the change, distinct from `principalId` (the actor). */
|
|
632
|
+
subjectPrincipalId?: string
|
|
474
633
|
action?: string
|
|
634
|
+
/**
|
|
635
|
+
* Leave out the admin reads (`iam.admin.access`), which IAM writes for every `/admin/*` request, so a feed of what
|
|
636
|
+
* changed reads changes and not the reads that page through it. An IAM older than this field ignores it.
|
|
637
|
+
*/
|
|
638
|
+
changesOnly?: boolean
|
|
475
639
|
requestId?: string
|
|
476
640
|
before?: string
|
|
477
641
|
limit?: number
|
|
@@ -557,6 +721,45 @@ export interface IssueMembershipKeyResponse {
|
|
|
557
721
|
expiresAt: number
|
|
558
722
|
}
|
|
559
723
|
|
|
724
|
+
// ── Terminals (ADR-0067) ──────────────────────────────────────────────────────
|
|
725
|
+
|
|
726
|
+
/** An application that may assert a person on a terminal, with the action patterns of the person that survive there. */
|
|
727
|
+
export interface TerminalAsserterDto {
|
|
728
|
+
app: string
|
|
729
|
+
ceiling: string[]
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* An enrolled browser, as an operator sees it. Its own grants are ordinary grants on `terminalId`, which is its service
|
|
734
|
+
* principal; the cookie is never shown.
|
|
735
|
+
*/
|
|
736
|
+
export interface TerminalDto {
|
|
737
|
+
terminalId: string
|
|
738
|
+
label: string
|
|
739
|
+
/** The administrator who enrolled it; null once that principal is gone. */
|
|
740
|
+
enrolledBy: string | null
|
|
741
|
+
/** Seconds a person's session on it lasts. */
|
|
742
|
+
sessionTtl: number
|
|
743
|
+
asserters: TerminalAsserterDto[]
|
|
744
|
+
status: 'active' | 'revoked'
|
|
745
|
+
createdAt: number
|
|
746
|
+
lastSeenAt: number | null
|
|
747
|
+
revokedAt: number | null
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export type ListTerminalsInput = PageInput
|
|
751
|
+
|
|
752
|
+
export interface TerminalIdInput {
|
|
753
|
+
terminalId: string
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/** Replace a terminal's whole profile. The ceiling is empty by default: the person brings only their identity. */
|
|
757
|
+
export interface SetTerminalProfileRequest extends TerminalIdInput {
|
|
758
|
+
label: string
|
|
759
|
+
sessionTtl: number
|
|
760
|
+
asserters: TerminalAsserterDto[]
|
|
761
|
+
}
|
|
762
|
+
|
|
560
763
|
// ── An application's own people, administered by its own administrator ───────
|
|
561
764
|
|
|
562
765
|
/**
|
|
@@ -596,8 +799,10 @@ export interface GrantAppRoleRequest {
|
|
|
596
799
|
export interface GrantAppRoleResponse {
|
|
597
800
|
principalId: string
|
|
598
801
|
role: string
|
|
599
|
-
/** False when the person held the role already. */
|
|
802
|
+
/** False when the person held the role already, or the grant waits for approval (`pending`). */
|
|
600
803
|
granted: boolean
|
|
804
|
+
/** The grant request, when the application's grants wait for approval (ADR-0083). */
|
|
805
|
+
pending?: GrantRequestDto
|
|
601
806
|
}
|
|
602
807
|
|
|
603
808
|
/** Remove the global grant of `role` from a person. Repeating it answers the same. */
|
|
@@ -608,8 +813,25 @@ export interface RevokeAppRoleRequest {
|
|
|
608
813
|
}
|
|
609
814
|
|
|
610
815
|
export interface RevokeAppRoleResponse {
|
|
611
|
-
/** False when the person held no such grant. */
|
|
816
|
+
/** False when the person held no such grant, or the revocation waits for approval (`pending`). */
|
|
612
817
|
revoked: boolean
|
|
818
|
+
/** The grant request, when the application's grants wait for approval (ADR-0083). */
|
|
819
|
+
pending?: GrantRequestDto
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* The installation's client logo on fabrika's own pages (ADR-0066): IAM's sign-in, account and invitation pages, and the
|
|
824
|
+
* proxy's error pages on every application host. `null` shows the fabrika mark. An installation serves one client, so
|
|
825
|
+
* this is one setting of the installation, kept by IAM.
|
|
826
|
+
*/
|
|
827
|
+
export interface InstallationBrandDto {
|
|
828
|
+
brand: InstallationBrand | null
|
|
829
|
+
/** When it was last set or cleared, in epoch seconds; null when it never was. */
|
|
830
|
+
updatedAt: number | null
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export interface SetInstallationBrandRequest {
|
|
834
|
+
brand: InstallationBrand
|
|
613
835
|
}
|
|
614
836
|
|
|
615
837
|
export interface IamAdminRpcContract {
|
|
@@ -630,7 +852,7 @@ export interface IamAdminRpcContract {
|
|
|
630
852
|
* derived from it — a child is only valid while its parent is — so this is one call, not a sweep.
|
|
631
853
|
*/
|
|
632
854
|
sessions: {
|
|
633
|
-
list: RpcProcedure<ListSessionsInput,
|
|
855
|
+
list: RpcProcedure<ListSessionsInput, SessionList>
|
|
634
856
|
revoke: RpcProcedure<SessionIdInput, RevokedSessionsResponse>
|
|
635
857
|
revokeAll: RpcProcedure<PrincipalIdInput, RevokedSessionsResponse>
|
|
636
858
|
}
|
|
@@ -639,10 +861,36 @@ export interface IamAdminRpcContract {
|
|
|
639
861
|
issueReset: RpcProcedure<PrincipalIdInput, PasswordActionDelivery>
|
|
640
862
|
disable: RpcProcedure<PrincipalIdInput, OkResponse>
|
|
641
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* At an application whose grants wait for approval (ADR-0083), each change runs its checks and answers `pending`
|
|
866
|
+
* with a grant request instead of changing anything.
|
|
867
|
+
*/
|
|
642
868
|
grants: {
|
|
643
869
|
/** A role grant the principal already holds — same role, scope and app — answers 409 naming it. */
|
|
644
|
-
create: RpcProcedure<CreateGrantRequest,
|
|
645
|
-
|
|
870
|
+
create: RpcProcedure<CreateGrantRequest, GrantChangeResponse>
|
|
871
|
+
update: RpcProcedure<UpdateGrantInput, GrantChangeResponse>
|
|
872
|
+
delete: RpcProcedure<GrantIdInput, OkResponse & Partial<PendingGrantChange>>
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* The open grant requests at the applications the caller administers, and their decision: an administrator of the
|
|
876
|
+
* application, a person in a signed-in session, approves another's request, and approving makes the change with the
|
|
877
|
+
* approver's own checks. The requester may reject (withdraw) their own.
|
|
878
|
+
*/
|
|
879
|
+
grantRequests: {
|
|
880
|
+
list: RpcProcedure<ListGrantRequestsInput, ListResponse<GrantRequestDto>>
|
|
881
|
+
decide: RpcProcedure<DecideGrantRequestInput, GrantRequestDto>
|
|
882
|
+
}
|
|
883
|
+
/** Whether an application's console grants wait: an installation administrator's (`iam.admin`), which Control holds. */
|
|
884
|
+
grantApproval: {
|
|
885
|
+
set: RpcProcedure<SetGrantApprovalRequest, SetGrantApprovalRequest>
|
|
886
|
+
}
|
|
887
|
+
connections: {
|
|
888
|
+
list: RpcProcedure<ListSessionsInput, CursorList<UserConnectionDto>>
|
|
889
|
+
revoke: RpcProcedure<GrantIdInput, OkResponse>
|
|
890
|
+
}
|
|
891
|
+
/** A dimension's values, asked of the application as the signed-in administrator (ADR-0085 §4). */
|
|
892
|
+
scopeValues: {
|
|
893
|
+
list: RpcProcedure<ListScopeValuesInput, ScopeValuesResult>
|
|
646
894
|
}
|
|
647
895
|
apps: {
|
|
648
896
|
list: RpcProcedure<void, ListResponse<AppDto>>
|
|
@@ -659,8 +907,8 @@ export interface IamAdminRpcContract {
|
|
|
659
907
|
delete: RpcProcedure<PolicyIdInput, OkResponse>
|
|
660
908
|
}
|
|
661
909
|
apiKeys: {
|
|
662
|
-
list: RpcProcedure<ListApiKeysInput, CursorList<
|
|
663
|
-
get: RpcProcedure<ApiKeyIdInput,
|
|
910
|
+
list: RpcProcedure<ListApiKeysInput, CursorList<ApiKeyDetail>>
|
|
911
|
+
get: RpcProcedure<ApiKeyIdInput, GetApiKeyResponse>
|
|
664
912
|
provision: RpcProcedure<ProvisionApiKeyRequest, ProvisionApiKeyResponse>
|
|
665
913
|
rotate: RpcProcedure<RotateApiKeyInput, RotateApiKeyResponse>
|
|
666
914
|
revoke: RpcProcedure<ApiKeyIdInput, OkResponse>
|
|
@@ -681,6 +929,15 @@ export interface IamAdminRpcContract {
|
|
|
681
929
|
list: RpcProcedure<ListAuditInput, CursorList<AuditEventDto>>
|
|
682
930
|
listAuthLog: RpcProcedure<ListAuthLogInput, CursorList<AuthLogDto>>
|
|
683
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* Enrolled terminals. A browser is enrolled at IAM's `/auth/terminals/enroll`, never here. Revoking a terminal ends
|
|
934
|
+
* every session issued on it.
|
|
935
|
+
*/
|
|
936
|
+
terminals: {
|
|
937
|
+
list: RpcProcedure<ListTerminalsInput, CursorList<TerminalDto>>
|
|
938
|
+
setProfile: RpcProcedure<SetTerminalProfileRequest, TerminalDto>
|
|
939
|
+
revoke: RpcProcedure<TerminalIdInput, OkResponse>
|
|
940
|
+
}
|
|
684
941
|
/**
|
|
685
942
|
* An application's own people, administered by whoever holds the application's `members.manage` globally there: no
|
|
686
943
|
* installation admin needed. Each change writes its audit row under the application.
|
|
@@ -691,8 +948,72 @@ export interface IamAdminRpcContract {
|
|
|
691
948
|
grant: RpcProcedure<GrantAppRoleRequest, GrantAppRoleResponse>
|
|
692
949
|
revoke: RpcProcedure<RevokeAppRoleRequest, RevokeAppRoleResponse>
|
|
693
950
|
}
|
|
951
|
+
/**
|
|
952
|
+
* The installation's client logo (ADR-0066), an installation administrator's (`iam.admin`) to read and to change. A
|
|
953
|
+
* change writes `iam.brand.update` in its own transaction. IAM's pages show it on their next render; the proxy's
|
|
954
|
+
* pages once Control republishes their manifests.
|
|
955
|
+
*/
|
|
956
|
+
brand: {
|
|
957
|
+
get: RpcProcedure<void, InstallationBrandDto>
|
|
958
|
+
set: RpcProcedure<SetInstallationBrandRequest, InstallationBrandDto>
|
|
959
|
+
clear: RpcProcedure<void, InstallationBrandDto>
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* The installation's minimum password length (ADR-0020), an installation administrator's (`iam.admin`) to read and to
|
|
963
|
+
* change. A change writes `iam.password_policy.update` in its own transaction and applies to the next password set,
|
|
964
|
+
* reset or chosen at an invitation; stored passwords stay as they are.
|
|
965
|
+
*/
|
|
966
|
+
passwordPolicy: {
|
|
967
|
+
get: RpcProcedure<void, PasswordPolicyDto>
|
|
968
|
+
set: RpcProcedure<SetPasswordPolicyRequest, PasswordPolicyDto>
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* A person's second factor (TOTP), an installation administrator's (`iam.admin`) to read and to reset. The person
|
|
972
|
+
* enrols at IAM's `SECOND_FACTOR_ENROL_PATH`, never here. A reset removes the authenticator and its recovery codes
|
|
973
|
+
* and writes `iam.second_factor.reset`; the next sign-in asks for no code.
|
|
974
|
+
*/
|
|
975
|
+
secondFactor: {
|
|
976
|
+
get: RpcProcedure<PrincipalIdInput, SecondFactorDto>
|
|
977
|
+
reset: RpcProcedure<PrincipalIdInput, SecondFactorDto>
|
|
978
|
+
}
|
|
694
979
|
}
|
|
695
980
|
|
|
696
|
-
|
|
981
|
+
/** Where a signed-in administrator enrols an authenticator app, on IAM's own origin. */
|
|
982
|
+
export const SECOND_FACTOR_ENROL_PATH = '/auth/second-factor/enrol'
|
|
983
|
+
|
|
984
|
+
/** A person's second factor as an installation administrator sees it. */
|
|
985
|
+
export interface SecondFactorDto {
|
|
986
|
+
/** When the person confirmed the authenticator, in epoch seconds; null when none is enrolled. */
|
|
987
|
+
enrolledAt: number | null
|
|
988
|
+
/** Recovery codes not used yet; 0 without an authenticator. */
|
|
989
|
+
recoveryCodesLeft: number
|
|
990
|
+
/** Whether this installation can enrol an authenticator at all: it holds the key that seals the secrets. */
|
|
991
|
+
available: boolean
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
export interface UserConnectionDto {
|
|
995
|
+
id: string
|
|
996
|
+
clientId: string
|
|
997
|
+
app: string
|
|
998
|
+
resource: string
|
|
999
|
+
scopes: string[]
|
|
1000
|
+
createdAt: number
|
|
1001
|
+
expiresAt: number
|
|
1002
|
+
status: 'active' | 'revoked' | 'expired' | 'unavailable'
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
export type {
|
|
1006
|
+
AppActionDef,
|
|
1007
|
+
AppMemberItem,
|
|
1008
|
+
AppSchema,
|
|
1009
|
+
AppScopeDef,
|
|
1010
|
+
DimensionValue,
|
|
1011
|
+
PermissionEntry,
|
|
1012
|
+
PermissionSource,
|
|
1013
|
+
PrincipalAffiliation,
|
|
1014
|
+
PrincipalType,
|
|
1015
|
+
RoleDef,
|
|
1016
|
+
}
|
|
697
1017
|
export * from './access'
|
|
698
1018
|
export * from './oauth'
|
|
1019
|
+
export * from './password-policy'
|