@_mustachio/openauth 0.11.0 → 0.13.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.
- package/dist/esm/adapters/d1/index.js +18 -9
- package/dist/esm/adapters/d1/migrations.js +7 -2
- package/dist/esm/adapters/d1/session-store.js +39 -0
- package/dist/esm/adapters/d1/session.js +2 -2
- package/dist/esm/adapters/durable-object/index.js +4 -0
- package/dist/esm/adapters/durable-object/session-store.js +42 -0
- package/dist/esm/adapters/dynamo/index.js +24 -7
- package/dist/esm/adapters/dynamo/session-store.js +49 -0
- package/dist/esm/adapters/kms/index.js +6 -2
- package/dist/esm/adapters/kv/index.js +6 -2
- package/dist/esm/adapters/memory/index.js +24 -7
- package/dist/esm/adapters/memory/session-store.js +23 -0
- package/dist/esm/adapters/postgres/executor.js +2 -2
- package/dist/esm/adapters/postgres/index.js +33 -10
- package/dist/esm/adapters/postgres/migrations.js +8 -2
- package/dist/esm/adapters/postgres/session-store.js +42 -0
- package/dist/esm/client.js +27 -27
- package/dist/esm/domain/authorize.js +2 -2
- package/dist/esm/domain/callback.js +121 -7
- package/dist/esm/domain/client-auth.js +2 -2
- package/dist/esm/domain/crypto.js +14 -14
- package/dist/esm/domain/discovery.js +2 -2
- package/dist/esm/domain/dpop.js +4 -4
- package/dist/esm/domain/id-token.js +5 -5
- package/dist/esm/domain/jwt.js +4 -4
- package/dist/esm/domain/method-dispatch.js +27 -1
- package/dist/esm/domain/method-route.js +80 -1
- package/dist/esm/domain/par.js +2 -2
- package/dist/esm/domain/pkce.js +2 -2
- package/dist/esm/domain/revoke.js +2 -2
- package/dist/esm/domain/scim/discovery.js +206 -0
- package/dist/esm/domain/scim/filter.js +177 -0
- package/dist/esm/domain/scim/handle.js +338 -0
- package/dist/esm/domain/scim/patch.js +568 -0
- package/dist/esm/domain/scim/resource.js +256 -0
- package/dist/esm/domain/state-envelope.js +2 -2
- package/dist/esm/domain/token.js +5 -5
- package/dist/esm/error.js +8 -8
- package/dist/esm/http/cookies.js +19 -2
- package/dist/esm/http/errors.js +4 -4
- package/dist/esm/http/handlers/authorize.js +3 -19
- package/dist/esm/http/handlers/callback.js +7 -1
- package/dist/esm/http/handlers/metadata.js +2 -2
- package/dist/esm/http/handlers/method-route.js +47 -2
- package/dist/esm/http/handlers/revocation.js +2 -2
- package/dist/esm/http/handlers/scim.js +59 -0
- package/dist/esm/http/middleware/tenant.js +31 -6
- package/dist/esm/http/router.js +3 -0
- package/dist/esm/http/schemas/authorize.js +2 -2
- package/dist/esm/http/schemas/revocation.js +2 -2
- package/dist/esm/http/schemas/token.js +7 -7
- package/dist/esm/index.js +34 -32
- package/dist/esm/methods/oauth2-factory.js +2 -2
- package/dist/esm/methods/password-hash.js +2 -2
- package/dist/esm/methods/providers/index.js +30 -14
- package/dist/esm/methods/saml-sp/acs.js +232 -0
- package/dist/esm/methods/saml-sp/attributes.js +77 -0
- package/dist/esm/methods/saml-sp/authnrequest.js +63 -0
- package/dist/esm/methods/saml-sp/cache-provider.js +33 -0
- package/dist/esm/methods/saml-sp/cert-rotation.js +13 -0
- package/dist/esm/methods/saml-sp/factory.js +81 -0
- package/dist/esm/methods/saml-sp/index.js +7 -0
- package/dist/esm/methods/saml-sp/metadata.js +71 -0
- package/dist/esm/methods/saml-sp/method.js +29 -0
- package/dist/esm/methods/saml-sp/parse-idp-metadata.js +102 -0
- package/dist/esm/methods/saml-sp/saml-instance.js +59 -0
- package/dist/esm/methods/saml-sp/slo-initiate.js +84 -0
- package/dist/esm/methods/saml-sp/sls.js +154 -0
- package/dist/esm/methods/saml-sp/types.js +0 -0
- package/dist/esm/ports/scim-directory.js +0 -0
- package/dist/esm/types/error.js +5 -0
- package/dist/esm/types/result.js +3 -3
- package/dist/esm/types/scim.js +0 -0
- package/dist/esm/ui/forms.js +3 -3
- package/dist/esm/ui/index.js +8 -5
- package/dist/esm/ui/picker.js +2 -2
- package/dist/types/adapters/d1/migrations.d.ts.map +1 -1
- package/dist/types/adapters/d1/session-store.d.ts +3 -0
- package/dist/types/adapters/d1/session-store.d.ts.map +1 -1
- package/dist/types/adapters/durable-object/session-store.d.ts +3 -0
- package/dist/types/adapters/durable-object/session-store.d.ts.map +1 -1
- package/dist/types/adapters/dynamo/session-store.d.ts +3 -0
- package/dist/types/adapters/dynamo/session-store.d.ts.map +1 -1
- package/dist/types/adapters/memory/session-store.d.ts +3 -0
- package/dist/types/adapters/memory/session-store.d.ts.map +1 -1
- package/dist/types/adapters/postgres/migrations.d.ts +1 -1
- package/dist/types/adapters/postgres/migrations.d.ts.map +1 -1
- package/dist/types/adapters/postgres/session-store.d.ts +3 -0
- package/dist/types/adapters/postgres/session-store.d.ts.map +1 -1
- package/dist/types/domain/callback.d.ts +16 -1
- package/dist/types/domain/callback.d.ts.map +1 -1
- package/dist/types/domain/method-dispatch.d.ts.map +1 -1
- package/dist/types/domain/method-route.d.ts +57 -1
- package/dist/types/domain/method-route.d.ts.map +1 -1
- package/dist/types/domain/scim/discovery.d.ts +11 -0
- package/dist/types/domain/scim/discovery.d.ts.map +1 -0
- package/dist/types/domain/scim/filter.d.ts +51 -0
- package/dist/types/domain/scim/filter.d.ts.map +1 -0
- package/dist/types/domain/scim/handle.d.ts +35 -0
- package/dist/types/domain/scim/handle.d.ts.map +1 -0
- package/dist/types/domain/scim/patch.d.ts +73 -0
- package/dist/types/domain/scim/patch.d.ts.map +1 -0
- package/dist/types/domain/scim/resource.d.ts +56 -0
- package/dist/types/domain/scim/resource.d.ts.map +1 -0
- package/dist/types/http/context.d.ts +6 -1
- package/dist/types/http/context.d.ts.map +1 -1
- package/dist/types/http/cookies.d.ts +9 -1
- package/dist/types/http/cookies.d.ts.map +1 -1
- package/dist/types/http/handlers/callback.d.ts.map +1 -1
- package/dist/types/http/handlers/method-route.d.ts.map +1 -1
- package/dist/types/http/handlers/scim.d.ts +3 -0
- package/dist/types/http/handlers/scim.d.ts.map +1 -0
- package/dist/types/http/middleware/tenant.d.ts.map +1 -1
- package/dist/types/http/router.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/methods/saml-sp/acs.d.ts +4 -0
- package/dist/types/methods/saml-sp/acs.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/attributes.d.ts +45 -0
- package/dist/types/methods/saml-sp/attributes.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/authnrequest.d.ts +4 -0
- package/dist/types/methods/saml-sp/authnrequest.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/cache-provider.d.ts +38 -0
- package/dist/types/methods/saml-sp/cache-provider.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/cert-rotation.d.ts +23 -0
- package/dist/types/methods/saml-sp/cert-rotation.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/factory.d.ts +920 -0
- package/dist/types/methods/saml-sp/factory.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/index.d.ts +24 -0
- package/dist/types/methods/saml-sp/index.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/metadata.d.ts +50 -0
- package/dist/types/methods/saml-sp/metadata.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/method.d.ts +17 -0
- package/dist/types/methods/saml-sp/method.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/parse-idp-metadata.d.ts +4 -0
- package/dist/types/methods/saml-sp/parse-idp-metadata.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/saml-instance.d.ts +93 -0
- package/dist/types/methods/saml-sp/saml-instance.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/slo-initiate.d.ts +4 -0
- package/dist/types/methods/saml-sp/slo-initiate.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/sls.d.ts +4 -0
- package/dist/types/methods/saml-sp/sls.d.ts.map +1 -0
- package/dist/types/methods/saml-sp/types.d.ts +299 -0
- package/dist/types/methods/saml-sp/types.d.ts.map +1 -0
- package/dist/types/ports/audit-log.d.ts +18 -5
- package/dist/types/ports/audit-log.d.ts.map +1 -1
- package/dist/types/ports/scim-directory.d.ts +104 -0
- package/dist/types/ports/scim-directory.d.ts.map +1 -0
- package/dist/types/ports/session-store.d.ts +23 -0
- package/dist/types/ports/session-store.d.ts.map +1 -1
- package/dist/types/types/error.d.ts +5 -0
- package/dist/types/types/error.d.ts.map +1 -1
- package/dist/types/types/idp.d.ts +83 -0
- package/dist/types/types/idp.d.ts.map +1 -1
- package/dist/types/types/method.d.ts +109 -0
- package/dist/types/types/method.d.ts.map +1 -1
- package/dist/types/types/scim.d.ts +269 -0
- package/dist/types/types/scim.d.ts.map +1 -0
- package/dist/types/types/tenant.d.ts +10 -0
- package/dist/types/types/tenant.d.ts.map +1 -1
- package/package.json +9 -1
- package/src/adapters/d1/migrations.ts +5 -0
- package/src/adapters/d1/session-store.ts +68 -0
- package/src/adapters/durable-object/session-store.ts +61 -0
- package/src/adapters/dynamo/session-store.ts +63 -0
- package/src/adapters/memory/session-store.ts +39 -0
- package/src/adapters/postgres/migrations.ts +6 -0
- package/src/adapters/postgres/session-store.ts +69 -0
- package/src/domain/callback.ts +215 -7
- package/src/domain/method-dispatch.ts +53 -1
- package/src/domain/method-route.ts +190 -1
- package/src/domain/scim/discovery.ts +262 -0
- package/src/domain/scim/filter.ts +295 -0
- package/src/domain/scim/handle.ts +597 -0
- package/src/domain/scim/patch.ts +807 -0
- package/src/domain/scim/resource.ts +358 -0
- package/src/http/context.ts +9 -0
- package/src/http/cookies.ts +19 -1
- package/src/http/handlers/authorize.ts +2 -22
- package/src/http/handlers/callback.ts +9 -1
- package/src/http/handlers/method-route.ts +72 -2
- package/src/http/handlers/scim.ts +107 -0
- package/src/http/middleware/tenant.ts +47 -1
- package/src/http/router.ts +9 -0
- package/src/index.ts +23 -0
- package/src/methods/saml-sp/acs.ts +449 -0
- package/src/methods/saml-sp/attributes.ts +146 -0
- package/src/methods/saml-sp/authnrequest.ts +129 -0
- package/src/methods/saml-sp/cache-provider.ts +76 -0
- package/src/methods/saml-sp/cert-rotation.ts +34 -0
- package/src/methods/saml-sp/factory.ts +139 -0
- package/src/methods/saml-sp/index.ts +34 -0
- package/src/methods/saml-sp/metadata.ts +215 -0
- package/src/methods/saml-sp/method.ts +65 -0
- package/src/methods/saml-sp/parse-idp-metadata.ts +158 -0
- package/src/methods/saml-sp/saml-instance.ts +210 -0
- package/src/methods/saml-sp/slo-initiate.ts +180 -0
- package/src/methods/saml-sp/sls.ts +307 -0
- package/src/methods/saml-sp/types.ts +298 -0
- package/src/ports/CONSISTENCY.md +52 -24
- package/src/ports/audit-log.ts +18 -5
- package/src/ports/scim-directory.ts +166 -0
- package/src/ports/session-store.ts +24 -0
- package/src/types/error.ts +11 -0
- package/src/types/idp.ts +86 -0
- package/src/types/method.ts +110 -0
- package/src/types/scim.ts +280 -0
- package/src/types/tenant.ts +10 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ScimDirectory` — the host's user directory, as SCIM needs to see it.
|
|
3
|
+
*
|
|
4
|
+
* This is the boundary from `SCIM-AD2`: the library owns the SCIM
|
|
5
|
+
* protocol (routing, bearer auth, schema validation, PATCH
|
|
6
|
+
* normalization, error envelope, pagination, discovery docs) and the
|
|
7
|
+
* host owns every byte of persistence. The library stores no user data.
|
|
8
|
+
*
|
|
9
|
+
* That split is not a compromise — it is the same protocol-over-
|
|
10
|
+
* host-owned-state shape as `ConfigStore`, `MethodStore` and the
|
|
11
|
+
* `success` callback. The host's Users table is the host's.
|
|
12
|
+
*
|
|
13
|
+
* **Consistency:** read-your-writes is required. A SCIM client
|
|
14
|
+
* (notably Okta) will `GET /Users?filter=userName eq "…"` immediately
|
|
15
|
+
* after a `POST /Users` to confirm the create; an eventually-consistent
|
|
16
|
+
* read there produces duplicate users. See `ports/CONSISTENCY.md`.
|
|
17
|
+
*
|
|
18
|
+
* **Errors.** SCIM clients retry `5xx` and give up on `4xx`, so which
|
|
19
|
+
* error you return decides whether a failure is surfaced to an admin or
|
|
20
|
+
* retried forever:
|
|
21
|
+
*
|
|
22
|
+
* - `authError.conflict(...)` → `409 uniqueness`. A collision only you
|
|
23
|
+
* can detect, because only you store the rows.
|
|
24
|
+
* - `authError.invalidRequest(...)` → `400 invalidValue`. A
|
|
25
|
+
* **permanent** rejection — you understood the request and will
|
|
26
|
+
* never accept it. Use it when `addMembers` names a user you do not
|
|
27
|
+
* have (an IdP's group push can reference a member its user push
|
|
28
|
+
* filtered out, or one deleted between operations), or when the data
|
|
29
|
+
* violates a constraint you cannot satisfy.
|
|
30
|
+
* - anything else → `500`, which the client retries. Correct for a
|
|
31
|
+
* transient fault, and far better than reporting a success you did
|
|
32
|
+
* not perform — but returning it for a permanent problem means the
|
|
33
|
+
* IdP retries the same doomed request indefinitely.
|
|
34
|
+
*
|
|
35
|
+
* Your message is passed through on both `4xx` paths; it is what an IdP
|
|
36
|
+
* admin reads in the provisioning log, so make it specific.
|
|
37
|
+
*/
|
|
38
|
+
import type { Result } from "../types/result";
|
|
39
|
+
import type { ScimGroupPatch, ScimGroupQuery, ScimGroupRecord, ScimGroupWrite, ScimPage, ScimUserPatch, ScimUserQuery, ScimUserRecord, ScimUserWrite } from "../types/scim";
|
|
40
|
+
import type { TenantId } from "../types/tenant";
|
|
41
|
+
export type ScimDirectory = {
|
|
42
|
+
/** `null` (not an error) when no user has that id in this tenant. */
|
|
43
|
+
getUser(tenantId: TenantId, id: string): Promise<Result<ScimUserRecord | null>>;
|
|
44
|
+
/**
|
|
45
|
+
* Query users. `query.startIndex` is 1-based and `query.count` is
|
|
46
|
+
* already clamped; `query.totalResults` in the response must be the
|
|
47
|
+
* full match count, not the page length.
|
|
48
|
+
*/
|
|
49
|
+
findUsers(tenantId: TenantId, query: ScimUserQuery): Promise<Result<ScimPage<ScimUserRecord>>>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a user. Return `conflict` if `userName` (or another
|
|
52
|
+
* uniqueness constraint of yours) is already taken — the library
|
|
53
|
+
* cannot check that for you.
|
|
54
|
+
*/
|
|
55
|
+
createUser(tenantId: TenantId, user: ScimUserWrite): Promise<Result<ScimUserRecord>>;
|
|
56
|
+
/**
|
|
57
|
+
* Full replace (`PUT`). Attributes absent from `user` are cleared, per
|
|
58
|
+
* RFC 7644 §3.5.1 — this is a replace, not a merge. Use `patchUser`
|
|
59
|
+
* for partial updates.
|
|
60
|
+
*/
|
|
61
|
+
replaceUser(tenantId: TenantId, id: string, user: ScimUserWrite): Promise<Result<ScimUserRecord>>;
|
|
62
|
+
/**
|
|
63
|
+
* Apply a normalized delta. Present key ⇒ set; absent ⇒ leave alone;
|
|
64
|
+
* `null` ⇒ clear. The library has already resolved SCIM path
|
|
65
|
+
* expressions, so no parsing is needed here.
|
|
66
|
+
*
|
|
67
|
+
* `{ active: false }` is the ordinary deprovisioning signal and is
|
|
68
|
+
* usually the single most important operation to implement correctly.
|
|
69
|
+
*/
|
|
70
|
+
patchUser(tenantId: TenantId, id: string, patch: ScimUserPatch): Promise<Result<ScimUserRecord>>;
|
|
71
|
+
/**
|
|
72
|
+
* Hard delete (`DELETE`). Distinct from deactivation on purpose
|
|
73
|
+
* (`SCIM-AD8`): the library will not quietly turn a destructive
|
|
74
|
+
* request into a soft one. Hosts that do not want cascading deletes
|
|
75
|
+
* should implement this as a tombstone and say so in their runbook —
|
|
76
|
+
* but that decision is theirs to make explicitly, not the library's to
|
|
77
|
+
* make silently.
|
|
78
|
+
*/
|
|
79
|
+
deleteUser(tenantId: TenantId, id: string): Promise<Result<void>>;
|
|
80
|
+
getGroup?(tenantId: TenantId, id: string): Promise<Result<ScimGroupRecord | null>>;
|
|
81
|
+
/**
|
|
82
|
+
* `query.excludeMembers` is set when the client asked for
|
|
83
|
+
* `excludedAttributes=members`. Honour it by not loading membership —
|
|
84
|
+
* Okta sets it while enumerating groups, and ignoring it turns a cheap
|
|
85
|
+
* listing into a fan-out read per group.
|
|
86
|
+
*/
|
|
87
|
+
findGroups?(tenantId: TenantId, query: ScimGroupQuery): Promise<Result<ScimPage<ScimGroupRecord>>>;
|
|
88
|
+
createGroup?(tenantId: TenantId, group: ScimGroupWrite): Promise<Result<ScimGroupRecord>>;
|
|
89
|
+
/** Full replace, including membership. */
|
|
90
|
+
replaceGroup?(tenantId: TenantId, id: string, group: ScimGroupWrite): Promise<Result<ScimGroupRecord>>;
|
|
91
|
+
/**
|
|
92
|
+
* Apply a normalized group delta.
|
|
93
|
+
*
|
|
94
|
+
* Exactly one membership shape arrives at a time: `members` (replace
|
|
95
|
+
* everything) or `addMembers` / `removeMembers` (incremental). The
|
|
96
|
+
* incremental form exists so a 20,000-member group does not have to be
|
|
97
|
+
* read and rewritten to add one person — see `SCIM-AD9`. Adding an
|
|
98
|
+
* existing member or removing an absent one must succeed quietly;
|
|
99
|
+
* IdPs retry and expect idempotence.
|
|
100
|
+
*/
|
|
101
|
+
patchGroup?(tenantId: TenantId, id: string, patch: ScimGroupPatch): Promise<Result<ScimGroupRecord>>;
|
|
102
|
+
deleteGroup?(tenantId: TenantId, id: string): Promise<Result<void>>;
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=scim-directory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scim-directory.d.ts","sourceRoot":"","sources":["../../../src/ports/scim-directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,MAAM,aAAa,GAAG;IAC1B,qEAAqE;IACrE,OAAO,CACL,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,I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E,EAAE,MAAM,EACV,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAA;IAEnC;;;;;;;;;OASG;IACH,UAAU,CAAC,CACT,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAA;IAEnC,WAAW,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;CACpE,CAAA"}
|
|
@@ -80,6 +80,29 @@ export type SessionStore = {
|
|
|
80
80
|
*/
|
|
81
81
|
savePar?(requestUri: string, payload: ParRecord, ttl: number): Promise<Result<void>>;
|
|
82
82
|
consumePar?(requestUri: string): Promise<Result<ParRecord>>;
|
|
83
|
+
/**
|
|
84
|
+
* Optional: per-method-instance scratch storage. Survives across flows
|
|
85
|
+
* (unlike `methodState`, which is per-flow). Use cases include cross-flow
|
|
86
|
+
* deduplication state — e.g., a SAML SP method remembering recently-seen
|
|
87
|
+
* assertion IDs for replay protection.
|
|
88
|
+
*
|
|
89
|
+
* The framework scopes keys per `(tenantId, methodId)` before calling
|
|
90
|
+
* these — adapters see opaque, already-namespaced keys and store the
|
|
91
|
+
* UTF-8 string value verbatim. Methods JSON-encode if they want object
|
|
92
|
+
* state.
|
|
93
|
+
*
|
|
94
|
+
* Strong consistency + TTL respect (same semantics as flow records).
|
|
95
|
+
* `readScratch` returns `unknown_state` if the key is missing or
|
|
96
|
+
* expired. `deleteScratch` is idempotent.
|
|
97
|
+
*
|
|
98
|
+
* Adapters without these methods cannot host methods that depend on
|
|
99
|
+
* scratch; the framework surfaces a clear `unsupported` error through
|
|
100
|
+
* `MethodContext.methodScratch` at call time. Implement all three
|
|
101
|
+
* methods together — partial implementations are not supported.
|
|
102
|
+
*/
|
|
103
|
+
saveScratch?(key: string, value: string, ttlMs: number): Promise<Result<void>>;
|
|
104
|
+
readScratch?(key: string): Promise<Result<string>>;
|
|
105
|
+
deleteScratch?(key: string): Promise<Result<void>>;
|
|
83
106
|
};
|
|
84
107
|
/**
|
|
85
108
|
* Stored PAR payload. The `params` blob is the raw form/query record from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../../src/ports/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;OAKG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,EACnB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAExB;;;;;;;;OAQG;IACH,qBAAqB,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAExB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAErD;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAExD;;;;OAIG;IACH,aAAa,CAAC,CACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IACxB,WAAW,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAA;IAC/D,aAAa,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,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC,CAAA"}
|
|
@@ -64,6 +64,10 @@ export type AuthError = {
|
|
|
64
64
|
code: "internal_error";
|
|
65
65
|
description: string;
|
|
66
66
|
cause?: unknown;
|
|
67
|
+
} | {
|
|
68
|
+
code: "conflict";
|
|
69
|
+
description: string;
|
|
70
|
+
attribute?: string;
|
|
67
71
|
} | {
|
|
68
72
|
code: "invalid_dpop_proof";
|
|
69
73
|
description: string;
|
|
@@ -93,6 +97,7 @@ export declare const authError: {
|
|
|
93
97
|
methodKind?: string;
|
|
94
98
|
}) => AuthError;
|
|
95
99
|
invalidTarget: (description: string) => AuthError;
|
|
100
|
+
conflict: (description: string, attribute?: string) => AuthError;
|
|
96
101
|
internalError: (description: string, cause?: unknown) => AuthError;
|
|
97
102
|
invalidDpopProof: (description: string, replaySignal?: {
|
|
98
103
|
jti: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/types/error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;AACjD;;;;;;GAMG;GACD;IACE,IAAI,EAAE,eAAe,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE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AC,EAAE,MAAM,CAAA;CAAE,GAW7D;IACE,IAAI,EAAE,oBAAoB,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/B,CAAA;AAEL,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;AAE7C,0EAA0E;AAC1E,eAAO,MAAM,SAAS;kCACU,MAAM,UAAU,MAAM,KAAG,SAAS;iCAKnC,MAAM,KAAG,SAAS;gCAKhC,MAAM,gBACL;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KACpE,SAAS;sCAKsB,MAAM,KAAG,SAAS;wCAIhB,MAAM,KAAG,SAAS;gCAI1B,MAAM,KAAG,SAAS;gCAIlB,MAAM,KAAG,SAAS;gCAIlB,MAAM,KAAG,SAAS;+BAInB,MAAM,UAAU,OAAO,KAAG,SAAS;kCAKhC,MAAM,YAAY,MAAM,KAAG,SAAS;kCAMnD,MAAM,QACb;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,KAC/C,SAAS;iCAMiB,MAAM,KAAG,SAAS;4BAIvB,MAAM,cAAc,MAAM,KAAG,SAAS;iCAKjC,MAAM,UAAU,OAAO,KAAG,SAAS;oCAMjD,MAAM,iBACJ;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAC7B,SAAS;CAKb,CAAA"}
|
|
@@ -7,6 +7,7 @@ import type { AuditLog } from "../ports/audit-log";
|
|
|
7
7
|
import type { ConfigStore } from "../ports/config-store";
|
|
8
8
|
import type { KeyStore } from "../ports/key-store";
|
|
9
9
|
import type { MethodStore } from "../ports/method-store";
|
|
10
|
+
import type { ScimDirectory } from "../ports/scim-directory";
|
|
10
11
|
import type { SessionStore } from "../ports/session-store";
|
|
11
12
|
import type { TokenStore } from "../ports/token-store";
|
|
12
13
|
import type { AuthError } from "./error";
|
|
@@ -58,6 +59,56 @@ export type FailureEvent = {
|
|
|
58
59
|
flowId?: string;
|
|
59
60
|
error: AuthError;
|
|
60
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Input to the optional `IdPOptions.onLogout` hook.
|
|
64
|
+
*
|
|
65
|
+
* Fires when an upstream provider notifies this IdP that a federated
|
|
66
|
+
* session has ended — today, a SAML front-channel `LogoutRequest`
|
|
67
|
+
* delivered to the SP's SLS endpoint. By the time this runs the library
|
|
68
|
+
* has already cryptographically verified the upstream logout message
|
|
69
|
+
* (XML-DSig via the SAML method), so the hook is purely the host's
|
|
70
|
+
* teardown point.
|
|
71
|
+
*
|
|
72
|
+
* The library deliberately does **not** know which OIDC `subject` an
|
|
73
|
+
* upstream identifier (`nameId`) maps to — that mapping lives in the
|
|
74
|
+
* host's `success` callback, not the library. So the host clears its
|
|
75
|
+
* own session and returns the subject (if any) whose library-issued
|
|
76
|
+
* tokens should be revoked; the library then runs the same
|
|
77
|
+
* `revokeAllForSubject` primitive `/end_session` uses. Returning
|
|
78
|
+
* nothing skips library-side revocation (the host handled everything,
|
|
79
|
+
* or there is nothing to revoke).
|
|
80
|
+
*
|
|
81
|
+
* Method-agnostic on purpose: any federation method that can verify an
|
|
82
|
+
* upstream logout signal reuses this. SAML SLO is the first caller;
|
|
83
|
+
* OIDC back-channel logout would be the next.
|
|
84
|
+
*/
|
|
85
|
+
export type LogoutEventInput = {
|
|
86
|
+
tenant: TenantContext;
|
|
87
|
+
methodId: string;
|
|
88
|
+
methodKind: string;
|
|
89
|
+
/** What kind of upstream logout this is. Extensible discriminant. */
|
|
90
|
+
reason: "upstream_slo";
|
|
91
|
+
/**
|
|
92
|
+
* Upstream subject identifier from the verified logout message
|
|
93
|
+
* (SAML `LogoutRequest/NameID`). Absent if the message omitted it.
|
|
94
|
+
*/
|
|
95
|
+
nameId?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Upstream session index from the verified logout message
|
|
98
|
+
* (SAML `SessionIndex`), when present. Lets a host that tracks
|
|
99
|
+
* per-session state scope its teardown.
|
|
100
|
+
*/
|
|
101
|
+
sessionIndex?: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Return of `IdPOptions.onLogout`. `revokeSubject` names the OIDC
|
|
105
|
+
* subject whose library-issued refresh tokens the library should
|
|
106
|
+
* revoke (the host resolves it from `nameId` — only the host has that
|
|
107
|
+
* map). Omit / return nothing to skip library-side revocation.
|
|
108
|
+
*/
|
|
109
|
+
export type LogoutHookResult = {
|
|
110
|
+
revokeSubject?: string;
|
|
111
|
+
} | void;
|
|
61
112
|
/**
|
|
62
113
|
* Optional hook called at `/token` time, after PKCE has succeeded and
|
|
63
114
|
* after the `success` callback has produced a `SubjectClaim`, but
|
|
@@ -204,6 +255,17 @@ export type IdPOptions = {
|
|
|
204
255
|
auditLog?: AuditLog;
|
|
205
256
|
/** Optional — falls back to `ConfigStore` for `MethodConfig` lookups. */
|
|
206
257
|
methodStore?: MethodStore;
|
|
258
|
+
/**
|
|
259
|
+
* The host's user directory, as SCIM needs to see it. Supply it to
|
|
260
|
+
* serve `/scim/v2/*`; omit it and those routes answer 501 regardless
|
|
261
|
+
* of per-tenant config.
|
|
262
|
+
*
|
|
263
|
+
* The library owns the SCIM protocol and stores no user data — every
|
|
264
|
+
* read and write goes through this port to the host's own tables. See
|
|
265
|
+
* `SCIM-AD2` in `docs/plans/claude/scim-plan.md` and
|
|
266
|
+
* `INTEGRATION.md` § SCIM.
|
|
267
|
+
*/
|
|
268
|
+
scimDirectory?: ScimDirectory;
|
|
207
269
|
/** Issuer URL. Function form lets multi-tenant deployments derive it per request. */
|
|
208
270
|
issuerUrl: string | ((req: Request) => string);
|
|
209
271
|
/**
|
|
@@ -226,6 +288,27 @@ export type IdPOptions = {
|
|
|
226
288
|
onSuccess?: (event: SuccessEvent) => Promise<void>;
|
|
227
289
|
onFailure?: (event: FailureEvent) => Promise<void>;
|
|
228
290
|
};
|
|
291
|
+
/**
|
|
292
|
+
* Optional hook fired when an upstream provider signals that a
|
|
293
|
+
* federated session ended — SAML front-channel Single Logout today.
|
|
294
|
+
* The library has already verified the signed logout message; this
|
|
295
|
+
* hook is where the host tears down its own session and names the
|
|
296
|
+
* OIDC subject (if any) whose library-issued tokens to revoke. See
|
|
297
|
+
* the `LogoutEventInput` / `LogoutHookResult` type docs.
|
|
298
|
+
*
|
|
299
|
+
* Unlike `hooks.onSuccess`/`onFailure` (observation only) this hook
|
|
300
|
+
* **influences** library behaviour — its return drives token
|
|
301
|
+
* revocation — so it sits at the top level alongside `success`.
|
|
302
|
+
*
|
|
303
|
+
* Absent ⇒ the library still verifies the logout, emits a
|
|
304
|
+
* `session_logout` audit event, and returns the protocol
|
|
305
|
+
* `LogoutResponse`, but performs no token revocation (it cannot map
|
|
306
|
+
* the upstream id to a subject without the host).
|
|
307
|
+
*
|
|
308
|
+
* If it throws, the SLS endpoint fails closed with an internal error
|
|
309
|
+
* rather than acknowledging a logout it could not fully process.
|
|
310
|
+
*/
|
|
311
|
+
onLogout?: (input: LogoutEventInput) => Promise<LogoutHookResult> | LogoutHookResult;
|
|
229
312
|
/**
|
|
230
313
|
* Optional escape hatch for high-sensitivity deployments — see the
|
|
231
314
|
* `PersistUpstreamTokens` type doc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idp.d.ts","sourceRoot":"","sources":["../../../src/types/idp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,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C,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC9C,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1C,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC7C,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACzC,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC9C,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC3C,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/C,oCAAoC;IACpC,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/C,8CAA8C;IAC9C,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACxC,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CAC9C,CAAA"}
|
|
@@ -54,6 +54,37 @@ export type AuthMethod<P = unknown, S = unknown> = {
|
|
|
54
54
|
* same factory get distinct URL spaces).
|
|
55
55
|
*/
|
|
56
56
|
routes: Record<string, MethodHandler<P, S>>;
|
|
57
|
+
/**
|
|
58
|
+
* Opt-in allowlist of route keys (same `"GET /metadata"` string form
|
|
59
|
+
* as `routes` keys) that the framework dispatches **without** a flow
|
|
60
|
+
* cookie or flow record — anonymous, unauthenticated GETs. The sole
|
|
61
|
+
* intended use is publishing static, per-instance descriptive
|
|
62
|
+
* documents (SAML SP metadata XML). The handler receives
|
|
63
|
+
* `ctx.flow === null` and `ctx.methodState === null` and MUST be a
|
|
64
|
+
* pure function of `ctx.tenant` + `ctx.dispatch` + its captured
|
|
65
|
+
* config — it must not assume an authenticated principal.
|
|
66
|
+
*
|
|
67
|
+
* Absent (the default for every method) ⇒ behaviour is unchanged:
|
|
68
|
+
* every `/m/<id>/*` request requires the `idp.flow` cookie. The
|
|
69
|
+
* cookie gate is skipped *only* for a route key a method explicitly
|
|
70
|
+
* lists here — fail-closed by construction.
|
|
71
|
+
*/
|
|
72
|
+
publicRoutes?: ReadonlyArray<string>;
|
|
73
|
+
/**
|
|
74
|
+
* Opt-in: this method instance handles **unsolicited** upstream
|
|
75
|
+
* callbacks — a `POST /cb/<methodId>` carrying a provider assertion
|
|
76
|
+
* with no framework state envelope and no prior flow (SAML
|
|
77
|
+
* IdP-initiated SSO). When `true`, the framework, instead of
|
|
78
|
+
* rejecting a stateless callback, dispatches `GET /callback` with
|
|
79
|
+
* `flow === null` and a derived `dispatch` (issuer/ACS); the handler
|
|
80
|
+
* verifies the assertion and returns `success` **with
|
|
81
|
+
* `unsolicitedBinding`**. Absent (every method's default) ⇒ a
|
|
82
|
+
* stateless callback stays an `invalid_request` (the conservative
|
|
83
|
+
* default — many deployments do not want IdP-initiated). General
|
|
84
|
+
* capability, not SAML-specific; set per instance (a SAML instance
|
|
85
|
+
* sets it only when its config enables IdP-initiated).
|
|
86
|
+
*/
|
|
87
|
+
unsolicitedCallback?: boolean;
|
|
57
88
|
/**
|
|
58
89
|
* Token-exchange function for the `/token` endpoint when the method
|
|
59
90
|
* participates in client-credentials-style flows (e.g. `m2m`). Most
|
|
@@ -96,6 +127,46 @@ export type MethodContext<S = unknown> = {
|
|
|
96
127
|
* and the relevant data is on `flow`).
|
|
97
128
|
*/
|
|
98
129
|
dispatch: MethodDispatchData | null;
|
|
130
|
+
/**
|
|
131
|
+
* Per-method-instance scratch storage scoped to
|
|
132
|
+
* `(tenant.id, method.id)`. Survives across flows — distinct from
|
|
133
|
+
* `methodState`, which is per-flow.
|
|
134
|
+
*
|
|
135
|
+
* Most methods do NOT need this. It exists for cross-flow
|
|
136
|
+
* deduplication patterns such as SAML SP assertion-ID replay
|
|
137
|
+
* protection.
|
|
138
|
+
*
|
|
139
|
+
* Backed by `SessionStore.{saveScratch,readScratch,deleteScratch}`
|
|
140
|
+
* when those optional methods are implemented. Against adapters that
|
|
141
|
+
* don't implement them, every call returns
|
|
142
|
+
* `{ ok: false, error: unsupported }` — the method should surface a
|
|
143
|
+
* `MethodResult.error` with a clear message, not silently degrade.
|
|
144
|
+
*/
|
|
145
|
+
methodScratch: MethodScratch;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Caller-facing API for per-method-instance scratch. The framework
|
|
149
|
+
* scopes user-supplied keys with a `(tenantId, methodId)` prefix before
|
|
150
|
+
* delegating to `SessionStore` — adapters never see raw method keys.
|
|
151
|
+
*
|
|
152
|
+
* Values are UTF-8 strings; methods JSON-encode if they want to stash
|
|
153
|
+
* objects. Keeping the port-level type narrow simplifies adapter
|
|
154
|
+
* implementations (one TEXT column, one Dynamo `S` attribute, etc.).
|
|
155
|
+
*/
|
|
156
|
+
export type MethodScratch = {
|
|
157
|
+
/**
|
|
158
|
+
* Persist `value` under `key` with the given TTL. Overwrites prior
|
|
159
|
+
* value for the same key. `ttlMs` must be positive.
|
|
160
|
+
*/
|
|
161
|
+
put(key: string, value: string, ttlMs: number): Promise<Result<void>>;
|
|
162
|
+
/**
|
|
163
|
+
* Read the value previously stored at `key`. Returns `unknown_state`
|
|
164
|
+
* if the key is missing or expired (the underlying adapter MAY
|
|
165
|
+
* lazily evict expired entries on read).
|
|
166
|
+
*/
|
|
167
|
+
get(key: string): Promise<Result<string>>;
|
|
168
|
+
/** Idempotent. Resolves `ok` whether the key existed or not. */
|
|
169
|
+
delete(key: string): Promise<Result<void>>;
|
|
99
170
|
};
|
|
100
171
|
/** Framework-supplied data available to the method at `/authorize` time. */
|
|
101
172
|
export type MethodDispatchData = {
|
|
@@ -135,6 +206,27 @@ export type MethodResult<P = unknown, S = unknown> =
|
|
|
135
206
|
saveMethodState?: S;
|
|
136
207
|
/** Serialized into a `Cache-Control` header by the framework. */
|
|
137
208
|
cache?: CachePolicy;
|
|
209
|
+
/**
|
|
210
|
+
* Verified upstream-logout notification. Set **only** by a
|
|
211
|
+
* flowless **public** logout route (e.g. SAML front-channel SLS)
|
|
212
|
+
* once it has cryptographically verified the inbound logout
|
|
213
|
+
* message. The method stays port-free — it proves authenticity
|
|
214
|
+
* and builds the protocol response (`response` = the signed
|
|
215
|
+
* `LogoutResponse` redirect / ack); the privileged side effect
|
|
216
|
+
* runs in the framework.
|
|
217
|
+
*
|
|
218
|
+
* When present on a public route the framework fires
|
|
219
|
+
* `IdPOptions.onLogout` and, if that returns `{ revokeSubject }`,
|
|
220
|
+
* runs `revokeAllForSubject` — then returns `response`. Ignored
|
|
221
|
+
* on non-public (flow-bearing) routes: an authenticated method
|
|
222
|
+
* route never logs anyone out. Mirrors the Phase 2 V′ pattern
|
|
223
|
+
* (`success.unsolicitedBinding`): an optional field on an
|
|
224
|
+
* existing variant, not a new `MethodResult` kind.
|
|
225
|
+
*/
|
|
226
|
+
logout?: {
|
|
227
|
+
nameId?: string;
|
|
228
|
+
sessionIndex?: string;
|
|
229
|
+
};
|
|
138
230
|
}
|
|
139
231
|
/**
|
|
140
232
|
* Authentication succeeded. The HTTP layer hands `providerSubject` +
|
|
@@ -147,6 +239,23 @@ export type MethodResult<P = unknown, S = unknown> =
|
|
|
147
239
|
providerSubject: string;
|
|
148
240
|
properties: P;
|
|
149
241
|
setCookies?: SetCookie[];
|
|
242
|
+
/**
|
|
243
|
+
* RP binding for a **flowless** (unsolicited / IdP-initiated)
|
|
244
|
+
* authentication. Consulted **only** when the method ran with no
|
|
245
|
+
* `flow` (e.g. an unsolicited SAML Response — see
|
|
246
|
+
* `AuthMethod.unsolicitedCallback`). On the normal SP-initiated
|
|
247
|
+
* path a `flow` exists and this is ignored; on the flowless path
|
|
248
|
+
* it is **required** (the framework has no pending RP request to
|
|
249
|
+
* read `client_id` / `redirect_uri` / `scope` from, so the method
|
|
250
|
+
* supplies the operator-configured defaults). The framework still
|
|
251
|
+
* validates `clientId` / `redirectUri` against the tenant's
|
|
252
|
+
* registered client before issuing a code.
|
|
253
|
+
*/
|
|
254
|
+
unsolicitedBinding?: {
|
|
255
|
+
clientId: string;
|
|
256
|
+
redirectUri: string;
|
|
257
|
+
scopes: string[];
|
|
258
|
+
};
|
|
150
259
|
}
|
|
151
260
|
/** User refused / failed auth in a non-error way (e.g. consent declined). */
|
|
152
261
|
| {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../src/types/method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnE;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,IAAI;IACjD;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC3C;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CACrB,CAAA;AAED,MAAM,MA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