@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.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as RemoveMfaConfirmForm, D as StepUpConfirmForm, E as SignupForm, O as TermsBumpForm, T as SetPasswordForm, _ as PasswordReauthForm, a as ConcurrencyLimitForm, b as ProveControlOtpForm, c as EnrollConfirmForm, d as InviteChooseUsernameForm, f as InviteForm, g as MfaCodeForm, h as ManageMfaForm, i as ChangePasswordForm, l as EnrollPickMethodForm, n as AskPhoneForm, o as EmailIdentifierForm, p as LoginCredentialsForm, r as AuthorizeConsentForm, s as EnrollAddressForm, t as AskEmailForm, u as EnrollTotpQrForm, v as PincodeForm, w as Select2faForm, y as ProveControlForm } from "./forms-
|
|
1
|
+
import { C as RemoveMfaConfirmForm, D as StepUpConfirmForm, E as SignupForm, O as TermsBumpForm, T as SetPasswordForm, _ as PasswordReauthForm, a as ConcurrencyLimitForm, b as ProveControlOtpForm, c as EnrollConfirmForm, d as InviteChooseUsernameForm, f as InviteForm, g as MfaCodeForm, h as ManageMfaForm, i as ChangePasswordForm, l as EnrollPickMethodForm, n as AskPhoneForm, o as EmailIdentifierForm, p as LoginCredentialsForm, r as AuthorizeConsentForm, s as EnrollAddressForm, t as AskEmailForm, u as EnrollTotpQrForm, v as PincodeForm, w as Select2faForm, y as ProveControlForm } from "./forms-C_VNxSDn.mjs";
|
|
2
2
|
import { Controller, HandlerPaths, Inherit, Inject, InjectMoostLogger, Injectable, Intercept, MoostInit, Optional, Param, Resolve, TInterceptorPriority, defineAfterInterceptor, defineBeforeInterceptor, getMoostMate, useControllerContext, useLogger } from "moost";
|
|
3
3
|
import { AuthCredential, AuthError, RateLimitStoreMemory, RateLimitStoreMemory as RateLimitStoreMemory$1, RateLimiter, RateLimiter as RateLimiter$1, generateMagicLinkToken, generateOpaqueToken, parseRateLimitRule, pickGoverning } from "@aooth/auth";
|
|
4
4
|
import { current, defineWook, eventTypeKey, key } from "@wooksjs/event-core";
|
|
5
|
-
import { HttpError, useAuthorization, useCookies, useHeaders, useRequest, useResponse, useUrlParams } from "@wooksjs/event-http";
|
|
5
|
+
import { HttpError, resolveForwarded, useAuthorization, useCookies, useHeaders, useRequest, useResponse, useUrlParams } from "@wooksjs/event-http";
|
|
6
6
|
import { ArbacAction, ArbacResource, getArbacMate, useArbac } from "@aooth/arbac-moost";
|
|
7
7
|
import { FederatedIdentityStore, SEEN_DEVICES_DEFAULT_CAP, UserAuthError, UserService, generateMfaCode, generateTotpSecret, generateTotpUri, maskEmail, maskPhone, pickDefinedProfile, verifyTotpCode } from "@aooth/user";
|
|
8
8
|
import { Body, Delete, Get, HttpError as HttpError$1, Post, Query } from "@moostjs/event-http";
|
|
@@ -11,15 +11,14 @@ import { createAsHttpOutlet, finishWf, handleAsOutletRequest, useAtscriptWf } fr
|
|
|
11
11
|
import { EncapsulatedStateStrategy, MoostWf, Step, StepRetriableError, StepTTL, Workflow, WorkflowParam, WorkflowSchema, createEmailOutlet, outlet, outletEmail, swapStrategy, useWfFinished, useWfState } from "@moostjs/event-wf";
|
|
12
12
|
import { FederatedLoginService, OAuthError, OAuthProviderRegistry, generateRandomState, pkceChallengeFor } from "@aooth/idp";
|
|
13
13
|
import { ClientRegistrationError, DynamicClientRegistration, NoopOidcClaimsResolver, buildAuthorizationServerMetadata, buildAuthorizationServerMetadata as buildAuthorizationServerMetadata$1, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, canonicalizeIssuer as canonicalizeIssuer$1, tokenPolicyToIssueOptions } from "@aooth/auth/authz";
|
|
14
|
-
|
|
14
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorate.js
|
|
15
15
|
function __decorate(decorators, target, key, desc) {
|
|
16
16
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17
17
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
18
18
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
19
19
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
//#region src/consent.store.ts
|
|
21
|
+
// src/consent.store.ts
|
|
23
22
|
let ConsentStore = class ConsentStore {
|
|
24
23
|
/**
|
|
25
24
|
* Returns descriptors for general-purpose consents this user still needs to
|
|
@@ -60,8 +59,7 @@ let ConsentStore = class ConsentStore {
|
|
|
60
59
|
async recordOtpChannelConsent(_username, _channel, _target, _disclosure) {}
|
|
61
60
|
};
|
|
62
61
|
ConsentStore = __decorate([Injectable()], ConsentStore);
|
|
63
|
-
|
|
64
|
-
//#region src/auth.config.ts
|
|
62
|
+
// src/auth.config.ts
|
|
65
63
|
/**
|
|
66
64
|
* Resolve `AuthOptions` to its `ResolvedAuthOptions` form, applying the same
|
|
67
65
|
* defaults the legacy `MoostAuthConfig` constructor did. Pure — call once per
|
|
@@ -97,8 +95,7 @@ function resolveAuthOptions(opts = {}) {
|
|
|
97
95
|
exposeTokensInBody: opts.exposeTokensInBody ?? !enableCookie
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
//#region src/auth.composables.ts
|
|
98
|
+
// src/auth.composables.ts
|
|
102
99
|
const authContextKey = key("auth.context");
|
|
103
100
|
const authCredentialKey = key("auth.credential");
|
|
104
101
|
/**
|
|
@@ -271,8 +268,7 @@ function setAuthContext(ctx, value) {
|
|
|
271
268
|
function setAuthCredential(ctx, value) {
|
|
272
269
|
ctx.set(authCredentialKey, value);
|
|
273
270
|
}
|
|
274
|
-
|
|
275
|
-
//#region src/auth.route.ts
|
|
271
|
+
// src/auth.route.ts
|
|
276
272
|
/**
|
|
277
273
|
* Normalize a router path into a value usable as a cookie `Path` attribute:
|
|
278
274
|
* a single leading slash, no doubled slashes, and no trailing slash (except
|
|
@@ -286,8 +282,7 @@ let RefreshCookiePathHolder = class RefreshCookiePathHolder {
|
|
|
286
282
|
path;
|
|
287
283
|
};
|
|
288
284
|
RefreshCookiePathHolder = __decorate([Injectable()], RefreshCookiePathHolder);
|
|
289
|
-
|
|
290
|
-
//#region src/auth.guard.ts
|
|
285
|
+
// src/auth.guard.ts
|
|
291
286
|
/**
|
|
292
287
|
* `GUARD`-priority interceptor factory that authenticates incoming requests.
|
|
293
288
|
*
|
|
@@ -356,13 +351,11 @@ function authGuardInterceptor(opts) {
|
|
|
356
351
|
function AuthGuarded(opts) {
|
|
357
352
|
return Intercept(authGuardInterceptor(opts));
|
|
358
353
|
}
|
|
359
|
-
|
|
360
|
-
//#region src/auth.mate.ts
|
|
354
|
+
// src/auth.mate.ts
|
|
361
355
|
function getAuthMate() {
|
|
362
356
|
return getMoostMate();
|
|
363
357
|
}
|
|
364
|
-
|
|
365
|
-
//#region src/auth.decorator.ts
|
|
358
|
+
// src/auth.decorator.ts
|
|
366
359
|
/**
|
|
367
360
|
* Marks a route or controller as fully public — opts out of BOTH
|
|
368
361
|
* authentication (auth-moost's bearer guard) AND authorization
|
|
@@ -392,8 +385,7 @@ const Public = () => {
|
|
|
392
385
|
* does not own a user profile type.
|
|
393
386
|
*/
|
|
394
387
|
const UserId = () => Resolve(() => useAuth().getUserId());
|
|
395
|
-
|
|
396
|
-
//#region src/rate-limit/composables.ts
|
|
388
|
+
// src/rate-limit/composables.ts
|
|
397
389
|
/**
|
|
398
390
|
* Internal: the governing decision for this event (across every policy
|
|
399
391
|
* evaluated so far), written by `rateLimitInterceptors`.
|
|
@@ -431,8 +423,7 @@ function getRateLimitSubject(kind, ctx = current()) {
|
|
|
431
423
|
function useRateLimit(ctx = current()) {
|
|
432
424
|
return { decision: ctx.has(rateLimitDecisionKey) ? ctx.get(rateLimitDecisionKey) : null };
|
|
433
425
|
}
|
|
434
|
-
|
|
435
|
-
//#region src/rate-limit/interceptor.ts
|
|
426
|
+
// src/rate-limit/interceptor.ts
|
|
436
427
|
/**
|
|
437
428
|
* Global interceptor PAIR enforcing `@RateLimit` metadata (RL.spec.md §5.2)
|
|
438
429
|
* — register with spread:
|
|
@@ -469,7 +460,7 @@ function rateLimitInterceptors(opts) {
|
|
|
469
460
|
const defaultRules = opts?.rules?.map((r) => parseRateLimitRule(r));
|
|
470
461
|
const limiter = opts?.limiter ?? new RateLimiter$1();
|
|
471
462
|
const emitHeaders = opts?.headers ?? true;
|
|
472
|
-
const
|
|
463
|
+
const trustProxy = opts?.trustProxy ?? false;
|
|
473
464
|
const routeConfigs = /* @__PURE__ */ new WeakMap();
|
|
474
465
|
const resolveRouteConfig = (cc) => {
|
|
475
466
|
const ctor = cc.getController().constructor;
|
|
@@ -522,7 +513,7 @@ function rateLimitInterceptors(opts) {
|
|
|
522
513
|
const decisions = [];
|
|
523
514
|
const headers = [];
|
|
524
515
|
for (const policy of owned) {
|
|
525
|
-
const subject = await resolveSubject(policy.keyStrategy,
|
|
516
|
+
const subject = await resolveSubject(policy.keyStrategy, trustProxy, ctx);
|
|
526
517
|
if (subject == null) continue;
|
|
527
518
|
decisions.push(await limiter.check(policy.scope, subject, policy.rules, { ...policy.defaultMessage !== void 0 && { defaultMessage: policy.defaultMessage } }));
|
|
528
519
|
headers.push(policy.policyHeader);
|
|
@@ -547,7 +538,7 @@ function rateLimitInterceptors(opts) {
|
|
|
547
538
|
};
|
|
548
539
|
return [defineBeforeInterceptor(() => evaluate("pre"), TInterceptorPriority.BEFORE_GUARD), defineBeforeInterceptor(() => evaluate("post"), TInterceptorPriority.AFTER_GUARD)];
|
|
549
540
|
}
|
|
550
|
-
async function resolveSubject(strategy,
|
|
541
|
+
async function resolveSubject(strategy, trustProxy, ctx) {
|
|
551
542
|
if (typeof strategy === "function") return await strategy();
|
|
552
543
|
if (strategy !== "ip") {
|
|
553
544
|
const subject = getRateLimitSubject(strategy, ctx);
|
|
@@ -556,15 +547,24 @@ async function resolveSubject(strategy, ipOpts, ctx) {
|
|
|
556
547
|
if (strategy === "user" && auth?.userId !== void 0) return `u:${auth.userId}`;
|
|
557
548
|
if (strategy === "session" && auth?.sessionId !== void 0) return `s:${auth.sessionId}`;
|
|
558
549
|
}
|
|
559
|
-
return `ip:${
|
|
550
|
+
return `ip:${clientIp(trustProxy, ctx)}`;
|
|
560
551
|
}
|
|
561
|
-
|
|
562
|
-
|
|
552
|
+
/** Hop 0 (the socket peer) is the one trusted proxy. */
|
|
553
|
+
const trustOneHop = (_addr, hop) => hop < 1;
|
|
554
|
+
/**
|
|
555
|
+
* `trustProxy: true` resolves like wooks' deprecated `getIp({ trustProxy: true })`
|
|
556
|
+
* (one trusted hop, the right-most forwarded entry; `''` with no known peer)
|
|
557
|
+
* without its deprecation notice; otherwise the app's own `getIp()`.
|
|
558
|
+
*/
|
|
559
|
+
function clientIp(trustProxy, ctx) {
|
|
560
|
+
const req = useRequest(ctx);
|
|
561
|
+
return trustProxy ? resolveForwarded(req.raw, trustOneHop).ip : req.getIp();
|
|
562
|
+
}
|
|
563
|
+
// src/rate-limit/mate.ts
|
|
563
564
|
function getRateLimitMate() {
|
|
564
565
|
return getMoostMate();
|
|
565
566
|
}
|
|
566
|
-
|
|
567
|
-
//#region src/rate-limit/decorator.ts
|
|
567
|
+
// src/rate-limit/decorator.ts
|
|
568
568
|
function RateLimit(...args) {
|
|
569
569
|
const mate = getRateLimitMate();
|
|
570
570
|
if (args.length === 1 && args[0] === false) return mate.decorate("rateLimitDisabled", true);
|
|
@@ -599,8 +599,7 @@ function RateLimited(opts) {
|
|
|
599
599
|
interceptPost(target, key, descriptor);
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
|
-
|
|
603
|
-
//#region src/workflow/invite-outlet.ts
|
|
602
|
+
// src/workflow/invite-outlet.ts
|
|
604
603
|
/** Name of the outlet `AuthWorkflow` pauses on for `inviteDelivery: 'deliver' | 'return-link'`. */
|
|
605
604
|
const INVITE_OUTLET = "invite";
|
|
606
605
|
const pendingInviteLinkKey = key("aooth.invite.pendingLink");
|
|
@@ -636,13 +635,11 @@ function createInviteOutlet() {
|
|
|
636
635
|
}
|
|
637
636
|
};
|
|
638
637
|
}
|
|
639
|
-
|
|
640
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateMetadata.js
|
|
638
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorateMetadata.js
|
|
641
639
|
function __decorateMetadata(k, v) {
|
|
642
640
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
643
641
|
}
|
|
644
|
-
|
|
645
|
-
//#region src/wf-trigger/provider.ts
|
|
642
|
+
// src/wf-trigger/provider.ts
|
|
646
643
|
/**
|
|
647
644
|
* Derive the exact 32-byte key the encapsulated wf-state strategy requires from
|
|
648
645
|
* an arbitrary-length app secret.
|
|
@@ -793,8 +790,7 @@ let WfTriggerProvider = class WfTriggerProvider {
|
|
|
793
790
|
}
|
|
794
791
|
};
|
|
795
792
|
WfTriggerProvider = __decorate([Injectable(), __decorateMetadata("design:paramtypes", [typeof MoostWf === "undefined" ? Object : MoostWf, typeof AuthCredential === "undefined" ? Object : AuthCredential])], WfTriggerProvider);
|
|
796
|
-
|
|
797
|
-
//#region src/wf-trigger/decorator.ts
|
|
793
|
+
// src/wf-trigger/decorator.ts
|
|
798
794
|
/**
|
|
799
795
|
* Method decorator that turns a handler into a workflow trigger.
|
|
800
796
|
*
|
|
@@ -848,8 +844,7 @@ async function buildOAuthAuthorizeRequest(registry, provider, input) {
|
|
|
848
844
|
})
|
|
849
845
|
};
|
|
850
846
|
}
|
|
851
|
-
|
|
852
|
-
//#region src/oauth/oauth-csrf.ts
|
|
847
|
+
// src/oauth/oauth-csrf.ts
|
|
853
848
|
/**
|
|
854
849
|
* Name of the double-submit anti-CSRF cookie set at `/:provider/start` and
|
|
855
850
|
* verified in `oauth-exchange`. Holds the signed-state `random`; the callback
|
|
@@ -869,7 +864,7 @@ function oauthCsrfCookieAttrs(opts) {
|
|
|
869
864
|
secure: opts.secure,
|
|
870
865
|
sameSite: "Lax",
|
|
871
866
|
path: opts.path ?? "/",
|
|
872
|
-
maxAge:
|
|
867
|
+
maxAge: `${opts.maxAgeSec ?? 600}s`
|
|
873
868
|
};
|
|
874
869
|
}
|
|
875
870
|
/**
|
|
@@ -891,8 +886,7 @@ function safeEqual(a, b) {
|
|
|
891
886
|
if (ab.length !== bb.length) return false;
|
|
892
887
|
return timingSafeEqual(ab, bb);
|
|
893
888
|
}
|
|
894
|
-
|
|
895
|
-
//#region src/authz/authz-binding.ts
|
|
889
|
+
// src/authz/authz-binding.ts
|
|
896
890
|
/**
|
|
897
891
|
* Name of the double-submit cookie that binds an in-flight authorization
|
|
898
892
|
* request to the browser that started it. Set at `GET /auth/authorize` (holding
|
|
@@ -926,8 +920,7 @@ function authzBindingCookieAttrs(opts) {
|
|
|
926
920
|
maxAgeSec: opts.maxAgeSec
|
|
927
921
|
});
|
|
928
922
|
}
|
|
929
|
-
|
|
930
|
-
//#region src/authz/authz-redirect.ts
|
|
923
|
+
// src/authz/authz-redirect.ts
|
|
931
924
|
/**
|
|
932
925
|
* Build the client redirect URL for an authorization-server result (RFC 6749
|
|
933
926
|
* §4.1.2 / §4.1.2.1): append the result params (`code` on success, `error` on
|
|
@@ -941,8 +934,7 @@ function authzRedirectUrl(redirectUri, params) {
|
|
|
941
934
|
for (const [key, value] of Object.entries(params)) if (value !== void 0) url.searchParams.set(key, value);
|
|
942
935
|
return url.toString();
|
|
943
936
|
}
|
|
944
|
-
|
|
945
|
-
//#region src/oauth/oauth-redirect.ts
|
|
937
|
+
// src/oauth/oauth-redirect.ts
|
|
946
938
|
/**
|
|
947
939
|
* Open-redirect defense for the post-login `redirect` carried across the OAuth
|
|
948
940
|
* bounce (RFC IDP.md §7). The provider round-trips whatever target the SPA
|
|
@@ -977,8 +969,7 @@ function isSafeRelativeRedirect(target) {
|
|
|
977
969
|
function resolveOAuthRedirect(requested, fallback) {
|
|
978
970
|
return isSafeRelativeRedirect(requested) ? requested : fallback;
|
|
979
971
|
}
|
|
980
|
-
|
|
981
|
-
//#region src/authz/authz-tokens.ts
|
|
972
|
+
// src/authz/authz-tokens.ts
|
|
982
973
|
/**
|
|
983
974
|
* Explicit string DI tokens for the ABSTRACT authorization-server stores
|
|
984
975
|
* ({@link import("@aooth/auth/authz").PendingAuthorizationStore},
|
|
@@ -1023,15 +1014,13 @@ const CLIENT_REDIRECT_POLICY_TOKEN = "aooth:ClientRedirectPolicy";
|
|
|
1023
1014
|
* backs the `DynamicClientPolicy` composed into the redirect policy.
|
|
1024
1015
|
*/
|
|
1025
1016
|
const DYNAMIC_CLIENT_STORE_TOKEN = "aooth:DynamicClientStore";
|
|
1026
|
-
|
|
1027
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
1017
|
+
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorateParam.js
|
|
1028
1018
|
function __decorateParam(paramIndex, decorator) {
|
|
1029
1019
|
return function(target, key) {
|
|
1030
1020
|
decorator(target, key, paramIndex);
|
|
1031
1021
|
};
|
|
1032
1022
|
}
|
|
1033
|
-
|
|
1034
|
-
//#region src/authz/authorize-runtime.ts
|
|
1023
|
+
// src/authz/authorize-runtime.ts
|
|
1035
1024
|
let AuthorizeRuntime = class AuthorizeRuntime {
|
|
1036
1025
|
pending;
|
|
1037
1026
|
codes;
|
|
@@ -1046,8 +1035,7 @@ AuthorizeRuntime = __decorate([
|
|
|
1046
1035
|
__decorateParam(1, Inject(AUTH_CODE_STORE_TOKEN)),
|
|
1047
1036
|
__decorateMetadata("design:paramtypes", [Object, Object])
|
|
1048
1037
|
], AuthorizeRuntime);
|
|
1049
|
-
|
|
1050
|
-
//#region src/oauth/oauth-runtime.ts
|
|
1038
|
+
// src/oauth/oauth-runtime.ts
|
|
1051
1039
|
let OAuthRuntime = class OAuthRuntime {
|
|
1052
1040
|
registry;
|
|
1053
1041
|
federated;
|
|
@@ -1057,8 +1045,7 @@ let OAuthRuntime = class OAuthRuntime {
|
|
|
1057
1045
|
}
|
|
1058
1046
|
};
|
|
1059
1047
|
OAuthRuntime = __decorate([Injectable(), __decorateMetadata("design:paramtypes", [typeof OAuthProviderRegistry === "undefined" ? Object : OAuthProviderRegistry, typeof FederatedLoginService === "undefined" ? Object : FederatedLoginService])], OAuthRuntime);
|
|
1060
|
-
|
|
1061
|
-
//#region src/workflow/auth-messages.ts
|
|
1048
|
+
// src/workflow/auth-messages.ts
|
|
1062
1049
|
/**
|
|
1063
1050
|
* Code-keyed catalogue of every user-facing text `AuthWorkflow` produces —
|
|
1064
1051
|
* form errors, banners, finish envelopes and button labels. Templates are
|
|
@@ -1074,6 +1061,7 @@ const AOOTH_MESSAGES = {
|
|
|
1074
1061
|
INVALID_PASSWORD: "Invalid password",
|
|
1075
1062
|
INCORRECT_PASSWORD: "Incorrect password",
|
|
1076
1063
|
SESSION_LIMIT_REACHED: "Session limit reached",
|
|
1064
|
+
PASSWORD_CHANGED_SIGN_IN_AGAIN: "Your password was changed. Please sign in again.",
|
|
1077
1065
|
INVALID_CODE: "Invalid code",
|
|
1078
1066
|
/** Params: `seconds`. */
|
|
1079
1067
|
RESEND_WAIT: "Please wait {seconds}s before requesting a new code.",
|
|
@@ -1129,8 +1117,7 @@ function resolveAoothMessage(code, params = {}, messages) {
|
|
|
1129
1117
|
} else if (messages?.[code] !== void 0) return renderAoothMessage(messages[code], params);
|
|
1130
1118
|
return renderAoothMessage(AOOTH_MESSAGES[code], params);
|
|
1131
1119
|
}
|
|
1132
|
-
|
|
1133
|
-
//#region src/workflow/auth-workflow.schemas.ts
|
|
1120
|
+
// src/workflow/auth-workflow.schemas.ts
|
|
1134
1121
|
/**
|
|
1135
1122
|
* Canonical OTP send-then-check pair. Used by:
|
|
1136
1123
|
* - Login's MFA-loop SMS/email challenge sub-branch (the outer MFA while provides iteration)
|
|
@@ -1285,6 +1272,9 @@ const mfaLoopSchema = [{ id: "prepare-mfa" }, {
|
|
|
1285
1272
|
/**
|
|
1286
1273
|
* Forced password change — used by login.flow + invite.start (NOT recovery — recovery's
|
|
1287
1274
|
* gating differs: gated directly on `otp.verified`, NOT `newPasswordRequired`).
|
|
1275
|
+
* login.flow revokes the user's existing sessions after its MFA loop (gated on
|
|
1276
|
+
* `ctx.passwordChanged`), never here: the old password alone must not be
|
|
1277
|
+
* enough to sign the user out everywhere.
|
|
1288
1278
|
*/
|
|
1289
1279
|
const passwordPhaseSchema = [{
|
|
1290
1280
|
condition: (ctx) => !!ctx.newPasswordRequired,
|
|
@@ -1297,8 +1287,7 @@ const consentsPersistTailSchema = [{
|
|
|
1297
1287
|
id: "persist-consents",
|
|
1298
1288
|
condition: (ctx) => (ctx.consents?.pending?.length ?? 0) > 0 && !!ctx.consents?.decidedAt
|
|
1299
1289
|
}];
|
|
1300
|
-
|
|
1301
|
-
//#region src/workflow/auth-workflow.ts
|
|
1290
|
+
// src/workflow/auth-workflow.ts
|
|
1302
1291
|
/**
|
|
1303
1292
|
* Unified `AuthWorkflow` — single concrete class with three `@Workflow`
|
|
1304
1293
|
* methods (`loginFlow`, `inviteFlow`, `recoveryFlow`) replacing the prior
|
|
@@ -1368,7 +1357,7 @@ const warnedOnce = {
|
|
|
1368
1357
|
crossIssuerReuse: false
|
|
1369
1358
|
};
|
|
1370
1359
|
/** Sliding lifetime of a shadow failure counter (and of a shadow "permanent" lock). */
|
|
1371
|
-
const SHADOW_TTL_MS =
|
|
1360
|
+
const SHADOW_TTL_MS = 2592e6;
|
|
1372
1361
|
/** Key prefix of an active shadow lock (kept longest by the default store). */
|
|
1373
1362
|
const SHADOW_LOCK_PREFIX = "shadow-lock:";
|
|
1374
1363
|
/** Cap of the default (process-wide, in-memory) shadow-lockout store. */
|
|
@@ -1384,7 +1373,7 @@ function defaultShadowStore() {
|
|
|
1384
1373
|
function mergeAuthWorkflowOpts(opts) {
|
|
1385
1374
|
const deviceTrust = {
|
|
1386
1375
|
cookieName: "aooth_trusted_device",
|
|
1387
|
-
ttlMs:
|
|
1376
|
+
ttlMs: 864e5,
|
|
1388
1377
|
bindsTo: "cookie",
|
|
1389
1378
|
...opts.deviceTrust
|
|
1390
1379
|
};
|
|
@@ -1401,17 +1390,17 @@ function mergeAuthWorkflowOpts(opts) {
|
|
|
1401
1390
|
lockoutShadowStore: opts.lockoutShadowStore ?? defaultShadowStore(),
|
|
1402
1391
|
mfa: {
|
|
1403
1392
|
pincodeLength: opts.mfa?.pincodeLength ?? 6,
|
|
1404
|
-
pincodeTtlMs: opts.mfa?.pincodeTtlMs ??
|
|
1393
|
+
pincodeTtlMs: opts.mfa?.pincodeTtlMs ?? 3e5,
|
|
1405
1394
|
pincodeResendTimeoutMs: opts.mfa?.pincodeResendTimeoutMs ?? 6e4,
|
|
1406
1395
|
pincodeMaxAttempts: opts.mfa?.pincodeMaxAttempts ?? 5
|
|
1407
1396
|
},
|
|
1408
|
-
recoveryStateTtlMs: opts.recoveryStateTtlMs ??
|
|
1397
|
+
recoveryStateTtlMs: opts.recoveryStateTtlMs ?? 36e5,
|
|
1409
1398
|
loginUrl: opts.loginUrl ?? "/login",
|
|
1410
1399
|
totpIssuer: opts.totpIssuer ?? "aooth",
|
|
1411
1400
|
deviceTrust,
|
|
1412
1401
|
deviceRecognition: {
|
|
1413
1402
|
cookieName: opts.deviceRecognition?.cookieName ?? `${deviceTrust.cookieName}_seen`,
|
|
1414
|
-
ttlMs: opts.deviceRecognition?.ttlMs ??
|
|
1403
|
+
ttlMs: opts.deviceRecognition?.ttlMs ?? 15552e6,
|
|
1415
1404
|
maxDevices: opts.deviceRecognition?.maxDevices ?? SEEN_DEVICES_DEFAULT_CAP
|
|
1416
1405
|
},
|
|
1417
1406
|
forms: {
|
|
@@ -1556,7 +1545,7 @@ const ALT_HANDLED = Symbol("ALT_HANDLED");
|
|
|
1556
1545
|
* industry-standard invite-link window (Slack/GitHub/Atlassian). Override by
|
|
1557
1546
|
* re-decorating the step in a subclass.
|
|
1558
1547
|
*/
|
|
1559
|
-
const INVITE_LINK_TTL_MS =
|
|
1548
|
+
const INVITE_LINK_TTL_MS = 6048e5;
|
|
1560
1549
|
/** One canonical form of a chosen username: Unicode NFKC, surrounding whitespace trimmed. */
|
|
1561
1550
|
function normalizeUsername(raw) {
|
|
1562
1551
|
return String(raw).normalize("NFKC").trim();
|
|
@@ -2086,7 +2075,8 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
2086
2075
|
* successful change (OWASP Session Management) and applies NO rate limit —
|
|
2087
2076
|
* current-password re-entry (enforced by `UserService.changePassword`) is the
|
|
2088
2077
|
* primary protection, not throttling. Customers override to add a min-interval
|
|
2089
|
-
* (`rateLimit.minIntervalMs`) or to keep other sessions alive.
|
|
2078
|
+
* (`rateLimit.minIntervalMs`) or to keep other sessions alive. The session the
|
|
2079
|
+
* change was made from is always ended (see `finish-change-password`).
|
|
2090
2080
|
*
|
|
2091
2081
|
* Whether the flow may be STARTED at all is governed by arbac on the trigger
|
|
2092
2082
|
* route (deny the `change-password` action to forbid it for SSO-only orgs) —
|
|
@@ -3028,6 +3018,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
3028
3018
|
try {
|
|
3029
3019
|
const result = await this.users.login(input.username, input.password, this.lockoutOverride(ctx));
|
|
3030
3020
|
ctx.subject = result.user.id;
|
|
3021
|
+
ctx.passwordStamp = result.user.password.lastChanged ?? 0;
|
|
3031
3022
|
ctx.loginRecorded = true;
|
|
3032
3023
|
swapStrategy("store");
|
|
3033
3024
|
if (ctx.guards?.passwordInitial && result.user.password.isInitial) ctx.isPasswordInitial = true;
|
|
@@ -3096,11 +3087,12 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
3096
3087
|
*/
|
|
3097
3088
|
async handleCredentialsAlt(action, typedUsername, alt, authzHandle) {
|
|
3098
3089
|
if (action === "forgotPassword" && alt.forgotPassword) {
|
|
3090
|
+
const url = this.resolveRecoveryUrl(typedUsername, alt);
|
|
3099
3091
|
finishWf({ next: {
|
|
3100
3092
|
trigger: "immediate",
|
|
3101
3093
|
action: {
|
|
3102
3094
|
type: "redirect",
|
|
3103
|
-
target:
|
|
3095
|
+
target: url,
|
|
3104
3096
|
reason: "forgot-password"
|
|
3105
3097
|
}
|
|
3106
3098
|
} });
|
|
@@ -3736,6 +3728,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
3736
3728
|
this.processInlineConsent(ctx, input, wf);
|
|
3737
3729
|
ctx.isPasswordInitial = false;
|
|
3738
3730
|
ctx.isPasswordExpired = false;
|
|
3731
|
+
ctx.passwordChanged = true;
|
|
3739
3732
|
ctx.newPasswordRequired = false;
|
|
3740
3733
|
delete password.changeReason;
|
|
3741
3734
|
delete password.heading;
|
|
@@ -3801,16 +3794,42 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
3801
3794
|
}
|
|
3802
3795
|
}
|
|
3803
3796
|
/**
|
|
3804
|
-
* Change-password terminal —
|
|
3805
|
-
*
|
|
3806
|
-
*
|
|
3807
|
-
*
|
|
3808
|
-
*
|
|
3797
|
+
* Change-password terminal — sign the current device in on a FRESH session
|
|
3798
|
+
* and end the one the change was made from, then emit a success message.
|
|
3799
|
+
* The new pair is minted under a new session id, so the pre-change session
|
|
3800
|
+
* (its access token, refresh token and every rotation) is revoked here —
|
|
3801
|
+
* whatever `revokeOtherSessions` says, since that policy covers only the
|
|
3802
|
+
* user's OTHER sessions. Runs AFTER the optional `revoke-sessions` step, so
|
|
3803
|
+
* the default net effect is "kill every old session, keep this device on a
|
|
3804
|
+
* new one" (OWASP Session Management: no ghost sessions survive a credential
|
|
3805
|
+
* change).
|
|
3806
|
+
*
|
|
3807
|
+
* The pre-change session is revoked BEFORE the issue, so a failed issue
|
|
3808
|
+
* (store error, `maxConcurrent` refusal) leaves the user signed out, never on
|
|
3809
|
+
* the old session. A refresh in flight during the change is covered by
|
|
3810
|
+
* `AuthCredential`'s revocation protocol (it can't leave live credentials in
|
|
3811
|
+
* a revoked session).
|
|
3812
|
+
*
|
|
3813
|
+
* When one session can't be targeted — a stateless store (JWT /
|
|
3814
|
+
* encapsulated), or a legacy credential minted before `sessionId` existed
|
|
3815
|
+
* (its fallback id, the access token's fingerprint, never reaches the refresh
|
|
3816
|
+
* row) — ALL of the user's sessions are revoked (`revokeAllForUser`, also
|
|
3817
|
+
* under `revokeOtherSessions: false`). A stateless store also denylists the
|
|
3818
|
+
* presented access token (best effort): its revocation epoch is process-local.
|
|
3809
3819
|
*/
|
|
3810
3820
|
async finishChangePassword(ctx) {
|
|
3811
3821
|
this.requireSubject(ctx);
|
|
3812
|
-
const issue = await this.issueForContext(ctx);
|
|
3813
3822
|
const auth = useAuth();
|
|
3823
|
+
const prior = auth.getAuthContext();
|
|
3824
|
+
const priorSessionId = prior?.sessionId;
|
|
3825
|
+
const stateful = this.auth.canEnumerateSessions;
|
|
3826
|
+
if (stateful && priorSessionId !== void 0 && priorSessionId !== prior?.credentialId) await this.auth.revokeSession(ctx.subject, priorSessionId);
|
|
3827
|
+
else {
|
|
3828
|
+
await this.auth.revokeAllForUser(ctx.subject);
|
|
3829
|
+
const accessToken = stateful ? void 0 : auth.extractToken();
|
|
3830
|
+
if (accessToken) await this.auth.revoke(accessToken).catch(() => void 0);
|
|
3831
|
+
}
|
|
3832
|
+
const issue = await this.issueForContext(ctx);
|
|
3814
3833
|
const envelope = {
|
|
3815
3834
|
finished: true,
|
|
3816
3835
|
data: auth.buildLoginResponse(ctx.subject, issue),
|
|
@@ -4880,15 +4899,20 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
4880
4899
|
}
|
|
4881
4900
|
/**
|
|
4882
4901
|
* Revoke the user's existing sessions. Shared by recovery (gated upstream by
|
|
4883
|
-
* `ctx.postReset.revokeAllSessions`)
|
|
4884
|
-
* by `ctx.changePassword.revokeOtherSessions`)
|
|
4902
|
+
* `ctx.postReset.revokeAllSessions`), authenticated change-password (gated
|
|
4903
|
+
* by `ctx.changePassword.revokeOtherSessions`) and the forced password change
|
|
4904
|
+
* at login / invite (gated by `ctx.passwordChanged`).
|
|
4885
4905
|
*
|
|
4886
4906
|
* - Change-password runs in an authenticated context, so we KEEP the caller's
|
|
4887
|
-
* current
|
|
4907
|
+
* current session via `revokeOtherSessions(username, currentSessionId)` —
|
|
4888
4908
|
* OWASP "invalidate other sessions" without logging the user out of the tab
|
|
4889
|
-
* they just changed their password in.
|
|
4890
|
-
*
|
|
4891
|
-
*
|
|
4909
|
+
* they just changed their password in. `finish-change-password` then moves
|
|
4910
|
+
* that tab onto a fresh session and revokes the kept one (and covers stores
|
|
4911
|
+
* that cannot enumerate, where `revokeOtherSessions` is a no-op). If the
|
|
4912
|
+
* current session can't be resolved (no session id), fall back to revoking
|
|
4913
|
+
* everything (fail-secure).
|
|
4914
|
+
* - Recovery and the forced change are anonymous (no current session to
|
|
4915
|
+
* keep) → `revokeAllForUser`.
|
|
4892
4916
|
*/
|
|
4893
4917
|
async revokeSessions(ctx) {
|
|
4894
4918
|
if (!ctx.subject) return void 0;
|
|
@@ -4907,6 +4931,25 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
4907
4931
|
await this.users.unlockAccount(ctx.subject);
|
|
4908
4932
|
}
|
|
4909
4933
|
/**
|
|
4934
|
+
* Login-only guard before the `record-login` funnel (and again before
|
|
4935
|
+
* `mint-authz-code`, past the consent pause): the account's
|
|
4936
|
+
* `password.lastChanged` must still be the one the `credentials` step
|
|
4937
|
+
* verified (`ctx.passwordStamp`). A run paused after the password check (MFA,
|
|
4938
|
+
* enrolment, consents …) and resumed after the password was changed
|
|
4939
|
+
* elsewhere finishes with an error instead of issuing tokens or minting an
|
|
4940
|
+
* authorization code. Skipped when this run changed the password itself.
|
|
4941
|
+
*/
|
|
4942
|
+
async checkPasswordUnchanged(ctx) {
|
|
4943
|
+
this.requireSubject(ctx);
|
|
4944
|
+
if (((await this.users.getUser(ctx.subject)).password.lastChanged ?? 0) !== ctx.passwordStamp) {
|
|
4945
|
+
ctx.aborted = true;
|
|
4946
|
+
finishWf({ message: {
|
|
4947
|
+
level: "error",
|
|
4948
|
+
text: this.msg("PASSWORD_CHANGED_SIGN_IN_AGAIN")
|
|
4949
|
+
} });
|
|
4950
|
+
}
|
|
4951
|
+
}
|
|
4952
|
+
/**
|
|
4910
4953
|
* The SINGLE login-completion funnel. Every flow that establishes an
|
|
4911
4954
|
* authenticated session routes through here — placed in each login schema
|
|
4912
4955
|
* right after the guards and BEFORE the delivery terminal (`issue` /
|
|
@@ -4991,7 +5034,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
4991
5034
|
...cookies,
|
|
4992
5035
|
[name]: {
|
|
4993
5036
|
value,
|
|
4994
|
-
options: auth.cookieAttrs({ maxAge: ttlMs })
|
|
5037
|
+
options: auth.cookieAttrs({ maxAge: `${Math.max(0, Math.floor(ttlMs / 1e3))}s` })
|
|
4995
5038
|
}
|
|
4996
5039
|
};
|
|
4997
5040
|
};
|
|
@@ -6423,6 +6466,14 @@ __decorate([
|
|
|
6423
6466
|
__decorateMetadata("design:paramtypes", [Object]),
|
|
6424
6467
|
__decorateMetadata("design:returntype", Promise)
|
|
6425
6468
|
], AuthWorkflow.prototype, "unlockAccount", null);
|
|
6469
|
+
__decorate([
|
|
6470
|
+
Step("check-password-unchanged"),
|
|
6471
|
+
Public(),
|
|
6472
|
+
__decorateParam(0, WorkflowParam("context")),
|
|
6473
|
+
__decorateMetadata("design:type", Function),
|
|
6474
|
+
__decorateMetadata("design:paramtypes", [Object]),
|
|
6475
|
+
__decorateMetadata("design:returntype", Promise)
|
|
6476
|
+
], AuthWorkflow.prototype, "checkPasswordUnchanged", null);
|
|
6426
6477
|
__decorate([
|
|
6427
6478
|
Step("record-login"),
|
|
6428
6479
|
Public(),
|
|
@@ -6654,6 +6705,10 @@ __decorate([
|
|
|
6654
6705
|
condition: (ctx) => !!ctx.enrollment?.ensurePhone && !!ctx.channel?.phone && !ctx.channel?.phoneConfirmed
|
|
6655
6706
|
},
|
|
6656
6707
|
...mfaLoopSchema,
|
|
6708
|
+
{
|
|
6709
|
+
id: "revoke-sessions",
|
|
6710
|
+
condition: (ctx) => !!ctx.passwordChanged && !ctx.aborted
|
|
6711
|
+
},
|
|
6657
6712
|
{
|
|
6658
6713
|
id: "device-trust",
|
|
6659
6714
|
condition: (ctx) => !!ctx.deviceTrust?.enabled && !!ctx.otp?.verified && !!ctx.trust?.newDevice && (!ctx.deviceTrust?.optIn || !!ctx.trust?.rememberDevice)
|
|
@@ -6675,6 +6730,11 @@ __decorate([
|
|
|
6675
6730
|
}]
|
|
6676
6731
|
},
|
|
6677
6732
|
{ break: (ctx) => !!ctx.aborted },
|
|
6733
|
+
{
|
|
6734
|
+
id: "check-password-unchanged",
|
|
6735
|
+
condition: (ctx) => ctx.passwordStamp !== void 0 && !ctx.passwordChanged
|
|
6736
|
+
},
|
|
6737
|
+
{ break: (ctx) => !!ctx.aborted },
|
|
6678
6738
|
{
|
|
6679
6739
|
id: "record-login",
|
|
6680
6740
|
condition: (ctx) => !!ctx.subject && !ctx.authz?.silent
|
|
@@ -6695,6 +6755,11 @@ __decorate([
|
|
|
6695
6755
|
id: "authz-consent",
|
|
6696
6756
|
condition: (ctx) => !!ctx.authz
|
|
6697
6757
|
},
|
|
6758
|
+
{
|
|
6759
|
+
id: "check-password-unchanged",
|
|
6760
|
+
condition: (ctx) => ctx.authz?.approved === true && ctx.passwordStamp !== void 0 && !ctx.passwordChanged
|
|
6761
|
+
},
|
|
6762
|
+
{ break: (ctx) => !!ctx.aborted },
|
|
6698
6763
|
{
|
|
6699
6764
|
id: "mint-authz-code",
|
|
6700
6765
|
condition: (ctx) => ctx.authz?.approved === true
|
|
@@ -6944,8 +7009,7 @@ AuthWorkflow = _AuthWorkflow = __decorate([
|
|
|
6944
7009
|
typeof ConsentStore === "undefined" ? Object : ConsentStore
|
|
6945
7010
|
])
|
|
6946
7011
|
], AuthWorkflow);
|
|
6947
|
-
|
|
6948
|
-
//#region src/auth.controller.ts
|
|
7012
|
+
// src/auth.controller.ts
|
|
6949
7013
|
/** Workflows allowed by the bundled `/auth/trigger` endpoint. Subclasses override `triggerWf()` to extend. */
|
|
6950
7014
|
const DEFAULT_AUTH_WORKFLOWS = [
|
|
6951
7015
|
"auth/login/flow",
|
|
@@ -7021,16 +7085,17 @@ let AuthController = class AuthController {
|
|
|
7021
7085
|
const auth = useAuth();
|
|
7022
7086
|
const refreshToken = resolveRefreshToken(auth, body);
|
|
7023
7087
|
if (!refreshToken) throw new HttpError$1(401, "Missing refresh token");
|
|
7088
|
+
const fromBody = typeof body?.refreshToken === "string";
|
|
7024
7089
|
let issue;
|
|
7025
7090
|
try {
|
|
7026
7091
|
issue = await this.auth.refresh(refreshToken);
|
|
7027
7092
|
} catch (err) {
|
|
7028
|
-
if (err instanceof AuthError) throw
|
|
7029
|
-
|
|
7093
|
+
if (!(err instanceof AuthError)) throw err;
|
|
7094
|
+
if (!fromBody) auth.clearCookies();
|
|
7095
|
+
throw new HttpError$1(401, "Invalid refresh token");
|
|
7030
7096
|
}
|
|
7031
7097
|
auth.writeCookies(issue);
|
|
7032
7098
|
const validated = await this.auth.validate(issue.accessToken);
|
|
7033
|
-
const fromBody = typeof body?.refreshToken === "string";
|
|
7034
7099
|
return auth.buildLoginResponse(validated?.userId ?? "", issue, fromBody ? { exposeTokens: true } : void 0);
|
|
7035
7100
|
}
|
|
7036
7101
|
status() {
|
|
@@ -7192,8 +7257,7 @@ AuthController = __decorate([
|
|
|
7192
7257
|
__decorateParam(1, Optional()),
|
|
7193
7258
|
__decorateMetadata("design:paramtypes", [typeof AuthCredential === "undefined" ? Object : AuthCredential, typeof UserService === "undefined" ? Object : UserService])
|
|
7194
7259
|
], AuthController);
|
|
7195
|
-
|
|
7196
|
-
//#region src/sessions.controller.ts
|
|
7260
|
+
// src/sessions.controller.ts
|
|
7197
7261
|
let SessionEnricherProvider = class SessionEnricherProvider {
|
|
7198
7262
|
enrich(session) {
|
|
7199
7263
|
return session;
|
|
@@ -7284,8 +7348,7 @@ SessionsController = __decorate([
|
|
|
7284
7348
|
ArbacResource("auth.sessions"),
|
|
7285
7349
|
__decorateMetadata("design:paramtypes", [typeof AuthCredential === "undefined" ? Object : AuthCredential, typeof SessionEnricherProvider === "undefined" ? Object : SessionEnricherProvider])
|
|
7286
7350
|
], SessionsController);
|
|
7287
|
-
|
|
7288
|
-
//#region src/oauth/oauth-tokens.ts
|
|
7351
|
+
// src/oauth/oauth-tokens.ts
|
|
7289
7352
|
/**
|
|
7290
7353
|
* Explicit string DI token for the ABSTRACT `FederatedIdentityStore`.
|
|
7291
7354
|
*
|
|
@@ -7307,8 +7370,7 @@ SessionsController = __decorate([
|
|
|
7307
7370
|
* ```
|
|
7308
7371
|
*/
|
|
7309
7372
|
const FEDERATED_IDENTITY_STORE_TOKEN = "aooth:FederatedIdentityStore";
|
|
7310
|
-
|
|
7311
|
-
//#region src/oauth/oauth.controller.ts
|
|
7373
|
+
// src/oauth/oauth.controller.ts
|
|
7312
7374
|
let OAuthController = class OAuthController {
|
|
7313
7375
|
registry;
|
|
7314
7376
|
auth;
|
|
@@ -7492,8 +7554,7 @@ function toConnectedAccount(i) {
|
|
|
7492
7554
|
...i.avatarUrl !== void 0 && { avatarUrl: i.avatarUrl }
|
|
7493
7555
|
};
|
|
7494
7556
|
}
|
|
7495
|
-
|
|
7496
|
-
//#region src/authz/authorize.controller.ts
|
|
7557
|
+
// src/authz/authorize.controller.ts
|
|
7497
7558
|
/** Shared default claims resolver — stateless, so one instance is reused across requests. */
|
|
7498
7559
|
const NOOP_OIDC_CLAIMS_RESOLVER = new NoopOidcClaimsResolver();
|
|
7499
7560
|
let AuthorizeController = class AuthorizeController {
|
|
@@ -7978,8 +8039,7 @@ AuthorizeController = __decorate([
|
|
|
7978
8039
|
function expiresInSeconds(expiresAt) {
|
|
7979
8040
|
return Math.max(0, Math.floor((expiresAt - Date.now()) / 1e3));
|
|
7980
8041
|
}
|
|
7981
|
-
|
|
7982
|
-
//#region src/workflows/auth-email-outlet.ts
|
|
8042
|
+
// src/workflows/auth-email-outlet.ts
|
|
7983
8043
|
/**
|
|
7984
8044
|
* Build the email outlet that delivers magic links via the consumer's
|
|
7985
8045
|
* `EmailSender`. Single-use: pass the same instance into one
|
|
@@ -8006,5 +8066,4 @@ function createAuthEmailOutlet(deps) {
|
|
|
8006
8066
|
await deps.emailSender.send(event);
|
|
8007
8067
|
});
|
|
8008
8068
|
}
|
|
8009
|
-
//#endregion
|
|
8010
8069
|
export { ADD_MFA_WORKFLOW, AOOTH_MESSAGES, AUTHZ_BINDING_COOKIE, AUTH_CODE_STORE_TOKEN, AuthController, AuthGuarded, AuthWorkflow, AuthorizeController, AuthorizeRuntime, CHANGE_PASSWORD_WORKFLOW, CLIENT_REDIRECT_POLICY_TOKEN, ConsentStore, DEFAULT_AUTH_WORKFLOWS, DYNAMIC_CLIENT_STORE_TOKEN, DynamicClientRegistration, FEDERATED_IDENTITY_STORE_TOKEN, INVITE_OUTLET, OAUTH_CSRF_COOKIE, OAuthController, OAuthRuntime, PENDING_AUTHORIZATION_STORE_TOKEN, Public, RESERVED_USER_KEYS, RateLimit, RateLimitStoreMemory, RateLimited, RateLimiter, SessionEnricherProvider, SessionsController, UserId, WfTrigger, WfTriggerProvider, 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 };
|