@aooth/auth-moost 0.2.0 → 0.2.2
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/atscript/index.d.mts +30 -33
- package/dist/atscript/index.mjs +1 -2
- package/dist/forms-C_VNxSDn.mjs +473 -0
- package/dist/index.d.mts +126 -134
- package/dist/index.mjs +156 -97
- package/package.json +24 -24
- package/src/atscript/models/forms.as.d.ts +1 -1
- package/dist/forms-C9Wey0e9.mjs +0 -484
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,6 @@ import { MoostWf, WfOutlet, WfOutletTokenConfig, WfStateStrategy } from "@moostj
|
|
|
9
9
|
import { FederatedLoginService, NormalizedProfile, OAuthProviderRegistry } from "@aooth/idp";
|
|
10
10
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
11
11
|
import { AuthCodeStore, AuthorizationServerMetadata, AuthorizationServerMetadata as AuthorizationServerMetadata$1, BuildAuthorizationServerMetadataOptions, BuildProtectedResourceMetadataOptions, ClientRedirectPolicy, DynamicClientRegistration, DynamicClientRegistration as DynamicClientRegistration$1, DynamicClientRegistrationOptions, IdTokenSigner, OidcClaimsResolver, PendingAuthorizationStore, ProtectedResourceMetadata, WwwAuthenticateBearerChallengeOptions, buildAuthorizationServerMetadata, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer } from "@aooth/auth/authz";
|
|
12
|
-
//#region src/auth.config.d.ts
|
|
13
12
|
/** Resolved cookie attributes. Same shape is used for both access + refresh. */
|
|
14
13
|
interface ResolvedAuthCookieConfig {
|
|
15
14
|
name: string;
|
|
@@ -67,8 +66,6 @@ interface ResolvedAuthOptions {
|
|
|
67
66
|
enableBearer: boolean;
|
|
68
67
|
exposeTokensInBody: boolean;
|
|
69
68
|
}
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/consent.store.d.ts
|
|
72
69
|
/**
|
|
73
70
|
* Consent event emitted to the `ConsentStore.save(username, events)` DI
|
|
74
71
|
* provider. Storage shape is intentionally the consumer's call — Mongo users
|
|
@@ -133,7 +130,7 @@ interface ConsentDescriptor {
|
|
|
133
130
|
* no-op defaults — customers extend this class and replace via
|
|
134
131
|
* `createReplaceRegistry([ConsentStore, MyConsentStore])`.
|
|
135
132
|
*/
|
|
136
|
-
declare class ConsentStore {
|
|
133
|
+
export declare class ConsentStore {
|
|
137
134
|
/**
|
|
138
135
|
* Returns descriptors for general-purpose consents this user still needs to
|
|
139
136
|
* accept on the next prompt boundary — terms / privacy / marketing / age /
|
|
@@ -170,8 +167,6 @@ declare class ConsentStore {
|
|
|
170
167
|
*/
|
|
171
168
|
recordOtpChannelConsent(_username: string, _channel: "email" | "sms", _target: string, _disclosure: string): Promise<void>;
|
|
172
169
|
}
|
|
173
|
-
//#endregion
|
|
174
|
-
//#region src/auth.guard.d.ts
|
|
175
170
|
/**
|
|
176
171
|
* `GUARD`-priority interceptor factory that authenticates incoming requests.
|
|
177
172
|
*
|
|
@@ -193,29 +188,25 @@ declare class ConsentStore {
|
|
|
193
188
|
* an admin-only invite endpoint protects its outlet HTTP route, not the
|
|
194
189
|
* step handler).
|
|
195
190
|
*/
|
|
196
|
-
declare function authGuardInterceptor(opts?: AuthOptions): TInterceptorDef;
|
|
191
|
+
export declare function authGuardInterceptor(opts?: AuthOptions): TInterceptorDef;
|
|
197
192
|
/**
|
|
198
193
|
* Decorator-factory sugar for attaching `authGuardInterceptor(opts)` to a
|
|
199
194
|
* specific controller or method instead of globally. Equivalent to
|
|
200
195
|
* `@Intercept(authGuardInterceptor(opts))`.
|
|
201
196
|
*/
|
|
202
|
-
declare function AuthGuarded(opts?: AuthOptions): ClassDecorator & MethodDecorator;
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region ../../node_modules/.pnpm/@wooksjs+event-wf@0.7.31_@prostojs+logger@0.4.3_@wooksjs+event-core@0.7.31_@wooksjs+eve_e8aba0a16501b60af733b247c57b6e07/node_modules/@wooksjs/event-wf/dist/index.d.ts
|
|
197
|
+
export declare function AuthGuarded(opts?: AuthOptions): ClassDecorator & MethodDecorator;
|
|
205
198
|
interface WfFinishedResponse {
|
|
206
199
|
type: 'redirect' | 'data';
|
|
207
200
|
/** Redirect URL or response body */
|
|
208
201
|
value: unknown;
|
|
209
202
|
/** HTTP status code (default 200 for data, 302 for redirect) */
|
|
210
203
|
status?: number;
|
|
211
|
-
/** Cookies to set */
|
|
204
|
+
/** Cookies to set — `options` are `setCookie()` attributes (`maxAge` in **seconds**, `expires` a Date or ms timestamp) */
|
|
212
205
|
cookies?: Record<string, {
|
|
213
206
|
value: string;
|
|
214
207
|
options?: Record<string, unknown>;
|
|
215
208
|
}>;
|
|
216
209
|
}
|
|
217
|
-
//#endregion
|
|
218
|
-
//#region src/auth.dto.d.ts
|
|
219
210
|
/** POST /auth/refresh request body. Falls back to the refresh cookie when absent. */
|
|
220
211
|
interface AuthRefreshBody {
|
|
221
212
|
refreshToken?: string;
|
|
@@ -249,8 +240,6 @@ interface AuthLoginResponse {
|
|
|
249
240
|
interface AuthOkResponse {
|
|
250
241
|
ok: true;
|
|
251
242
|
}
|
|
252
|
-
//#endregion
|
|
253
|
-
//#region src/auth.composables.d.ts
|
|
254
243
|
interface AuthBindings {
|
|
255
244
|
getAuthContext<TPayload extends object = Record<string, unknown>>(): AuthContext$1<TPayload> | null;
|
|
256
245
|
/** @throws `HttpError(401)` if no `AuthContext` is present in the event. */
|
|
@@ -306,9 +295,7 @@ interface AuthBindings {
|
|
|
306
295
|
* `HttpError(500)` loudly — that's a configuration error, not a runtime
|
|
307
296
|
* fallback case.
|
|
308
297
|
*/
|
|
309
|
-
declare const useAuth: import("@wooksjs/event-core").WookComposable<AuthBindings>;
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/auth.decorator.d.ts
|
|
298
|
+
export declare const useAuth: import("@wooksjs/event-core").WookComposable<AuthBindings>;
|
|
312
299
|
/**
|
|
313
300
|
* Marks a route or controller as fully public — opts out of BOTH
|
|
314
301
|
* authentication (auth-moost's bearer guard) AND authorization
|
|
@@ -321,7 +308,7 @@ declare const useAuth: import("@wooksjs/event-core").WookComposable<AuthBindings
|
|
|
321
308
|
*
|
|
322
309
|
* Method-level decoration overrides class-level.
|
|
323
310
|
*/
|
|
324
|
-
declare const Public: () => ClassDecorator & MethodDecorator;
|
|
311
|
+
export declare const Public: () => ClassDecorator & MethodDecorator;
|
|
325
312
|
/**
|
|
326
313
|
* Resolves the authenticated user's id (string) for a handler parameter.
|
|
327
314
|
*
|
|
@@ -330,9 +317,7 @@ declare const Public: () => ClassDecorator & MethodDecorator;
|
|
|
330
317
|
* `AuthContext` is credential context, not user profile data, and this library
|
|
331
318
|
* does not own a user profile type.
|
|
332
319
|
*/
|
|
333
|
-
declare const UserId: () => ParameterDecorator & PropertyDecorator;
|
|
334
|
-
//#endregion
|
|
335
|
-
//#region src/auth.mate.d.ts
|
|
320
|
+
export declare const UserId: () => ParameterDecorator & PropertyDecorator;
|
|
336
321
|
/**
|
|
337
322
|
* Auth metadata fields written by `@Public()` and read by `authGuardInterceptor`.
|
|
338
323
|
* Merged into `TMoostMetadata` so other moost-aware tooling sees them.
|
|
@@ -348,9 +333,7 @@ type AuthMate = Mate<TMoostMetadata & {
|
|
|
348
333
|
}, TMoostMetadata & {
|
|
349
334
|
params: TMateParamMeta[];
|
|
350
335
|
}>;
|
|
351
|
-
declare function getAuthMate(): AuthMate;
|
|
352
|
-
//#endregion
|
|
353
|
-
//#region src/workflow/auth-messages.d.ts
|
|
336
|
+
export declare function getAuthMate(): AuthMate;
|
|
354
337
|
/**
|
|
355
338
|
* Code-keyed catalogue of every user-facing text `AuthWorkflow` produces —
|
|
356
339
|
* form errors, banners, finish envelopes and button labels. Templates are
|
|
@@ -360,12 +343,13 @@ declare function getAuthMate(): AuthMate;
|
|
|
360
343
|
* function that receives the code and params and returns the text — e.g. a
|
|
361
344
|
* lookup in your own i18n library), or override `AuthWorkflow.msg()`.
|
|
362
345
|
*/
|
|
363
|
-
declare const AOOTH_MESSAGES: {
|
|
346
|
+
export declare const AOOTH_MESSAGES: {
|
|
364
347
|
readonly INVALID_CREDENTIALS: "Invalid credentials";
|
|
365
348
|
readonly ACCOUNT_LOCKED: "Account locked, please try again later";
|
|
366
349
|
readonly INVALID_PASSWORD: "Invalid password";
|
|
367
350
|
readonly INCORRECT_PASSWORD: "Incorrect password";
|
|
368
351
|
readonly SESSION_LIMIT_REACHED: "Session limit reached";
|
|
352
|
+
readonly PASSWORD_CHANGED_SIGN_IN_AGAIN: "Your password was changed. Please sign in again.";
|
|
369
353
|
readonly INVALID_CODE: "Invalid code";
|
|
370
354
|
/** Params: `seconds`. */
|
|
371
355
|
readonly RESEND_WAIT: "Please wait {seconds}s before requesting a new code.";
|
|
@@ -420,26 +404,24 @@ type AoothMessageParams = Readonly<Record<string, string | number>>;
|
|
|
420
404
|
*/
|
|
421
405
|
type AoothMessages = Partial<Record<AoothMessageCode, string>> | ((code: AoothMessageCode, params: AoothMessageParams) => string | undefined);
|
|
422
406
|
/** Fill `{name}` placeholders from `params`; unknown placeholders are kept. */
|
|
423
|
-
declare function renderAoothMessage(template: string, params?: AoothMessageParams): string;
|
|
407
|
+
export declare function renderAoothMessage(template: string, params?: AoothMessageParams): string;
|
|
424
408
|
/** Resolve `code` through `messages` (when given), falling back to the English template. */
|
|
425
|
-
declare function resolveAoothMessage(code: AoothMessageCode, params?: AoothMessageParams, messages?: AoothMessages): string;
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region src/auth.controller.d.ts
|
|
409
|
+
export declare function resolveAoothMessage(code: AoothMessageCode, params?: AoothMessageParams, messages?: AoothMessages): string;
|
|
428
410
|
/** Workflows allowed by the bundled `/auth/trigger` endpoint. Subclasses override `triggerWf()` to extend. */
|
|
429
|
-
declare const DEFAULT_AUTH_WORKFLOWS: readonly ["auth/login/flow", "auth/invite/start", "auth/recovery/flow", "auth/signup/flow"];
|
|
411
|
+
export declare const DEFAULT_AUTH_WORKFLOWS: readonly ["auth/login/flow", "auth/invite/start", "auth/recovery/flow", "auth/signup/flow"];
|
|
430
412
|
/**
|
|
431
413
|
* Workflow id allowed by the GUARDED `/auth/change-password` trigger.
|
|
432
414
|
* Deliberately NOT in `DEFAULT_AUTH_WORKFLOWS` — the authenticated
|
|
433
415
|
* change-password flow must never be reachable from the public `/auth/trigger`.
|
|
434
416
|
*/
|
|
435
|
-
declare const CHANGE_PASSWORD_WORKFLOW = "auth/change-password/flow";
|
|
417
|
+
export declare const CHANGE_PASSWORD_WORKFLOW = "auth/change-password/flow";
|
|
436
418
|
/**
|
|
437
419
|
* Workflow id allowed by the GUARDED `/auth/add-mfa` trigger — the authenticated
|
|
438
420
|
* "add a second factor" flow. Like {@link CHANGE_PASSWORD_WORKFLOW}, deliberately
|
|
439
421
|
* NOT in `DEFAULT_AUTH_WORKFLOWS`: it must never be reachable from the public
|
|
440
422
|
* `/auth/trigger`.
|
|
441
423
|
*/
|
|
442
|
-
declare const ADD_MFA_WORKFLOW = "auth/add-mfa/flow";
|
|
424
|
+
export declare const ADD_MFA_WORKFLOW = "auth/add-mfa/flow";
|
|
443
425
|
/**
|
|
444
426
|
* Public REST endpoints for credential management. Four endpoints total:
|
|
445
427
|
*
|
|
@@ -457,7 +439,7 @@ declare const ADD_MFA_WORKFLOW = "auth/add-mfa/flow";
|
|
|
457
439
|
* allow-list (override `triggerWf()` with a different `@WfTrigger({ allow })`)
|
|
458
440
|
* or to inject custom outlets / state stores by subclassing `WfTriggerProvider`.
|
|
459
441
|
*/
|
|
460
|
-
declare class AuthController {
|
|
442
|
+
export declare class AuthController {
|
|
461
443
|
protected readonly auth: AuthCredential;
|
|
462
444
|
protected readonly users?: UserService | undefined;
|
|
463
445
|
constructor(auth: AuthCredential, users?: UserService | undefined);
|
|
@@ -539,8 +521,6 @@ declare class AuthController {
|
|
|
539
521
|
messages?: AoothMessages;
|
|
540
522
|
};
|
|
541
523
|
}
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region src/sessions.controller.d.ts
|
|
544
524
|
/**
|
|
545
525
|
* Injectable read-time session enricher. Default is identity — aooth ships NO
|
|
546
526
|
* UA-parser or GeoIP dependency. Consumers who want `device` / `browser` / `os`
|
|
@@ -560,7 +540,7 @@ declare class AuthController {
|
|
|
560
540
|
*
|
|
561
541
|
* Singleton scope is required — `@Injectable()` (no scope arg) → SINGLETON.
|
|
562
542
|
*/
|
|
563
|
-
declare class SessionEnricherProvider {
|
|
543
|
+
export declare class SessionEnricherProvider {
|
|
564
544
|
enrich(session: SessionInfo$1): EnrichedSession$1 | Promise<EnrichedSession$1>;
|
|
565
545
|
}
|
|
566
546
|
/**
|
|
@@ -586,7 +566,7 @@ declare class SessionEnricherProvider {
|
|
|
586
566
|
* NOT `@Public()` — the auth guard rejects unauthenticated callers with 401 and
|
|
587
567
|
* ARBAC gates each action; a customer enables it with `allow("auth.sessions", "*")`.
|
|
588
568
|
*/
|
|
589
|
-
declare class SessionsController {
|
|
569
|
+
export declare class SessionsController {
|
|
590
570
|
protected readonly auth: AuthCredential;
|
|
591
571
|
protected readonly enricher: SessionEnricherProvider;
|
|
592
572
|
constructor(auth: AuthCredential, enricher: SessionEnricherProvider);
|
|
@@ -610,8 +590,6 @@ declare class SessionsController {
|
|
|
610
590
|
revoked: number;
|
|
611
591
|
}>;
|
|
612
592
|
}
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/wf-trigger/decorator.d.ts
|
|
615
593
|
interface WfTriggerOpts {
|
|
616
594
|
/**
|
|
617
595
|
* Workflow ids this trigger may START and RESUME (a leading `/` is ignored).
|
|
@@ -634,9 +612,7 @@ interface WfTriggerOpts {
|
|
|
634
612
|
* documented escape hatch: interceptors are functions, not classes, so there's
|
|
635
613
|
* no ctor to inject into. Every class still uses constructor injection.
|
|
636
614
|
*/
|
|
637
|
-
declare const WfTrigger: (opts?: WfTriggerOpts) => ClassDecorator & MethodDecorator;
|
|
638
|
-
//#endregion
|
|
639
|
-
//#region src/wf-trigger/provider.d.ts
|
|
615
|
+
export declare const WfTrigger: (opts?: WfTriggerOpts) => ClassDecorator & MethodDecorator;
|
|
640
616
|
/**
|
|
641
617
|
* DI singleton owning the workflow-trigger wiring: state persistence, outlets,
|
|
642
618
|
* and token wire. Consumers subclass to swap the durable state strategy, add
|
|
@@ -696,8 +672,8 @@ type StateRegistry = {
|
|
|
696
672
|
* Deterministic — the same input always yields the same key, so it is stable
|
|
697
673
|
* across restarts (matching what `deriveStateKey` provided).
|
|
698
674
|
*/
|
|
699
|
-
declare function deriveWfStateSecret(secret: string): Buffer;
|
|
700
|
-
declare class WfTriggerProvider {
|
|
675
|
+
export declare function deriveWfStateSecret(secret: string): Buffer;
|
|
676
|
+
export declare class WfTriggerProvider {
|
|
701
677
|
protected readonly wf: MoostWf;
|
|
702
678
|
protected readonly auth: AuthCredential;
|
|
703
679
|
/**
|
|
@@ -737,19 +713,15 @@ declare class WfTriggerProvider {
|
|
|
737
713
|
token?: WfOutletTokenConfig;
|
|
738
714
|
}): Promise<unknown>;
|
|
739
715
|
}
|
|
740
|
-
//#endregion
|
|
741
|
-
//#region src/workflow/invite-outlet.d.ts
|
|
742
716
|
/** Name of the outlet `AuthWorkflow` pauses on for `inviteDelivery: 'deliver' | 'return-link'`. */
|
|
743
|
-
declare const INVITE_OUTLET = "invite";
|
|
717
|
+
export declare const INVITE_OUTLET = "invite";
|
|
744
718
|
/**
|
|
745
719
|
* The `invite` outlet (registered by default on `WfTriggerProvider`): hands
|
|
746
720
|
* the resume token to the callback the `send-email` step registered, which
|
|
747
721
|
* builds the link and delivers it (`'deliver'`) or returns it to the issuer
|
|
748
722
|
* (`'return-link'`). The token never rides the response on its own.
|
|
749
723
|
*/
|
|
750
|
-
declare function createInviteOutlet(): WfOutlet;
|
|
751
|
-
//#endregion
|
|
752
|
-
//#region src/rate-limit/mate.d.ts
|
|
724
|
+
export declare function createInviteOutlet(): WfOutlet;
|
|
753
725
|
/**
|
|
754
726
|
* Caller-identity strategy for a rate-limited route (RL.spec.md §5.3):
|
|
755
727
|
* - `'ip'` — client IP (the public-endpoint mode; honors `trustProxy`).
|
|
@@ -809,9 +781,7 @@ type RateLimitMate = Mate<TMoostMetadata & {
|
|
|
809
781
|
}, TMoostMetadata & {
|
|
810
782
|
params: TMateParamMeta[];
|
|
811
783
|
}>;
|
|
812
|
-
declare function getRateLimitMate(): RateLimitMate;
|
|
813
|
-
//#endregion
|
|
814
|
-
//#region src/rate-limit/interceptor.d.ts
|
|
784
|
+
export declare function getRateLimitMate(): RateLimitMate;
|
|
815
785
|
interface RateLimitInterceptorOptions {
|
|
816
786
|
/**
|
|
817
787
|
* The shared limiter (wire your `RateLimitStoreRedis` here). When omitted,
|
|
@@ -827,7 +797,12 @@ interface RateLimitInterceptorOptions {
|
|
|
827
797
|
rules?: RateLimitRuleInput$1[];
|
|
828
798
|
/** Default key strategy for routes whose `@RateLimit` doesn't set one. Default: `'ip'`. */
|
|
829
799
|
key?: RateLimitKeyStrategy;
|
|
830
|
-
/**
|
|
800
|
+
/**
|
|
801
|
+
* Trust exactly ONE reverse proxy in front of the app: the client IP is the
|
|
802
|
+
* right-most `x-forwarded-for` entry (the one that proxy wrote). Default:
|
|
803
|
+
* `false` — the client IP as the HTTP app resolves it (`useRequest().getIp()`:
|
|
804
|
+
* the socket peer, unless the wooks HTTP app configures `trustProxy`).
|
|
805
|
+
*/
|
|
831
806
|
trustProxy?: boolean;
|
|
832
807
|
/** Emit draft `RateLimit-*` headers on every response of a limited route. Default: `true`. */
|
|
833
808
|
headers?: boolean;
|
|
@@ -866,9 +841,7 @@ interface RateLimitInterceptorOptions {
|
|
|
866
841
|
* the accumulated response (they survive the throw — wooks renders the error
|
|
867
842
|
* onto the same `HttpResponse`), then `HttpError(429, message)` is thrown.
|
|
868
843
|
*/
|
|
869
|
-
declare function rateLimitInterceptors(opts?: RateLimitInterceptorOptions): TInterceptorDef[];
|
|
870
|
-
//#endregion
|
|
871
|
-
//#region src/rate-limit/decorator.d.ts
|
|
844
|
+
export declare function rateLimitInterceptors(opts?: RateLimitInterceptorOptions): TInterceptorDef[];
|
|
872
845
|
/**
|
|
873
846
|
* Declares rate-limit rules for a controller method (or every method of a
|
|
874
847
|
* controller, when applied at class level — method-level metadata replaces
|
|
@@ -890,8 +863,8 @@ declare function rateLimitInterceptors(opts?: RateLimitInterceptorOptions): TInt
|
|
|
890
863
|
* Rules are parsed eagerly, so a bad rule string throws at decoration
|
|
891
864
|
* (boot) time, not per request.
|
|
892
865
|
*/
|
|
893
|
-
declare function RateLimit(disabled: false): ClassDecorator & MethodDecorator;
|
|
894
|
-
declare function RateLimit(...rulesAndOpts: [RateLimitRuleInput$1, ...Array<RateLimitRuleInput$1 | RateLimitDecoratorOptions>]): ClassDecorator & MethodDecorator;
|
|
866
|
+
export declare function RateLimit(disabled: false): ClassDecorator & MethodDecorator;
|
|
867
|
+
export declare function RateLimit(...rulesAndOpts: [RateLimitRuleInput$1, ...Array<RateLimitRuleInput$1 | RateLimitDecoratorOptions>]): ClassDecorator & MethodDecorator;
|
|
895
868
|
/**
|
|
896
869
|
* Decorator-factory sugar for attaching the `rateLimitInterceptors(opts)`
|
|
897
870
|
* PAIR to a specific controller or method instead of globally — the
|
|
@@ -899,9 +872,7 @@ declare function RateLimit(...rulesAndOpts: [RateLimitRuleInput$1, ...Array<Rate
|
|
|
899
872
|
* dropping the pre-guard def loses flood protection for ip-keyed routes,
|
|
900
873
|
* dropping the post-guard def silently disables `key: 'user'` routes.
|
|
901
874
|
*/
|
|
902
|
-
declare function RateLimited(opts?: RateLimitInterceptorOptions): ClassDecorator & MethodDecorator;
|
|
903
|
-
//#endregion
|
|
904
|
-
//#region src/rate-limit/composables.d.ts
|
|
875
|
+
export declare function RateLimited(opts?: RateLimitInterceptorOptions): ClassDecorator & MethodDecorator;
|
|
905
876
|
/**
|
|
906
877
|
* Supply the rate-limit subject for a named key strategy — the seam for
|
|
907
878
|
* custom IAMs / tenant resolvers. Call from GUARD-priority (or earlier)
|
|
@@ -909,9 +880,9 @@ declare function RateLimited(opts?: RateLimitInterceptorOptions): ClassDecorator
|
|
|
909
880
|
* prefix, e.g. `iam:<sub>`) and always wins over the built-in `user` /
|
|
910
881
|
* `session` derivations. Full contract: docs `/moost/rate-limit`.
|
|
911
882
|
*/
|
|
912
|
-
declare function setRateLimitSubject(kind: string, subject: string, ctx?: EventContext): void;
|
|
883
|
+
export declare function setRateLimitSubject(kind: string, subject: string, ctx?: EventContext): void;
|
|
913
884
|
/** Read a named rate-limit subject set for this event (or `undefined`). */
|
|
914
|
-
declare function getRateLimitSubject(kind: string, ctx?: EventContext): string | undefined;
|
|
885
|
+
export declare function getRateLimitSubject(kind: string, ctx?: EventContext): string | undefined;
|
|
915
886
|
interface RateLimitBindings {
|
|
916
887
|
/**
|
|
917
888
|
* The decision the interceptor computed for this event, or `null` when the
|
|
@@ -924,9 +895,7 @@ interface RateLimitBindings {
|
|
|
924
895
|
* wook) — it's a single slot read, and workflow child events inherit the
|
|
925
896
|
* HTTP parent's slot transparently.
|
|
926
897
|
*/
|
|
927
|
-
declare function useRateLimit(ctx?: EventContext): RateLimitBindings;
|
|
928
|
-
//#endregion
|
|
929
|
-
//#region src/oauth/oauth.controller.d.ts
|
|
898
|
+
export declare function useRateLimit(ctx?: EventContext): RateLimitBindings;
|
|
930
899
|
/**
|
|
931
900
|
* REST surface for federated-login ACCOUNT MANAGEMENT (OAuth2 / OIDC), RFC
|
|
932
901
|
* IDP.md §3.7. Two routes — anonymous LOGIN is NOT here: it lives in the login
|
|
@@ -960,7 +929,7 @@ declare function useRateLimit(ctx?: EventContext): RateLimitBindings;
|
|
|
960
929
|
* session, never from a parameter. Subclass + add `@ArbacAction(...)` to gate
|
|
961
930
|
* them further (e.g. an admin cross-user view).
|
|
962
931
|
*/
|
|
963
|
-
declare class OAuthController {
|
|
932
|
+
export declare class OAuthController {
|
|
964
933
|
protected readonly registry: OAuthProviderRegistry;
|
|
965
934
|
protected readonly auth: AuthCredential;
|
|
966
935
|
protected readonly users: UserService;
|
|
@@ -1047,29 +1016,25 @@ interface ConnectedAccount {
|
|
|
1047
1016
|
displayName?: string;
|
|
1048
1017
|
avatarUrl?: string;
|
|
1049
1018
|
}
|
|
1050
|
-
//#endregion
|
|
1051
|
-
//#region src/oauth/oauth-csrf.d.ts
|
|
1052
1019
|
/**
|
|
1053
1020
|
* Name of the double-submit anti-CSRF cookie set at `/:provider/start` and
|
|
1054
1021
|
* verified in `oauth-exchange`. Holds the signed-state `random`; the callback
|
|
1055
1022
|
* proves it speaks for the same browser that started the flow by matching the
|
|
1056
1023
|
* cookie value against the verified `state.random` (RFC IDP.md §7).
|
|
1057
1024
|
*/
|
|
1058
|
-
declare const OAUTH_CSRF_COOKIE = "aooth_oauth";
|
|
1025
|
+
export declare const OAUTH_CSRF_COOKIE = "aooth_oauth";
|
|
1059
1026
|
/**
|
|
1060
1027
|
* Cookie attributes for the CSRF cookie. `SameSite=Lax` (NOT `Strict`) so the
|
|
1061
1028
|
* top-level GET navigation BACK from the provider still carries it; `httpOnly`
|
|
1062
1029
|
* so script can't read it; short `maxAge` matched to the state TTL. `secure` is
|
|
1063
1030
|
* caller-controlled (off for the http test harness, on in production).
|
|
1064
1031
|
*/
|
|
1065
|
-
declare function oauthCsrfCookieAttrs(opts: {
|
|
1032
|
+
export declare function oauthCsrfCookieAttrs(opts: {
|
|
1066
1033
|
secure: boolean;
|
|
1067
1034
|
/** Cookie lifetime in seconds — match the signed-state TTL (default 600). */
|
|
1068
1035
|
maxAgeSec?: number;
|
|
1069
1036
|
path?: string;
|
|
1070
1037
|
}): TCookieAttributesInput;
|
|
1071
|
-
//#endregion
|
|
1072
|
-
//#region src/oauth/oauth-redirect.d.ts
|
|
1073
1038
|
/**
|
|
1074
1039
|
* Open-redirect defense for the post-login `redirect` carried across the OAuth
|
|
1075
1040
|
* bounce (RFC IDP.md §7). The provider round-trips whatever target the SPA
|
|
@@ -1084,16 +1049,14 @@ declare function oauthCsrfCookieAttrs(opts: {
|
|
|
1084
1049
|
* carry no control/whitespace characters (which browsers may strip, changing
|
|
1085
1050
|
* the parsed target). Everything else falls back to the caller's default.
|
|
1086
1051
|
*/
|
|
1087
|
-
declare function isSafeRelativeRedirect(target: string | undefined): target is string;
|
|
1052
|
+
export declare function isSafeRelativeRedirect(target: string | undefined): target is string;
|
|
1088
1053
|
/**
|
|
1089
1054
|
* Return `requested` when it is a safe same-origin relative redirect, else
|
|
1090
1055
|
* `fallback`. Used at `/start` (before signing) and re-checked in
|
|
1091
1056
|
* `oauth-exchange` (before honoring) — defense in depth around the signed
|
|
1092
1057
|
* round-trip.
|
|
1093
1058
|
*/
|
|
1094
|
-
declare function resolveOAuthRedirect(requested: string | undefined, fallback: string): string;
|
|
1095
|
-
//#endregion
|
|
1096
|
-
//#region src/oauth/oauth-runtime.d.ts
|
|
1059
|
+
export declare function resolveOAuthRedirect(requested: string | undefined, fallback: string): string;
|
|
1097
1060
|
/**
|
|
1098
1061
|
* DI holder bundling the two app-provided federated-login singletons the
|
|
1099
1062
|
* `sso-callback` workflow step needs. It exists so the step can resolve them
|
|
@@ -1107,13 +1070,11 @@ declare function resolveOAuthRedirect(requested: string | undefined, fallback: s
|
|
|
1107
1070
|
* unchanged). NO flow store: the PKCE verifier + OIDC nonce are derived
|
|
1108
1071
|
* statelessly from the signed-state seed (see `OAuthProviderRegistry.deriveSeededPkce`).
|
|
1109
1072
|
*/
|
|
1110
|
-
declare class OAuthRuntime {
|
|
1073
|
+
export declare class OAuthRuntime {
|
|
1111
1074
|
readonly registry: OAuthProviderRegistry;
|
|
1112
1075
|
readonly federated: FederatedLoginService;
|
|
1113
1076
|
constructor(registry: OAuthProviderRegistry, federated: FederatedLoginService);
|
|
1114
1077
|
}
|
|
1115
|
-
//#endregion
|
|
1116
|
-
//#region src/oauth/oauth-tokens.d.ts
|
|
1117
1078
|
/**
|
|
1118
1079
|
* Explicit string DI token for the ABSTRACT `FederatedIdentityStore`.
|
|
1119
1080
|
*
|
|
@@ -1134,9 +1095,7 @@ declare class OAuthRuntime {
|
|
|
1134
1095
|
* )
|
|
1135
1096
|
* ```
|
|
1136
1097
|
*/
|
|
1137
|
-
declare const FEDERATED_IDENTITY_STORE_TOKEN = "aooth:FederatedIdentityStore";
|
|
1138
|
-
//#endregion
|
|
1139
|
-
//#region src/authz/authorize.controller.d.ts
|
|
1098
|
+
export declare const FEDERATED_IDENTITY_STORE_TOKEN = "aooth:FederatedIdentityStore";
|
|
1140
1099
|
/** RFC-6749-shaped token-endpoint error response. */
|
|
1141
1100
|
interface TokenError {
|
|
1142
1101
|
error: string;
|
|
@@ -1220,7 +1179,7 @@ interface ClientRegistrationFailure {
|
|
|
1220
1179
|
* intent, audience, scope) is fixed at `/authorize` time and recorded on the
|
|
1221
1180
|
* pending authorization + the issued code — never inferred at `/token`.
|
|
1222
1181
|
*/
|
|
1223
|
-
declare class AuthorizeController {
|
|
1182
|
+
export declare class AuthorizeController {
|
|
1224
1183
|
protected readonly auth: AuthCredential;
|
|
1225
1184
|
protected readonly policy: ClientRedirectPolicy;
|
|
1226
1185
|
protected readonly pending: PendingAuthorizationStore;
|
|
@@ -1335,8 +1294,6 @@ declare class AuthorizeController {
|
|
|
1335
1294
|
/** Fail soft: 302 the validated client redirect with an `?error=` (+ echoed `state`). */
|
|
1336
1295
|
protected redirectError(redirectUri: string, error: string, state: string | undefined): string;
|
|
1337
1296
|
}
|
|
1338
|
-
//#endregion
|
|
1339
|
-
//#region src/authz/authorize-runtime.d.ts
|
|
1340
1297
|
/**
|
|
1341
1298
|
* DI holder bundling the two abstract authorization-server stores the login-wf
|
|
1342
1299
|
* terminal (`mint-authz-code`) needs. A `@Step` body cannot `@Inject` a string
|
|
@@ -1346,13 +1303,11 @@ declare class AuthorizeController {
|
|
|
1346
1303
|
* injects `AuthCredential` & friends), keeping `AuthWorkflow`'s documented ctor
|
|
1347
1304
|
* untouched. Mirrors `OAuthRuntime`.
|
|
1348
1305
|
*/
|
|
1349
|
-
declare class AuthorizeRuntime {
|
|
1306
|
+
export declare class AuthorizeRuntime {
|
|
1350
1307
|
readonly pending: PendingAuthorizationStore;
|
|
1351
1308
|
readonly codes: AuthCodeStore;
|
|
1352
1309
|
constructor(pending: PendingAuthorizationStore, codes: AuthCodeStore);
|
|
1353
1310
|
}
|
|
1354
|
-
//#endregion
|
|
1355
|
-
//#region src/authz/authz-binding.d.ts
|
|
1356
1311
|
/**
|
|
1357
1312
|
* Name of the double-submit cookie that binds an in-flight authorization
|
|
1358
1313
|
* request to the browser that started it. Set at `GET /auth/authorize` (holding
|
|
@@ -1368,7 +1323,7 @@ declare class AuthorizeRuntime {
|
|
|
1368
1323
|
* fails the match here, because the victim's browser never holds the secret. So
|
|
1369
1324
|
* a handle can only be redeemed by the same browser that started the request.
|
|
1370
1325
|
*/
|
|
1371
|
-
declare const AUTHZ_BINDING_COOKIE = "aooth_authz";
|
|
1326
|
+
export declare const AUTHZ_BINDING_COOKIE = "aooth_authz";
|
|
1372
1327
|
/**
|
|
1373
1328
|
* Cookie attributes for the authorize-binding cookie — the same httpOnly /
|
|
1374
1329
|
* `SameSite=Lax` shape as the OAuth CSRF cookie (Lax, NOT Strict, so the
|
|
@@ -1380,12 +1335,10 @@ declare const AUTHZ_BINDING_COOKIE = "aooth_authz";
|
|
|
1380
1335
|
* `ttlMs`. `secure` is caller-controlled (off for the http test harness, on in
|
|
1381
1336
|
* production).
|
|
1382
1337
|
*/
|
|
1383
|
-
declare function authzBindingCookieAttrs(opts: {
|
|
1338
|
+
export declare function authzBindingCookieAttrs(opts: {
|
|
1384
1339
|
secure: boolean;
|
|
1385
1340
|
maxAgeSec: number;
|
|
1386
1341
|
}): TCookieAttributesInput;
|
|
1387
|
-
//#endregion
|
|
1388
|
-
//#region src/authz/authz-tokens.d.ts
|
|
1389
1342
|
/**
|
|
1390
1343
|
* Explicit string DI tokens for the ABSTRACT authorization-server stores
|
|
1391
1344
|
* ({@link import("@aooth/auth/authz").PendingAuthorizationStore},
|
|
@@ -1410,15 +1363,15 @@ declare function authzBindingCookieAttrs(opts: {
|
|
|
1410
1363
|
* )
|
|
1411
1364
|
* ```
|
|
1412
1365
|
*/
|
|
1413
|
-
declare const PENDING_AUTHORIZATION_STORE_TOKEN = "aooth:PendingAuthorizationStore";
|
|
1414
|
-
declare const AUTH_CODE_STORE_TOKEN = "aooth:AuthCodeStore";
|
|
1366
|
+
export declare const PENDING_AUTHORIZATION_STORE_TOKEN = "aooth:PendingAuthorizationStore";
|
|
1367
|
+
export declare const AUTH_CODE_STORE_TOKEN = "aooth:AuthCodeStore";
|
|
1415
1368
|
/**
|
|
1416
1369
|
* DI token for the {@link import("@aooth/auth/authz").ClientRedirectPolicy} — an
|
|
1417
1370
|
* interface, so it has no class reference to inject by. Provide the concrete
|
|
1418
1371
|
* policy (e.g. `new LoopbackClientPolicy()`, a `RegisteredClientPolicy`, or a
|
|
1419
1372
|
* `CompositeClientPolicy` of both) under this string.
|
|
1420
1373
|
*/
|
|
1421
|
-
declare const CLIENT_REDIRECT_POLICY_TOKEN = "aooth:ClientRedirectPolicy";
|
|
1374
|
+
export declare const CLIENT_REDIRECT_POLICY_TOKEN = "aooth:ClientRedirectPolicy";
|
|
1422
1375
|
/**
|
|
1423
1376
|
* DI token for the {@link import("@aooth/auth/authz").DynamicClientStore}
|
|
1424
1377
|
* (RFC 7591 dynamic registrations) — an abstract class, same auto-instantiation
|
|
@@ -1429,9 +1382,7 @@ declare const CLIENT_REDIRECT_POLICY_TOKEN = "aooth:ClientRedirectPolicy";
|
|
|
1429
1382
|
* overrides `getDynamicClientRegistration()`. The same store instance also
|
|
1430
1383
|
* backs the `DynamicClientPolicy` composed into the redirect policy.
|
|
1431
1384
|
*/
|
|
1432
|
-
declare const DYNAMIC_CLIENT_STORE_TOKEN = "aooth:DynamicClientStore";
|
|
1433
|
-
//#endregion
|
|
1434
|
-
//#region src/workflow/auth-workflow.ctx.d.ts
|
|
1385
|
+
export declare const DYNAMIC_CLIENT_STORE_TOKEN = "aooth:DynamicClientStore";
|
|
1435
1386
|
type MfaTransport = "sms" | "email" | "totp";
|
|
1436
1387
|
/** Per-user MFA method summary surfaced to forms via `@wf.context.pass 'mfa'`. */
|
|
1437
1388
|
interface MfaSummary {
|
|
@@ -1720,9 +1671,12 @@ interface AuthWfSessionPolicy {
|
|
|
1720
1671
|
* `UserService.changePassword`), NOT rate limiting — so `rateLimit` is
|
|
1721
1672
|
* optional and off by default.
|
|
1722
1673
|
*
|
|
1723
|
-
* - `revokeOtherSessions` — on success, revoke
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1674
|
+
* - `revokeOtherSessions` — on success, revoke the user's OTHER sessions (OWASP
|
|
1675
|
+
* Session Management: kill ghost sessions after a credential change). Default
|
|
1676
|
+
* `true`. Either way the acting device moves onto a fresh session and the
|
|
1677
|
+
* session the change was made from is revoked; when that session can't be
|
|
1678
|
+
* targeted (stateless JWT / encapsulated store, legacy pre-sessionId
|
|
1679
|
+
* credential) every session is revoked.
|
|
1726
1680
|
* - `rateLimit.minIntervalMs` — minimum gap between successive password changes
|
|
1727
1681
|
* (Okta "minimum password age"). Enforced against `password.lastChanged` with
|
|
1728
1682
|
* ZERO extra storage. Omit to disable.
|
|
@@ -2184,6 +2138,20 @@ interface AuthWfCtx {
|
|
|
2184
2138
|
aborted?: boolean;
|
|
2185
2139
|
isFirstLogin?: boolean;
|
|
2186
2140
|
newPasswordRequired?: boolean;
|
|
2141
|
+
/**
|
|
2142
|
+
* Set by `create-password-form` once it stored a new password. In login.flow
|
|
2143
|
+
* it gates the `revoke-sessions` step after the MFA loop (sessions opened
|
|
2144
|
+
* with the old password end) and exempts the run from
|
|
2145
|
+
* `check-password-unchanged`. Server-only flow control.
|
|
2146
|
+
*/
|
|
2147
|
+
passwordChanged?: boolean;
|
|
2148
|
+
/**
|
|
2149
|
+
* `password.lastChanged` of the account as the `credentials` step verified
|
|
2150
|
+
* it. `check-password-unchanged` compares it before the login is recorded,
|
|
2151
|
+
* so a run paused across a password change can't finish on the replaced
|
|
2152
|
+
* password. Server-only flow control.
|
|
2153
|
+
*/
|
|
2154
|
+
passwordStamp?: number;
|
|
2187
2155
|
/**
|
|
2188
2156
|
* Idempotency latch for the single `record-login` funnel step. Set true once
|
|
2189
2157
|
* a login has been stamped this run — by the `credentials` step (the password
|
|
@@ -2287,8 +2255,6 @@ interface AuthWfCtx {
|
|
|
2287
2255
|
*/
|
|
2288
2256
|
public?: AuthWfPublicState;
|
|
2289
2257
|
}
|
|
2290
|
-
//#endregion
|
|
2291
|
-
//#region src/workflow/auth-workflow.opts.d.ts
|
|
2292
2258
|
interface AuthWorkflowOpts {
|
|
2293
2259
|
autoLoginOnInvite?: boolean;
|
|
2294
2260
|
autoLoginOnRecover?: boolean;
|
|
@@ -2516,8 +2482,6 @@ interface ResolvedAuthWorkflowOpts {
|
|
|
2516
2482
|
authzConsent: TAtscriptAnnotatedType;
|
|
2517
2483
|
};
|
|
2518
2484
|
}
|
|
2519
|
-
//#endregion
|
|
2520
|
-
//#region src/workflow/auth-workflow.d.ts
|
|
2521
2485
|
/**
|
|
2522
2486
|
* Unified outbound-dispatch payload. Customers override `deliver(payload)` on
|
|
2523
2487
|
* the `AuthWorkflow` subclass to route by `kind` (per-purpose templates) and
|
|
@@ -2585,12 +2549,12 @@ type AuthDeliveryPayload = {
|
|
|
2585
2549
|
* declares one — or an attacker submits one as an extra field — the strip
|
|
2586
2550
|
* applied at the workflow step blocks shadowing.
|
|
2587
2551
|
*/
|
|
2588
|
-
declare const RESERVED_USER_KEYS: ReadonlySet<string>;
|
|
2552
|
+
export declare const RESERVED_USER_KEYS: ReadonlySet<string>;
|
|
2589
2553
|
/**
|
|
2590
2554
|
* Return a shallow copy of `profile` with `RESERVED_USER_KEYS` removed.
|
|
2591
2555
|
* Does not mutate the input.
|
|
2592
2556
|
*/
|
|
2593
|
-
declare function stripReservedUserKeys(profile: Record<string, unknown>): Record<string, unknown>;
|
|
2557
|
+
export declare function stripReservedUserKeys(profile: Record<string, unknown>): Record<string, unknown>;
|
|
2594
2558
|
/**
|
|
2595
2559
|
* Best-effort "Browser on OS" label from a raw User-Agent string — feeds the
|
|
2596
2560
|
* `name` field of `seenDevices` records so a device list reads "Chrome on
|
|
@@ -2599,8 +2563,8 @@ declare function stripReservedUserKeys(profile: Record<string, unknown>): Record
|
|
|
2599
2563
|
* Returns just the browser or just the OS when only one side is detected;
|
|
2600
2564
|
* `undefined` for empty / fully unrecognized input.
|
|
2601
2565
|
*/
|
|
2602
|
-
declare function humanizeUserAgent(ua: string | undefined): string | undefined;
|
|
2603
|
-
declare function haversineKm(a: {
|
|
2566
|
+
export declare function humanizeUserAgent(ua: string | undefined): string | undefined;
|
|
2567
|
+
export declare function haversineKm(a: {
|
|
2604
2568
|
lat: number;
|
|
2605
2569
|
lon: number;
|
|
2606
2570
|
}, b: {
|
|
@@ -2608,7 +2572,7 @@ declare function haversineKm(a: {
|
|
|
2608
2572
|
lon: number;
|
|
2609
2573
|
}): number;
|
|
2610
2574
|
/** Trim + de-duplicate role identifiers submitted via the admin invite form. */
|
|
2611
|
-
declare function parseInviteRoles(input?: string[]): string[];
|
|
2575
|
+
export declare function parseInviteRoles(input?: string[]): string[];
|
|
2612
2576
|
/**
|
|
2613
2577
|
* Single source of truth for the "this invite was already accepted" finish
|
|
2614
2578
|
* envelope. Used by both `idempotent-redirect` (in-workflow) and by
|
|
@@ -2619,13 +2583,13 @@ declare function parseInviteRoles(input?: string[]): string[];
|
|
|
2619
2583
|
* `alreadyAcceptedRedirectUrl` being non-empty — mirrors how the resolver
|
|
2620
2584
|
* defaults it, but lets consumers blank it to suppress the secondary button.
|
|
2621
2585
|
*/
|
|
2622
|
-
declare function buildInviteAlreadyAcceptedEnvelope(opts: {
|
|
2586
|
+
export declare function buildInviteAlreadyAcceptedEnvelope(opts: {
|
|
2623
2587
|
loginUrl: string;
|
|
2624
2588
|
alreadyAcceptedRedirectUrl: string;
|
|
2625
2589
|
/** Text overrides (see `AuthWorkflowOpts.messages`). */
|
|
2626
2590
|
messages?: AoothMessages;
|
|
2627
2591
|
}): FinishWfOpts;
|
|
2628
|
-
declare class AuthWorkflow {
|
|
2592
|
+
export declare class AuthWorkflow {
|
|
2629
2593
|
protected readonly opts: ResolvedAuthWorkflowOpts;
|
|
2630
2594
|
protected readonly users: UserService;
|
|
2631
2595
|
protected readonly auth: AuthCredential;
|
|
@@ -2973,7 +2937,8 @@ declare class AuthWorkflow {
|
|
|
2973
2937
|
* successful change (OWASP Session Management) and applies NO rate limit —
|
|
2974
2938
|
* current-password re-entry (enforced by `UserService.changePassword`) is the
|
|
2975
2939
|
* primary protection, not throttling. Customers override to add a min-interval
|
|
2976
|
-
* (`rateLimit.minIntervalMs`) or to keep other sessions alive.
|
|
2940
|
+
* (`rateLimit.minIntervalMs`) or to keep other sessions alive. The session the
|
|
2941
|
+
* change was made from is always ended (see `finish-change-password`).
|
|
2977
2942
|
*
|
|
2978
2943
|
* Whether the flow may be STARTED at all is governed by arbac on the trigger
|
|
2979
2944
|
* route (deny the `change-password` action to forbid it for SSO-only orgs) —
|
|
@@ -3738,11 +3703,28 @@ declare class AuthWorkflow {
|
|
|
3738
3703
|
*/
|
|
3739
3704
|
changePasswordForm(ctx: AuthWfCtx): Promise<unknown>;
|
|
3740
3705
|
/**
|
|
3741
|
-
* Change-password terminal —
|
|
3742
|
-
*
|
|
3743
|
-
*
|
|
3744
|
-
*
|
|
3745
|
-
*
|
|
3706
|
+
* Change-password terminal — sign the current device in on a FRESH session
|
|
3707
|
+
* and end the one the change was made from, then emit a success message.
|
|
3708
|
+
* The new pair is minted under a new session id, so the pre-change session
|
|
3709
|
+
* (its access token, refresh token and every rotation) is revoked here —
|
|
3710
|
+
* whatever `revokeOtherSessions` says, since that policy covers only the
|
|
3711
|
+
* user's OTHER sessions. Runs AFTER the optional `revoke-sessions` step, so
|
|
3712
|
+
* the default net effect is "kill every old session, keep this device on a
|
|
3713
|
+
* new one" (OWASP Session Management: no ghost sessions survive a credential
|
|
3714
|
+
* change).
|
|
3715
|
+
*
|
|
3716
|
+
* The pre-change session is revoked BEFORE the issue, so a failed issue
|
|
3717
|
+
* (store error, `maxConcurrent` refusal) leaves the user signed out, never on
|
|
3718
|
+
* the old session. A refresh in flight during the change is covered by
|
|
3719
|
+
* `AuthCredential`'s revocation protocol (it can't leave live credentials in
|
|
3720
|
+
* a revoked session).
|
|
3721
|
+
*
|
|
3722
|
+
* When one session can't be targeted — a stateless store (JWT /
|
|
3723
|
+
* encapsulated), or a legacy credential minted before `sessionId` existed
|
|
3724
|
+
* (its fallback id, the access token's fingerprint, never reaches the refresh
|
|
3725
|
+
* row) — ALL of the user's sessions are revoked (`revokeAllForUser`, also
|
|
3726
|
+
* under `revokeOtherSessions: false`). A stateless store also denylists the
|
|
3727
|
+
* presented access token (best effort): its revocation epoch is process-local.
|
|
3746
3728
|
*/
|
|
3747
3729
|
finishChangePassword(ctx: AuthWfCtx): Promise<undefined>;
|
|
3748
3730
|
/**
|
|
@@ -4088,15 +4070,20 @@ declare class AuthWorkflow {
|
|
|
4088
4070
|
persistConsents(ctx: AuthWfCtx): Promise<undefined>;
|
|
4089
4071
|
/**
|
|
4090
4072
|
* Revoke the user's existing sessions. Shared by recovery (gated upstream by
|
|
4091
|
-
* `ctx.postReset.revokeAllSessions`)
|
|
4092
|
-
* by `ctx.changePassword.revokeOtherSessions`)
|
|
4073
|
+
* `ctx.postReset.revokeAllSessions`), authenticated change-password (gated
|
|
4074
|
+
* by `ctx.changePassword.revokeOtherSessions`) and the forced password change
|
|
4075
|
+
* at login / invite (gated by `ctx.passwordChanged`).
|
|
4093
4076
|
*
|
|
4094
4077
|
* - Change-password runs in an authenticated context, so we KEEP the caller's
|
|
4095
|
-
* current
|
|
4078
|
+
* current session via `revokeOtherSessions(username, currentSessionId)` —
|
|
4096
4079
|
* OWASP "invalidate other sessions" without logging the user out of the tab
|
|
4097
|
-
* they just changed their password in.
|
|
4098
|
-
*
|
|
4099
|
-
*
|
|
4080
|
+
* they just changed their password in. `finish-change-password` then moves
|
|
4081
|
+
* that tab onto a fresh session and revokes the kept one (and covers stores
|
|
4082
|
+
* that cannot enumerate, where `revokeOtherSessions` is a no-op). If the
|
|
4083
|
+
* current session can't be resolved (no session id), fall back to revoking
|
|
4084
|
+
* everything (fail-secure).
|
|
4085
|
+
* - Recovery and the forced change are anonymous (no current session to
|
|
4086
|
+
* keep) → `revokeAllForUser`.
|
|
4100
4087
|
*/
|
|
4101
4088
|
revokeSessions(ctx: AuthWfCtx): Promise<undefined>;
|
|
4102
4089
|
/**
|
|
@@ -4107,6 +4094,16 @@ declare class AuthWorkflow {
|
|
|
4107
4094
|
* also zeroes `failedLoginAttempts`, so the next login starts clean.
|
|
4108
4095
|
*/
|
|
4109
4096
|
unlockAccount(ctx: AuthWfCtx): Promise<undefined>;
|
|
4097
|
+
/**
|
|
4098
|
+
* Login-only guard before the `record-login` funnel (and again before
|
|
4099
|
+
* `mint-authz-code`, past the consent pause): the account's
|
|
4100
|
+
* `password.lastChanged` must still be the one the `credentials` step
|
|
4101
|
+
* verified (`ctx.passwordStamp`). A run paused after the password check (MFA,
|
|
4102
|
+
* enrolment, consents …) and resumed after the password was changed
|
|
4103
|
+
* elsewhere finishes with an error instead of issuing tokens or minting an
|
|
4104
|
+
* authorization code. Skipped when this run changed the password itself.
|
|
4105
|
+
*/
|
|
4106
|
+
checkPasswordUnchanged(ctx: AuthWfCtx): Promise<undefined>;
|
|
4110
4107
|
/**
|
|
4111
4108
|
* The SINGLE login-completion funnel. Every flow that establishes an
|
|
4112
4109
|
* authenticated session routes through here — placed in each login schema
|
|
@@ -4496,8 +4493,6 @@ declare class AuthWorkflow {
|
|
|
4496
4493
|
*/
|
|
4497
4494
|
signupFlow(): void;
|
|
4498
4495
|
}
|
|
4499
|
-
//#endregion
|
|
4500
|
-
//#region src/workflows/auth-email-outlet.d.ts
|
|
4501
4496
|
interface AuthEmailOutletDeps {
|
|
4502
4497
|
emailSender: EmailSender$1;
|
|
4503
4498
|
buildMagicLinkUrl: BuildMagicLinkUrl$1;
|
|
@@ -4509,9 +4504,7 @@ interface AuthEmailOutletDeps {
|
|
|
4509
4504
|
* `EmailSender`. Single-use: pass the same instance into one
|
|
4510
4505
|
* `handleWfOutletRequest({ outlets })`.
|
|
4511
4506
|
*/
|
|
4512
|
-
declare function createAuthEmailOutlet(deps: AuthEmailOutletDeps): WfOutlet;
|
|
4513
|
-
//#endregion
|
|
4514
|
-
//#region src/audit/index.d.ts
|
|
4507
|
+
export declare function createAuthEmailOutlet(deps: AuthEmailOutletDeps): WfOutlet;
|
|
4515
4508
|
/**
|
|
4516
4509
|
* Audit event emitter — used by `AuthWorkflow`'s audit-login step (and
|
|
4517
4510
|
* future recovery / invite audit steps) to fan out login.success and similar
|
|
@@ -4537,5 +4530,4 @@ interface AuditEvent {
|
|
|
4537
4530
|
interface AuditEmitter {
|
|
4538
4531
|
emit(event: AuditEvent): Promise<void> | void;
|
|
4539
4532
|
}
|
|
4540
|
-
|
|
4541
|
-
export { ADD_MFA_WORKFLOW, AOOTH_MESSAGES, AUTHZ_BINDING_COOKIE, AUTH_CODE_STORE_TOKEN, type AoothMessageCode, type AoothMessageParams, type AoothMessages, type AuditEmitter, type AuditEvent, type AuthBindings, type AuthContext, AuthController, type AuthDeliveryPayload, type AuthEmailEvent, type AuthEmailKind, type AuthEmailOutletDeps, AuthGuarded, type AuthLoginResponse, type AuthLogoutBody, type AuthOkResponse, type AuthOptions, type AuthRefreshBody, type AuthSmsEvent, type AuthSmsKind, type AuthWfCompletionState, type AuthWfConsentsState, type AuthWfCtx, type AuthWfMfaEnrollState, type AuthWfOAuthState, type AuthWfPasswordUiState, type AuthWfPincodeUiState, AuthWorkflow, type AuthWorkflowOpts, type AuthorizationServerMetadata, AuthorizeController, AuthorizeRuntime, type AuthzReauthPolicy, type BuildAuthorizationServerMetadataOptions, type BuildMagicLinkUrl, type BuildProtectedResourceMetadataOptions, CHANGE_PASSWORD_WORKFLOW, CLIENT_REDIRECT_POLICY_TOKEN, type ConcurrencyLimitOptions, type ConnectedAccount, type ConsentDescriptor, type ConsentDescriptorLike, type ConsentEvent, ConsentStore, DEFAULT_AUTH_WORKFLOWS, DYNAMIC_CLIENT_STORE_TOKEN, DynamicClientRegistration, type DynamicClientRegistrationOptions, type EmailSender, type EnrichedSession, FEDERATED_IDENTITY_STORE_TOKEN, INVITE_OUTLET, type IssueResult, type LoginRedirect, type MfaSummary, type MfaTransport, OAUTH_CSRF_COOKIE, OAuthController, OAuthRuntime, PENDING_AUTHORIZATION_STORE_TOKEN, type ProtectedResourceMetadata, Public, RESERVED_USER_KEYS, RateLimit, type RateLimitBindings, type RateLimitDecision, type RateLimitDecoratorOptions, type RateLimitInterceptorOptions, type RateLimitKeyStrategy, type RateLimitRule, type RateLimitRuleInput, type RateLimitStore, RateLimitStoreMemory, RateLimited, RateLimiter, type RateLimiterOptions, type ResolvedAuthCookieConfig, type ResolvedAuthOptions, type ResolvedAuthWorkflowOpts, type SessionEnricher, SessionEnricherProvider, type SessionInfo, SessionsController, type SmsSender, type SsoProvider, type TAuthMeta, type TRateLimitMeta, UserId, WfTrigger, type WfTriggerOpts, WfTriggerProvider, type WwwAuthenticateBearerChallengeOptions, authGuardInterceptor, authzBindingCookieAttrs, buildAuthorizationServerMetadata, buildInviteAlreadyAcceptedEnvelope, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, createAuthEmailOutlet, createInviteOutlet, deriveWfStateSecret, generateMagicLinkToken, getAuthMate, getRateLimitMate, getRateLimitSubject, haversineKm, humanizeUserAgent, isSafeRelativeRedirect, oauthCsrfCookieAttrs, parseInviteRoles, rateLimitInterceptors, renderAoothMessage, resolveAoothMessage, resolveOAuthRedirect, setRateLimitSubject, stripReservedUserKeys, useAuth, useRateLimit };
|
|
4533
|
+
export { type AoothMessageCode, type AoothMessageParams, type AoothMessages, type AuditEmitter, type AuditEvent, type AuthBindings, type AuthContext, type AuthDeliveryPayload, type AuthEmailEvent, type AuthEmailKind, type AuthEmailOutletDeps, type AuthLoginResponse, type AuthLogoutBody, type AuthOkResponse, type AuthOptions, type AuthRefreshBody, type AuthSmsEvent, type AuthSmsKind, type AuthWfCompletionState, type AuthWfConsentsState, type AuthWfCtx, type AuthWfMfaEnrollState, type AuthWfOAuthState, type AuthWfPasswordUiState, type AuthWfPincodeUiState, type AuthWorkflowOpts, type AuthorizationServerMetadata, type AuthzReauthPolicy, type BuildAuthorizationServerMetadataOptions, type BuildMagicLinkUrl, type BuildProtectedResourceMetadataOptions, type ConcurrencyLimitOptions, type ConnectedAccount, type ConsentDescriptor, type ConsentDescriptorLike, type ConsentEvent, DynamicClientRegistration, type DynamicClientRegistrationOptions, type EmailSender, type EnrichedSession, type IssueResult, type LoginRedirect, type MfaSummary, type MfaTransport, type ProtectedResourceMetadata, type RateLimitBindings, type RateLimitDecision, type RateLimitDecoratorOptions, type RateLimitInterceptorOptions, type RateLimitKeyStrategy, type RateLimitRule, type RateLimitRuleInput, type RateLimitStore, RateLimitStoreMemory, RateLimiter, type RateLimiterOptions, type ResolvedAuthCookieConfig, type ResolvedAuthOptions, type ResolvedAuthWorkflowOpts, type SessionEnricher, type SessionInfo, type SmsSender, type SsoProvider, type TAuthMeta, type TRateLimitMeta, type WfTriggerOpts, type WwwAuthenticateBearerChallengeOptions, buildAuthorizationServerMetadata, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, generateMagicLinkToken };
|