@bymax-one/nest-auth 1.3.1 → 1.3.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/CHANGELOG.md +48 -1
- package/README.md +5 -3
- package/dist/server/index.cjs +1098 -336
- package/dist/server/index.d.cts +135 -11
- package/dist/server/index.d.ts +135 -11
- package/dist/server/index.mjs +1098 -336
- package/dist/shared/index.d.cts +8 -0
- package/dist/shared/index.d.ts +8 -0
- package/package.json +2 -2
package/dist/server/index.cjs
CHANGED
|
@@ -308,6 +308,7 @@ function resolveOptions(userOptions) {
|
|
|
308
308
|
validateBruteForce(userOptions.bruteForce);
|
|
309
309
|
validateOAuthProviders(userOptions.oauth, isProductionDeployment(userOptions));
|
|
310
310
|
validateClientIpSource(userOptions.rateLimit);
|
|
311
|
+
validateTenantBinding(userOptions);
|
|
311
312
|
validateOAuthSuccessRedirectUrl(userOptions);
|
|
312
313
|
validateOAuthMfaRedirectUrl(userOptions);
|
|
313
314
|
const { issuer: rawIssuer, audience: rawAudience, ...jwtWithoutBinding } = userOptions.jwt;
|
|
@@ -461,6 +462,12 @@ function validateClientIpSource(rateLimit) {
|
|
|
461
462
|
throw new Error(`[BymaxAuthModule] rateLimit.clientIpSource must be 'peer' or 'trusted-proxy' when rate limiting is enabled (current: ${JSON.stringify(rateLimit?.clientIpSource)}). Set 'peer' when the application is directly exposed (the limit keys on the socket address), or 'trusted-proxy' when it runs behind a proxy and 'trust proxy' is configured for the real hop count (the limit keys on the forwarded client address). There is no default: 'peer' behind a proxy puts every client in ONE bucket, so one caller can rate-limit your whole user base, and 'trusted-proxy' without a proxy lets the caller choose their own key. Both look like a working limiter. Pass rateLimit.enabled: false if the limits are enforced at the edge instead.`);
|
|
462
463
|
}
|
|
463
464
|
__name(validateClientIpSource, "validateClientIpSource");
|
|
465
|
+
function validateTenantBinding(userOptions) {
|
|
466
|
+
if (userOptions.enforceTenantBinding === true && !userOptions.tenantIdResolver) {
|
|
467
|
+
throw new Error(`[BymaxAuthModule] enforceTenantBinding is true but no tenantIdResolver is set. The binding check re-resolves the request's tenant and refuses a token minted for a different one, so with no resolver there is nothing to compare against and every token is accepted \u2014 the control reports success while enforcing nothing. Provide a tenantIdResolver (typically the same host-to-tenant function used on the credential flows), or remove enforceTenantBinding.`);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
__name(validateTenantBinding, "validateTenantBinding");
|
|
464
471
|
function validateJwt(jwt) {
|
|
465
472
|
if (!jwt) {
|
|
466
473
|
throw new Error(`[BymaxAuthModule] jwt configuration is required. Provide at least jwt.secret.`);
|
|
@@ -1125,13 +1132,22 @@ var NO_CONTROL_CHARACTERS = /^[^\u0000-\u001F\u007F-\u009F]+$/;
|
|
|
1125
1132
|
// src/server/dto/login.dto.ts
|
|
1126
1133
|
function _ts_decorate(decorators, target, key, desc) {
|
|
1127
1134
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1128
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1129
|
-
|
|
1135
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1136
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1137
|
+
} else {
|
|
1138
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1139
|
+
if (d = decorators[i]) {
|
|
1140
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1130
1144
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1131
1145
|
}
|
|
1132
1146
|
__name(_ts_decorate, "_ts_decorate");
|
|
1133
|
-
function _ts_metadata(
|
|
1134
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1147
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
1148
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1149
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1150
|
+
}
|
|
1135
1151
|
}
|
|
1136
1152
|
__name(_ts_metadata, "_ts_metadata");
|
|
1137
1153
|
var LoginDto = class {
|
|
@@ -1197,13 +1213,22 @@ _ts_decorate([
|
|
|
1197
1213
|
], LoginDto.prototype, "tenantId", void 0);
|
|
1198
1214
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
1199
1215
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1200
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1201
|
-
|
|
1216
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1217
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1218
|
+
} else {
|
|
1219
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1220
|
+
if (d = decorators[i]) {
|
|
1221
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1202
1225
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1203
1226
|
}
|
|
1204
1227
|
__name(_ts_decorate2, "_ts_decorate");
|
|
1205
|
-
function _ts_metadata2(
|
|
1206
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1228
|
+
function _ts_metadata2(metadataKey, metadataValue) {
|
|
1229
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1230
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1231
|
+
}
|
|
1207
1232
|
}
|
|
1208
1233
|
__name(_ts_metadata2, "_ts_metadata");
|
|
1209
1234
|
var RegisterDto = class {
|
|
@@ -1279,13 +1304,22 @@ _ts_decorate2([
|
|
|
1279
1304
|
], RegisterDto.prototype, "tenantId", void 0);
|
|
1280
1305
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
1281
1306
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1282
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1283
|
-
|
|
1307
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1308
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1309
|
+
} else {
|
|
1310
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1311
|
+
if (d = decorators[i]) {
|
|
1312
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1284
1316
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1285
1317
|
}
|
|
1286
1318
|
__name(_ts_decorate3, "_ts_decorate");
|
|
1287
|
-
function _ts_metadata3(
|
|
1288
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1319
|
+
function _ts_metadata3(metadataKey, metadataValue) {
|
|
1320
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1321
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1322
|
+
}
|
|
1289
1323
|
}
|
|
1290
1324
|
__name(_ts_metadata3, "_ts_metadata");
|
|
1291
1325
|
var ResendVerificationDto = class {
|
|
@@ -1320,13 +1354,22 @@ _ts_decorate3([
|
|
|
1320
1354
|
], ResendVerificationDto.prototype, "tenantId", void 0);
|
|
1321
1355
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
1322
1356
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1323
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1324
|
-
|
|
1357
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1358
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1359
|
+
} else {
|
|
1360
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1361
|
+
if (d = decorators[i]) {
|
|
1362
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1325
1366
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1326
1367
|
}
|
|
1327
1368
|
__name(_ts_decorate4, "_ts_decorate");
|
|
1328
|
-
function _ts_metadata4(
|
|
1329
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1369
|
+
function _ts_metadata4(metadataKey, metadataValue) {
|
|
1370
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1371
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1372
|
+
}
|
|
1330
1373
|
}
|
|
1331
1374
|
__name(_ts_metadata4, "_ts_metadata");
|
|
1332
1375
|
var VerifyEmailDto = class {
|
|
@@ -1644,13 +1687,22 @@ var AuthException = class extends common.HttpException {
|
|
|
1644
1687
|
};
|
|
1645
1688
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1646
1689
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1647
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1648
|
-
|
|
1690
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1691
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1692
|
+
} else {
|
|
1693
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1694
|
+
if (d = decorators[i]) {
|
|
1695
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1649
1699
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1650
1700
|
}
|
|
1651
1701
|
__name(_ts_decorate5, "_ts_decorate");
|
|
1652
|
-
function _ts_metadata5(
|
|
1653
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1702
|
+
function _ts_metadata5(metadataKey, metadataValue) {
|
|
1703
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1704
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1705
|
+
}
|
|
1654
1706
|
}
|
|
1655
1707
|
__name(_ts_metadata5, "_ts_metadata");
|
|
1656
1708
|
function _ts_param(paramIndex, decorator) {
|
|
@@ -2596,13 +2648,22 @@ __name(toMappedIPv4, "toMappedIPv4");
|
|
|
2596
2648
|
// src/server/guards/auth-rate-limit.guard.ts
|
|
2597
2649
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
2598
2650
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2599
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2600
|
-
|
|
2651
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2652
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2653
|
+
} else {
|
|
2654
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
2655
|
+
if (d = decorators[i]) {
|
|
2656
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2601
2660
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2602
2661
|
}
|
|
2603
2662
|
__name(_ts_decorate6, "_ts_decorate");
|
|
2604
|
-
function _ts_metadata6(
|
|
2605
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2663
|
+
function _ts_metadata6(metadataKey, metadataValue) {
|
|
2664
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2665
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
2666
|
+
}
|
|
2606
2667
|
}
|
|
2607
2668
|
__name(_ts_metadata6, "_ts_metadata");
|
|
2608
2669
|
function _ts_param2(paramIndex, decorator) {
|
|
@@ -2784,13 +2845,22 @@ __name(hasRole, "hasRole");
|
|
|
2784
2845
|
// src/server/services/auth-revocation.service.ts
|
|
2785
2846
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
2786
2847
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2787
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2788
|
-
|
|
2848
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2849
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2850
|
+
} else {
|
|
2851
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
2852
|
+
if (d = decorators[i]) {
|
|
2853
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2789
2857
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2790
2858
|
}
|
|
2791
2859
|
__name(_ts_decorate7, "_ts_decorate");
|
|
2792
|
-
function _ts_metadata7(
|
|
2793
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2860
|
+
function _ts_metadata7(metadataKey, metadataValue) {
|
|
2861
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2862
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
2863
|
+
}
|
|
2794
2864
|
}
|
|
2795
2865
|
__name(_ts_metadata7, "_ts_metadata");
|
|
2796
2866
|
function _ts_param3(paramIndex, decorator) {
|
|
@@ -2836,13 +2906,22 @@ exports.AuthRevocationService = _ts_decorate7([
|
|
|
2836
2906
|
], exports.AuthRevocationService);
|
|
2837
2907
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
2838
2908
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2839
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2840
|
-
|
|
2909
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2910
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2911
|
+
} else {
|
|
2912
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
2913
|
+
if (d = decorators[i]) {
|
|
2914
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2841
2918
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2842
2919
|
}
|
|
2843
2920
|
__name(_ts_decorate8, "_ts_decorate");
|
|
2844
|
-
function _ts_metadata8(
|
|
2845
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
2921
|
+
function _ts_metadata8(metadataKey, metadataValue) {
|
|
2922
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2923
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
2924
|
+
}
|
|
2846
2925
|
}
|
|
2847
2926
|
__name(_ts_metadata8, "_ts_metadata");
|
|
2848
2927
|
function _ts_param4(paramIndex, decorator) {
|
|
@@ -3199,17 +3278,32 @@ function assertValidSub(sub) {
|
|
|
3199
3278
|
}
|
|
3200
3279
|
}
|
|
3201
3280
|
__name(assertValidSub, "assertValidSub");
|
|
3281
|
+
function assertValidTenantId(tenantId) {
|
|
3282
|
+
if (typeof tenantId !== "string" || tenantId.length === 0 || tenantId.length > MAX_SUBJECT_LENGTH) {
|
|
3283
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
__name(assertValidTenantId, "assertValidTenantId");
|
|
3202
3287
|
|
|
3203
3288
|
// src/server/guards/jwt-auth.guard.ts
|
|
3204
3289
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
3205
3290
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3206
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3207
|
-
|
|
3291
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3292
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3293
|
+
} else {
|
|
3294
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3295
|
+
if (d = decorators[i]) {
|
|
3296
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3208
3300
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3209
3301
|
}
|
|
3210
3302
|
__name(_ts_decorate9, "_ts_decorate");
|
|
3211
|
-
function _ts_metadata9(
|
|
3212
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3303
|
+
function _ts_metadata9(metadataKey, metadataValue) {
|
|
3304
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3305
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3306
|
+
}
|
|
3213
3307
|
}
|
|
3214
3308
|
__name(_ts_metadata9, "_ts_metadata");
|
|
3215
3309
|
function _ts_param5(paramIndex, decorator) {
|
|
@@ -3253,10 +3347,17 @@ exports.JwtAuthGuard = class JwtAuthGuard {
|
|
|
3253
3347
|
}
|
|
3254
3348
|
assertValidJti(payload.jti);
|
|
3255
3349
|
assertValidSub(payload.sub);
|
|
3350
|
+
assertValidTenantId(payload.tenantId);
|
|
3256
3351
|
assertTokenType(payload, "dashboard");
|
|
3257
3352
|
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
3258
3353
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3259
3354
|
}
|
|
3355
|
+
if (this.options.enforceTenantBinding === true && this.options.tenantIdResolver) {
|
|
3356
|
+
const requestTenant = await this.options.tenantIdResolver(request);
|
|
3357
|
+
if (requestTenant !== payload.tenantId) {
|
|
3358
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3260
3361
|
request.user = payload;
|
|
3261
3362
|
return true;
|
|
3262
3363
|
}
|
|
@@ -3279,13 +3380,22 @@ exports.JwtAuthGuard = _ts_decorate9([
|
|
|
3279
3380
|
], exports.JwtAuthGuard);
|
|
3280
3381
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
3281
3382
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3282
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3283
|
-
|
|
3383
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3384
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3385
|
+
} else {
|
|
3386
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3387
|
+
if (d = decorators[i]) {
|
|
3388
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3284
3392
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3285
3393
|
}
|
|
3286
3394
|
__name(_ts_decorate10, "_ts_decorate");
|
|
3287
|
-
function _ts_metadata10(
|
|
3288
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3395
|
+
function _ts_metadata10(metadataKey, metadataValue) {
|
|
3396
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3397
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3398
|
+
}
|
|
3289
3399
|
}
|
|
3290
3400
|
__name(_ts_metadata10, "_ts_metadata");
|
|
3291
3401
|
function _ts_param6(paramIndex, decorator) {
|
|
@@ -3341,13 +3451,22 @@ exports.TrustedOriginGuard = _ts_decorate10([
|
|
|
3341
3451
|
], exports.TrustedOriginGuard);
|
|
3342
3452
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
3343
3453
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3344
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3345
|
-
|
|
3454
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3455
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3456
|
+
} else {
|
|
3457
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3458
|
+
if (d = decorators[i]) {
|
|
3459
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3346
3463
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3347
3464
|
}
|
|
3348
3465
|
__name(_ts_decorate11, "_ts_decorate");
|
|
3349
|
-
function _ts_metadata11(
|
|
3350
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3466
|
+
function _ts_metadata11(metadataKey, metadataValue) {
|
|
3467
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3468
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3469
|
+
}
|
|
3351
3470
|
}
|
|
3352
3471
|
__name(_ts_metadata11, "_ts_metadata");
|
|
3353
3472
|
function _ts_param7(paramIndex, decorator) {
|
|
@@ -3373,18 +3492,30 @@ exports.UserStatusGuard = class UserStatusGuard {
|
|
|
3373
3492
|
const user = request.user;
|
|
3374
3493
|
if (!user) return true;
|
|
3375
3494
|
const userId = user.sub;
|
|
3376
|
-
const
|
|
3495
|
+
const tenantId = user.tenantId;
|
|
3496
|
+
const scope = `${encodeURIComponent(tenantId)}:${encodeURIComponent(userId)}`;
|
|
3497
|
+
const statusKey = `us:${scope}`;
|
|
3498
|
+
const verifiedKey = `uev:${scope}`;
|
|
3377
3499
|
const cacheTtl = this.options.userStatusCacheTtlSeconds;
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3500
|
+
const requireVerified = this.options.emailVerification.required;
|
|
3501
|
+
let status = await this.redis.get(statusKey);
|
|
3502
|
+
let verified = requireVerified ? await this.redis.get(verifiedKey) : null;
|
|
3503
|
+
if (status === null || requireVerified && verified === null) {
|
|
3504
|
+
const userRecord = await this.userRepo.findById(userId, tenantId);
|
|
3381
3505
|
if (!userRecord) {
|
|
3382
3506
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3383
3507
|
}
|
|
3384
3508
|
status = userRecord.status;
|
|
3385
|
-
await this.redis.set(
|
|
3509
|
+
await this.redis.set(statusKey, status, cacheTtl);
|
|
3510
|
+
if (requireVerified) {
|
|
3511
|
+
verified = userRecord.emailVerified ? "1" : "0";
|
|
3512
|
+
await this.redis.set(verifiedKey, verified, cacheTtl);
|
|
3513
|
+
}
|
|
3386
3514
|
}
|
|
3387
3515
|
assertNotBlocked(status, this.options.blockedStatuses);
|
|
3516
|
+
if (requireVerified && verified === "0") {
|
|
3517
|
+
throw new AuthException(AUTH_ERROR_CODES.EMAIL_NOT_VERIFIED);
|
|
3518
|
+
}
|
|
3388
3519
|
return true;
|
|
3389
3520
|
}
|
|
3390
3521
|
};
|
|
@@ -3402,8 +3533,15 @@ exports.UserStatusGuard = _ts_decorate11([
|
|
|
3402
3533
|
], exports.UserStatusGuard);
|
|
3403
3534
|
function _ts_decorate12(decorators, target, key, desc) {
|
|
3404
3535
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3405
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3406
|
-
|
|
3536
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3537
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3538
|
+
} else {
|
|
3539
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3540
|
+
if (d = decorators[i]) {
|
|
3541
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3407
3545
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3408
3546
|
}
|
|
3409
3547
|
__name(_ts_decorate12, "_ts_decorate");
|
|
@@ -3452,13 +3590,22 @@ function createAuthValidationPipe(options = {}) {
|
|
|
3452
3590
|
__name(createAuthValidationPipe, "createAuthValidationPipe");
|
|
3453
3591
|
function _ts_decorate13(decorators, target, key, desc) {
|
|
3454
3592
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3455
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3456
|
-
|
|
3593
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3594
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3595
|
+
} else {
|
|
3596
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3597
|
+
if (d = decorators[i]) {
|
|
3598
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3457
3602
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3458
3603
|
}
|
|
3459
3604
|
__name(_ts_decorate13, "_ts_decorate");
|
|
3460
|
-
function _ts_metadata12(
|
|
3461
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3605
|
+
function _ts_metadata12(metadataKey, metadataValue) {
|
|
3606
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3607
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3608
|
+
}
|
|
3462
3609
|
}
|
|
3463
3610
|
__name(_ts_metadata12, "_ts_metadata");
|
|
3464
3611
|
function _ts_param8(paramIndex, decorator) {
|
|
@@ -3568,13 +3715,22 @@ exports.BruteForceService = _ts_decorate13([
|
|
|
3568
3715
|
], exports.BruteForceService);
|
|
3569
3716
|
function _ts_decorate14(decorators, target, key, desc) {
|
|
3570
3717
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3571
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3572
|
-
|
|
3718
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3719
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3720
|
+
} else {
|
|
3721
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3722
|
+
if (d = decorators[i]) {
|
|
3723
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3573
3727
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3574
3728
|
}
|
|
3575
3729
|
__name(_ts_decorate14, "_ts_decorate");
|
|
3576
|
-
function _ts_metadata13(
|
|
3577
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3730
|
+
function _ts_metadata13(metadataKey, metadataValue) {
|
|
3731
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3732
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3733
|
+
}
|
|
3578
3734
|
}
|
|
3579
3735
|
__name(_ts_metadata13, "_ts_metadata");
|
|
3580
3736
|
function _ts_param9(paramIndex, decorator) {
|
|
@@ -3638,8 +3794,28 @@ exports.OtpService = class OtpService {
|
|
|
3638
3794
|
__name(this, "OtpService");
|
|
3639
3795
|
}
|
|
3640
3796
|
redis;
|
|
3641
|
-
|
|
3797
|
+
options;
|
|
3798
|
+
constructor(redis, options) {
|
|
3642
3799
|
this.redis = redis;
|
|
3800
|
+
this.options = options;
|
|
3801
|
+
}
|
|
3802
|
+
/**
|
|
3803
|
+
* Keyed one-way transform of an OTP under which it is stored and compared.
|
|
3804
|
+
*
|
|
3805
|
+
* The record is never the code itself: a six-digit code is a keyspace of a million, which a
|
|
3806
|
+
* plain digest lets anyone who reads Redis reverse instantly, so the transform is HMAC-SHA256
|
|
3807
|
+
* under the library's server-only `hmacKey` — the same key that already conceals the identifier.
|
|
3808
|
+
* It is bound to the identifier so the same code under two accounts does not collapse to one
|
|
3809
|
+
* value. `store` and `verify` compute it the same way; the byte-identical verify script keeps
|
|
3810
|
+
* comparing two opaque strings, so the rust-auth side stays in step by transforming the code the
|
|
3811
|
+
* same way before it reads or writes the shared record.
|
|
3812
|
+
*
|
|
3813
|
+
* @param identifier - The user-scoped identifier the record is keyed by.
|
|
3814
|
+
* @param code - The plaintext OTP.
|
|
3815
|
+
* @returns The hex HMAC written to, and compared against, the record.
|
|
3816
|
+
*/
|
|
3817
|
+
fingerprint(identifier, code) {
|
|
3818
|
+
return hmacSha256(`${identifier}:${code}`, this.options.hmacKey);
|
|
3643
3819
|
}
|
|
3644
3820
|
// ---------------------------------------------------------------------------
|
|
3645
3821
|
// Generate
|
|
@@ -3670,7 +3846,7 @@ exports.OtpService = class OtpService {
|
|
|
3670
3846
|
await this.redis.eval(OTP_STORE_LUA, [
|
|
3671
3847
|
`otp:${purpose}:${identifier}`
|
|
3672
3848
|
], [
|
|
3673
|
-
code,
|
|
3849
|
+
this.fingerprint(identifier, code),
|
|
3674
3850
|
String(ttlSeconds)
|
|
3675
3851
|
]);
|
|
3676
3852
|
}
|
|
@@ -3697,10 +3873,11 @@ exports.OtpService = class OtpService {
|
|
|
3697
3873
|
async verify(purpose, identifier, code) {
|
|
3698
3874
|
const start = Date.now();
|
|
3699
3875
|
const key = `otp:${purpose}:${identifier}`;
|
|
3876
|
+
const fingerprint = this.fingerprint(identifier, code);
|
|
3700
3877
|
const raw = await this.redis.eval(OTP_VERIFY_LUA, [
|
|
3701
3878
|
key
|
|
3702
3879
|
], [
|
|
3703
|
-
|
|
3880
|
+
fingerprint,
|
|
3704
3881
|
String(MAX_ATTEMPTS)
|
|
3705
3882
|
]);
|
|
3706
3883
|
const [tag, storedCode] = parseOtpVerifyReply(raw);
|
|
@@ -3712,7 +3889,7 @@ exports.OtpService = class OtpService {
|
|
|
3712
3889
|
await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
|
|
3713
3890
|
throw new AuthException(AUTH_ERROR_CODES.OTP_INVALID);
|
|
3714
3891
|
}
|
|
3715
|
-
if (
|
|
3892
|
+
if (!timingSafeCompare(fingerprint, storedCode)) {
|
|
3716
3893
|
await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
|
|
3717
3894
|
throw new AuthException(AUTH_ERROR_CODES.OTP_INVALID);
|
|
3718
3895
|
}
|
|
@@ -3722,20 +3899,31 @@ exports.OtpService = class OtpService {
|
|
|
3722
3899
|
exports.OtpService = _ts_decorate14([
|
|
3723
3900
|
common.Injectable(),
|
|
3724
3901
|
_ts_param9(0, common.Inject(AuthRedisService)),
|
|
3902
|
+
_ts_param9(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3725
3903
|
_ts_metadata13("design:type", Function),
|
|
3726
3904
|
_ts_metadata13("design:paramtypes", [
|
|
3727
|
-
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
3905
|
+
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
3906
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3728
3907
|
])
|
|
3729
3908
|
], exports.OtpService);
|
|
3730
3909
|
function _ts_decorate15(decorators, target, key, desc) {
|
|
3731
3910
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3732
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3733
|
-
|
|
3911
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3912
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3913
|
+
} else {
|
|
3914
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3915
|
+
if (d = decorators[i]) {
|
|
3916
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3734
3920
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3735
3921
|
}
|
|
3736
3922
|
__name(_ts_decorate15, "_ts_decorate");
|
|
3737
|
-
function _ts_metadata14(
|
|
3738
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3923
|
+
function _ts_metadata14(metadataKey, metadataValue) {
|
|
3924
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3925
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3926
|
+
}
|
|
3739
3927
|
}
|
|
3740
3928
|
__name(_ts_metadata14, "_ts_metadata");
|
|
3741
3929
|
function _ts_param10(paramIndex, decorator) {
|
|
@@ -4039,13 +4227,22 @@ PasswordService = _ts_decorate15([
|
|
|
4039
4227
|
], PasswordService);
|
|
4040
4228
|
function _ts_decorate16(decorators, target, key, desc) {
|
|
4041
4229
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4042
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4043
|
-
|
|
4230
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4231
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4232
|
+
} else {
|
|
4233
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
4234
|
+
if (d = decorators[i]) {
|
|
4235
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4044
4239
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4045
4240
|
}
|
|
4046
4241
|
__name(_ts_decorate16, "_ts_decorate");
|
|
4047
|
-
function _ts_metadata15(
|
|
4048
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4242
|
+
function _ts_metadata15(metadataKey, metadataValue) {
|
|
4243
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4244
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
4245
|
+
}
|
|
4049
4246
|
}
|
|
4050
4247
|
__name(_ts_metadata15, "_ts_metadata");
|
|
4051
4248
|
function _ts_param11(paramIndex, decorator) {
|
|
@@ -4575,10 +4772,16 @@ exports.SessionService = _ts_decorate16([
|
|
|
4575
4772
|
])
|
|
4576
4773
|
], exports.SessionService);
|
|
4577
4774
|
|
|
4775
|
+
// src/server/constants/mfa-subject.ts
|
|
4776
|
+
function mfaSubject(plane, userId, tenantId) {
|
|
4777
|
+
return plane === "platform" ? `platform:${userId}` : `dashboard:${tenantId}:${userId}`;
|
|
4778
|
+
}
|
|
4779
|
+
__name(mfaSubject, "mfaSubject");
|
|
4780
|
+
|
|
4578
4781
|
// src/server/constants/recent-auth.ts
|
|
4579
4782
|
var RECENT_AUTH_TTL_SECONDS = 300;
|
|
4580
|
-
function recentAuthKey(plane, userId, hmacKey) {
|
|
4581
|
-
return `ra:${hmacSha256(
|
|
4783
|
+
function recentAuthKey(plane, userId, hmacKey, tenantId) {
|
|
4784
|
+
return `ra:${hmacSha256(mfaSubject(plane, userId, tenantId), hmacKey)}`;
|
|
4582
4785
|
}
|
|
4583
4786
|
__name(recentAuthKey, "recentAuthKey");
|
|
4584
4787
|
|
|
@@ -4592,13 +4795,22 @@ __name(logSafe, "logSafe");
|
|
|
4592
4795
|
// src/server/services/token-manager.service.ts
|
|
4593
4796
|
function _ts_decorate17(decorators, target, key, desc) {
|
|
4594
4797
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4595
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4596
|
-
|
|
4798
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4799
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4800
|
+
} else {
|
|
4801
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
4802
|
+
if (d = decorators[i]) {
|
|
4803
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
}
|
|
4597
4807
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4598
4808
|
}
|
|
4599
4809
|
__name(_ts_decorate17, "_ts_decorate");
|
|
4600
|
-
function _ts_metadata16(
|
|
4601
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4810
|
+
function _ts_metadata16(metadataKey, metadataValue) {
|
|
4811
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4812
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
4813
|
+
}
|
|
4602
4814
|
}
|
|
4603
4815
|
__name(_ts_metadata16, "_ts_metadata");
|
|
4604
4816
|
function _ts_param12(paramIndex, decorator) {
|
|
@@ -4735,7 +4947,7 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
4735
4947
|
userId: user.id,
|
|
4736
4948
|
refreshTtl: ttl
|
|
4737
4949
|
});
|
|
4738
|
-
await this.redis.set(recentAuthKey("dashboard", user.id, this.options.hmacKey), "1", RECENT_AUTH_TTL_SECONDS);
|
|
4950
|
+
await this.redis.set(recentAuthKey("dashboard", user.id, this.options.hmacKey, user.tenantId), "1", RECENT_AUTH_TTL_SECONDS);
|
|
4739
4951
|
return {
|
|
4740
4952
|
user,
|
|
4741
4953
|
accessToken,
|
|
@@ -5311,15 +5523,23 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
5311
5523
|
*
|
|
5312
5524
|
* @param userId - The user (or admin) pending MFA completion.
|
|
5313
5525
|
* @param context - Authentication context: `'dashboard'` or `'platform'`.
|
|
5526
|
+
* @param tenantId - The tenant the account belongs to, on the dashboard plane only. Stamped
|
|
5527
|
+
* into the token so the challenge resolves the account tenant-scoped rather than by `sub`
|
|
5528
|
+
* alone. Omitted on the platform plane, which has no tenant.
|
|
5314
5529
|
* @returns The signed MFA temp JWT.
|
|
5315
5530
|
*/
|
|
5316
|
-
async issueMfaTempToken(userId, context) {
|
|
5531
|
+
async issueMfaTempToken(userId, context, tenantId) {
|
|
5317
5532
|
const jti = crypto.randomUUID();
|
|
5318
5533
|
const payload = {
|
|
5319
5534
|
jti,
|
|
5320
5535
|
sub: userId,
|
|
5321
5536
|
type: "mfa_challenge",
|
|
5322
5537
|
context,
|
|
5538
|
+
// Present only on the dashboard plane; a platform token carries no tenant claim, exactly
|
|
5539
|
+
// as the platform arm of every other MFA key stays tenant-free.
|
|
5540
|
+
...tenantId !== void 0 ? {
|
|
5541
|
+
tenantId
|
|
5542
|
+
} : {},
|
|
5323
5543
|
// Stamped so the challenge token dies with the rest of the account's credentials. See
|
|
5324
5544
|
// the claim's own documentation for what it was surviving.
|
|
5325
5545
|
epoch: await this.redis.getUserTokenEpoch(userId, context)
|
|
@@ -5370,6 +5590,9 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
5370
5590
|
*/
|
|
5371
5591
|
async verifyMfaTempToken(token) {
|
|
5372
5592
|
const payload = verifyWithRotation(this.jwtService, this.options, token);
|
|
5593
|
+
if (payload.context === "dashboard" && payload.tenantId === void 0 || payload.context === "platform" && payload.tenantId !== void 0) {
|
|
5594
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
|
|
5595
|
+
}
|
|
5373
5596
|
const storedUserId = await this.redis.get(`mfa:${sha256(payload.jti)}`);
|
|
5374
5597
|
if (storedUserId === null) {
|
|
5375
5598
|
throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
|
|
@@ -5383,7 +5606,12 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
5383
5606
|
return {
|
|
5384
5607
|
userId: payload.sub,
|
|
5385
5608
|
context: payload.context,
|
|
5386
|
-
jti: payload.jti
|
|
5609
|
+
jti: payload.jti,
|
|
5610
|
+
// Absent on a platform token and on a dashboard token minted before this claim existed;
|
|
5611
|
+
// the challenge falls back to the pre-tenant lookup in that case.
|
|
5612
|
+
...payload.tenantId !== void 0 ? {
|
|
5613
|
+
tenantId: payload.tenantId
|
|
5614
|
+
} : {}
|
|
5387
5615
|
};
|
|
5388
5616
|
}
|
|
5389
5617
|
/**
|
|
@@ -5457,13 +5685,22 @@ __name(tenantScoped, "tenantScoped");
|
|
|
5457
5685
|
// src/server/services/auth.service.ts
|
|
5458
5686
|
function _ts_decorate18(decorators, target, key, desc) {
|
|
5459
5687
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5460
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5461
|
-
|
|
5688
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5689
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5690
|
+
} else {
|
|
5691
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
5692
|
+
if (d = decorators[i]) {
|
|
5693
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5462
5697
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5463
5698
|
}
|
|
5464
5699
|
__name(_ts_decorate18, "_ts_decorate");
|
|
5465
|
-
function _ts_metadata17(
|
|
5466
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5700
|
+
function _ts_metadata17(metadataKey, metadataValue) {
|
|
5701
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5702
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
5703
|
+
}
|
|
5467
5704
|
}
|
|
5468
5705
|
__name(_ts_metadata17, "_ts_metadata");
|
|
5469
5706
|
function _ts_param13(paramIndex, decorator) {
|
|
@@ -5731,7 +5968,7 @@ exports.AuthService = class _AuthService {
|
|
|
5731
5968
|
void this.rehashPassword(user.id, user.tenantId, dto.password, user.passwordHash);
|
|
5732
5969
|
}
|
|
5733
5970
|
if (user.mfaEnabled) {
|
|
5734
|
-
const mfaTempToken = await this.tokenManager.issueMfaTempToken(user.id, "dashboard");
|
|
5971
|
+
const mfaTempToken = await this.tokenManager.issueMfaTempToken(user.id, "dashboard", user.tenantId);
|
|
5735
5972
|
this.logger.log(`login: MFA challenge issued userId=${user.id} tenantId=${logSafe(tenantId)}`);
|
|
5736
5973
|
return {
|
|
5737
5974
|
mfaRequired: true,
|
|
@@ -6019,6 +6256,7 @@ exports.AuthService = class _AuthService {
|
|
|
6019
6256
|
throw new AuthException(AUTH_ERROR_CODES.OTP_INVALID);
|
|
6020
6257
|
}
|
|
6021
6258
|
await this.userRepo.updateEmailVerified(user.id, true);
|
|
6259
|
+
await this.redis.del(`uev:${encodeURIComponent(tenantId)}:${encodeURIComponent(user.id)}`);
|
|
6022
6260
|
this.logger.log(`verifyEmail: email verified userId=${user.id} tenantId=${logSafe(tenantId)}`);
|
|
6023
6261
|
if (this.hooks?.afterEmailVerified) {
|
|
6024
6262
|
void Promise.resolve(this.hooks.afterEmailVerified(toSafeUser2(user), createEmptyHookContext())).catch((err) => {
|
|
@@ -6245,13 +6483,22 @@ var WS_TICKET_TTL_SECONDS = 30;
|
|
|
6245
6483
|
// src/server/services/ws-ticket.service.ts
|
|
6246
6484
|
function _ts_decorate19(decorators, target, key, desc) {
|
|
6247
6485
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6248
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6249
|
-
|
|
6486
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6487
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6488
|
+
} else {
|
|
6489
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6490
|
+
if (d = decorators[i]) {
|
|
6491
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
6494
|
+
}
|
|
6250
6495
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6251
6496
|
}
|
|
6252
6497
|
__name(_ts_decorate19, "_ts_decorate");
|
|
6253
|
-
function _ts_metadata18(
|
|
6254
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
6498
|
+
function _ts_metadata18(metadataKey, metadataValue) {
|
|
6499
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6500
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6501
|
+
}
|
|
6255
6502
|
}
|
|
6256
6503
|
__name(_ts_metadata18, "_ts_metadata");
|
|
6257
6504
|
function _ts_param14(paramIndex, decorator) {
|
|
@@ -6343,13 +6590,22 @@ exports.WsTicketService = _ts_decorate19([
|
|
|
6343
6590
|
// src/server/controllers/auth.controller.ts
|
|
6344
6591
|
function _ts_decorate20(decorators, target, key, desc) {
|
|
6345
6592
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6346
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6347
|
-
|
|
6593
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6594
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6595
|
+
} else {
|
|
6596
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6597
|
+
if (d = decorators[i]) {
|
|
6598
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6599
|
+
}
|
|
6600
|
+
}
|
|
6601
|
+
}
|
|
6348
6602
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6349
6603
|
}
|
|
6350
6604
|
__name(_ts_decorate20, "_ts_decorate");
|
|
6351
|
-
function _ts_metadata19(
|
|
6352
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
6605
|
+
function _ts_metadata19(metadataKey, metadataValue) {
|
|
6606
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6607
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6608
|
+
}
|
|
6353
6609
|
}
|
|
6354
6610
|
__name(_ts_metadata19, "_ts_metadata");
|
|
6355
6611
|
function _ts_param15(paramIndex, decorator) {
|
|
@@ -6450,6 +6706,15 @@ var AuthController = class {
|
|
|
6450
6706
|
/**
|
|
6451
6707
|
* Returns the safe user record for the currently authenticated user.
|
|
6452
6708
|
*
|
|
6709
|
+
* `JwtAuthGuard` alone, deliberately without `UserStatusGuard`: this is the one
|
|
6710
|
+
* dashboard read a not-yet-verified — or suspended — session must still reach, so a
|
|
6711
|
+
* client can fetch who it is and render the "verify your email" or "account
|
|
6712
|
+
* suspended" state instead of being locked out with no way to learn why. The safe
|
|
6713
|
+
* record exposes no privileged data and drives no action; every route that DOES act
|
|
6714
|
+
* (MFA management, invitations, password change, ws-ticket) composes `UserStatusGuard`
|
|
6715
|
+
* and so refuses an unverified or blocked account. The account's own `status` and
|
|
6716
|
+
* `emailVerified` fields are in the returned record for the client to branch on.
|
|
6717
|
+
*
|
|
6453
6718
|
* @param user - JWT payload from the verified access token.
|
|
6454
6719
|
*/
|
|
6455
6720
|
async me(user) {
|
|
@@ -6640,13 +6905,22 @@ AuthController = _ts_decorate20([
|
|
|
6640
6905
|
], AuthController);
|
|
6641
6906
|
function _ts_decorate21(decorators, target, key, desc) {
|
|
6642
6907
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6643
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6644
|
-
|
|
6908
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6909
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6910
|
+
} else {
|
|
6911
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6912
|
+
if (d = decorators[i]) {
|
|
6913
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6914
|
+
}
|
|
6915
|
+
}
|
|
6916
|
+
}
|
|
6645
6917
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6646
6918
|
}
|
|
6647
6919
|
__name(_ts_decorate21, "_ts_decorate");
|
|
6648
|
-
function _ts_metadata20(
|
|
6649
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
6920
|
+
function _ts_metadata20(metadataKey, metadataValue) {
|
|
6921
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6922
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6923
|
+
}
|
|
6650
6924
|
}
|
|
6651
6925
|
__name(_ts_metadata20, "_ts_metadata");
|
|
6652
6926
|
var ChangeEmailDto = class {
|
|
@@ -6683,13 +6957,22 @@ _ts_decorate21([
|
|
|
6683
6957
|
], ChangeEmailDto.prototype, "currentPassword", void 0);
|
|
6684
6958
|
function _ts_decorate22(decorators, target, key, desc) {
|
|
6685
6959
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6686
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6687
|
-
|
|
6960
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6961
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
6962
|
+
} else {
|
|
6963
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
6964
|
+
if (d = decorators[i]) {
|
|
6965
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6966
|
+
}
|
|
6967
|
+
}
|
|
6968
|
+
}
|
|
6688
6969
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6689
6970
|
}
|
|
6690
6971
|
__name(_ts_decorate22, "_ts_decorate");
|
|
6691
|
-
function _ts_metadata21(
|
|
6692
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
6972
|
+
function _ts_metadata21(metadataKey, metadataValue) {
|
|
6973
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6974
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
6975
|
+
}
|
|
6693
6976
|
}
|
|
6694
6977
|
__name(_ts_metadata21, "_ts_metadata");
|
|
6695
6978
|
var ConfirmEmailChangeDto = class {
|
|
@@ -6712,13 +6995,22 @@ _ts_decorate22([
|
|
|
6712
6995
|
], ConfirmEmailChangeDto.prototype, "token", void 0);
|
|
6713
6996
|
function _ts_decorate23(decorators, target, key, desc) {
|
|
6714
6997
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6715
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6716
|
-
|
|
6998
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6999
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
7000
|
+
} else {
|
|
7001
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
7002
|
+
if (d = decorators[i]) {
|
|
7003
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7004
|
+
}
|
|
7005
|
+
}
|
|
7006
|
+
}
|
|
6717
7007
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6718
7008
|
}
|
|
6719
7009
|
__name(_ts_decorate23, "_ts_decorate");
|
|
6720
|
-
function _ts_metadata22(
|
|
6721
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
7010
|
+
function _ts_metadata22(metadataKey, metadataValue) {
|
|
7011
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7012
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
7013
|
+
}
|
|
6722
7014
|
}
|
|
6723
7015
|
__name(_ts_metadata22, "_ts_metadata");
|
|
6724
7016
|
function _ts_param16(paramIndex, decorator) {
|
|
@@ -6961,13 +7253,22 @@ exports.EmailChangeService = _ts_decorate23([
|
|
|
6961
7253
|
// src/server/controllers/email-change.controller.ts
|
|
6962
7254
|
function _ts_decorate24(decorators, target, key, desc) {
|
|
6963
7255
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6964
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
6965
|
-
|
|
7256
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7257
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
7258
|
+
} else {
|
|
7259
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
7260
|
+
if (d = decorators[i]) {
|
|
7261
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7262
|
+
}
|
|
7263
|
+
}
|
|
7264
|
+
}
|
|
6966
7265
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6967
7266
|
}
|
|
6968
7267
|
__name(_ts_decorate24, "_ts_decorate");
|
|
6969
|
-
function _ts_metadata23(
|
|
6970
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
7268
|
+
function _ts_metadata23(metadataKey, metadataValue) {
|
|
7269
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7270
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
7271
|
+
}
|
|
6971
7272
|
}
|
|
6972
7273
|
__name(_ts_metadata23, "_ts_metadata");
|
|
6973
7274
|
function _ts_param17(paramIndex, decorator) {
|
|
@@ -7063,13 +7364,22 @@ EmailChangeController = _ts_decorate24([
|
|
|
7063
7364
|
], EmailChangeController);
|
|
7064
7365
|
function _ts_decorate25(decorators, target, key, desc) {
|
|
7065
7366
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7066
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7067
|
-
|
|
7367
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7368
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
7369
|
+
} else {
|
|
7370
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
7371
|
+
if (d = decorators[i]) {
|
|
7372
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7373
|
+
}
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7068
7376
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7069
7377
|
}
|
|
7070
7378
|
__name(_ts_decorate25, "_ts_decorate");
|
|
7071
|
-
function _ts_metadata24(
|
|
7072
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
7379
|
+
function _ts_metadata24(metadataKey, metadataValue) {
|
|
7380
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7381
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
7382
|
+
}
|
|
7073
7383
|
}
|
|
7074
7384
|
__name(_ts_metadata24, "_ts_metadata");
|
|
7075
7385
|
var AcceptInvitationDto = class {
|
|
@@ -7128,13 +7438,22 @@ _ts_decorate25([
|
|
|
7128
7438
|
], AcceptInvitationDto.prototype, "password", void 0);
|
|
7129
7439
|
function _ts_decorate26(decorators, target, key, desc) {
|
|
7130
7440
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7131
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7132
|
-
|
|
7441
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7442
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
7443
|
+
} else {
|
|
7444
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
7445
|
+
if (d = decorators[i]) {
|
|
7446
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7447
|
+
}
|
|
7448
|
+
}
|
|
7449
|
+
}
|
|
7133
7450
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7134
7451
|
}
|
|
7135
7452
|
__name(_ts_decorate26, "_ts_decorate");
|
|
7136
|
-
function _ts_metadata25(
|
|
7137
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
7453
|
+
function _ts_metadata25(metadataKey, metadataValue) {
|
|
7454
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7455
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
7456
|
+
}
|
|
7138
7457
|
}
|
|
7139
7458
|
__name(_ts_metadata25, "_ts_metadata");
|
|
7140
7459
|
var CreateInvitationDto = class {
|
|
@@ -7189,13 +7508,22 @@ _ts_decorate26([
|
|
|
7189
7508
|
], CreateInvitationDto.prototype, "tenantName", void 0);
|
|
7190
7509
|
function _ts_decorate27(decorators, target, key, desc) {
|
|
7191
7510
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7192
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7193
|
-
|
|
7511
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7512
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
7513
|
+
} else {
|
|
7514
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
7515
|
+
if (d = decorators[i]) {
|
|
7516
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7517
|
+
}
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7194
7520
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7195
7521
|
}
|
|
7196
7522
|
__name(_ts_decorate27, "_ts_decorate");
|
|
7197
|
-
function _ts_metadata26(
|
|
7198
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
7523
|
+
function _ts_metadata26(metadataKey, metadataValue) {
|
|
7524
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7525
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
7526
|
+
}
|
|
7199
7527
|
}
|
|
7200
7528
|
__name(_ts_metadata26, "_ts_metadata");
|
|
7201
7529
|
var RevokeInvitationDto = class {
|
|
@@ -7218,13 +7546,22 @@ _ts_decorate27([
|
|
|
7218
7546
|
], RevokeInvitationDto.prototype, "email", void 0);
|
|
7219
7547
|
function _ts_decorate28(decorators, target, key, desc) {
|
|
7220
7548
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7221
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7222
|
-
|
|
7549
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7550
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
7551
|
+
} else {
|
|
7552
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
7553
|
+
if (d = decorators[i]) {
|
|
7554
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
}
|
|
7223
7558
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7224
7559
|
}
|
|
7225
7560
|
__name(_ts_decorate28, "_ts_decorate");
|
|
7226
|
-
function _ts_metadata27(
|
|
7227
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
7561
|
+
function _ts_metadata27(metadataKey, metadataValue) {
|
|
7562
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7563
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
7564
|
+
}
|
|
7228
7565
|
}
|
|
7229
7566
|
__name(_ts_metadata27, "_ts_metadata");
|
|
7230
7567
|
function _ts_param18(paramIndex, decorator) {
|
|
@@ -7685,13 +8022,22 @@ exports.InvitationService = _ts_decorate28([
|
|
|
7685
8022
|
// src/server/controllers/invitation.controller.ts
|
|
7686
8023
|
function _ts_decorate29(decorators, target, key, desc) {
|
|
7687
8024
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7688
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7689
|
-
|
|
8025
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8026
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8027
|
+
} else {
|
|
8028
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8029
|
+
if (d = decorators[i]) {
|
|
8030
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8031
|
+
}
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
7690
8034
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7691
8035
|
}
|
|
7692
8036
|
__name(_ts_decorate29, "_ts_decorate");
|
|
7693
|
-
function _ts_metadata28(
|
|
7694
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8037
|
+
function _ts_metadata28(metadataKey, metadataValue) {
|
|
8038
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8039
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8040
|
+
}
|
|
7695
8041
|
}
|
|
7696
8042
|
__name(_ts_metadata28, "_ts_metadata");
|
|
7697
8043
|
function _ts_param19(paramIndex, decorator) {
|
|
@@ -7845,13 +8191,22 @@ var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
|
|
|
7845
8191
|
var SkipMfa = /* @__PURE__ */ __name(() => common.SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
|
|
7846
8192
|
function _ts_decorate30(decorators, target, key, desc) {
|
|
7847
8193
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7848
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7849
|
-
|
|
8194
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8195
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8196
|
+
} else {
|
|
8197
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8198
|
+
if (d = decorators[i]) {
|
|
8199
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8200
|
+
}
|
|
8201
|
+
}
|
|
8202
|
+
}
|
|
7850
8203
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7851
8204
|
}
|
|
7852
8205
|
__name(_ts_decorate30, "_ts_decorate");
|
|
7853
|
-
function _ts_metadata29(
|
|
7854
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8206
|
+
function _ts_metadata29(metadataKey, metadataValue) {
|
|
8207
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8208
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8209
|
+
}
|
|
7855
8210
|
}
|
|
7856
8211
|
__name(_ts_metadata29, "_ts_metadata");
|
|
7857
8212
|
var MfaChallengeDto = class {
|
|
@@ -7907,13 +8262,22 @@ _ts_decorate30([
|
|
|
7907
8262
|
], MfaChallengeDto.prototype, "code", void 0);
|
|
7908
8263
|
function _ts_decorate31(decorators, target, key, desc) {
|
|
7909
8264
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7910
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7911
|
-
|
|
8265
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8266
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8267
|
+
} else {
|
|
8268
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8269
|
+
if (d = decorators[i]) {
|
|
8270
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
}
|
|
7912
8274
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7913
8275
|
}
|
|
7914
8276
|
__name(_ts_decorate31, "_ts_decorate");
|
|
7915
|
-
function _ts_metadata30(
|
|
7916
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8277
|
+
function _ts_metadata30(metadataKey, metadataValue) {
|
|
8278
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8279
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8280
|
+
}
|
|
7917
8281
|
}
|
|
7918
8282
|
__name(_ts_metadata30, "_ts_metadata");
|
|
7919
8283
|
var MfaDisableDto = class {
|
|
@@ -7940,13 +8304,22 @@ _ts_decorate31([
|
|
|
7940
8304
|
], MfaDisableDto.prototype, "code", void 0);
|
|
7941
8305
|
function _ts_decorate32(decorators, target, key, desc) {
|
|
7942
8306
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7943
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7944
|
-
|
|
8307
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8308
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8309
|
+
} else {
|
|
8310
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8311
|
+
if (d = decorators[i]) {
|
|
8312
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8313
|
+
}
|
|
8314
|
+
}
|
|
8315
|
+
}
|
|
7945
8316
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7946
8317
|
}
|
|
7947
8318
|
__name(_ts_decorate32, "_ts_decorate");
|
|
7948
|
-
function _ts_metadata31(
|
|
7949
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8319
|
+
function _ts_metadata31(metadataKey, metadataValue) {
|
|
8320
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8321
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8322
|
+
}
|
|
7950
8323
|
}
|
|
7951
8324
|
__name(_ts_metadata31, "_ts_metadata");
|
|
7952
8325
|
var MfaRegenerateRecoveryCodesDto = class {
|
|
@@ -7973,13 +8346,22 @@ _ts_decorate32([
|
|
|
7973
8346
|
], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
|
|
7974
8347
|
function _ts_decorate33(decorators, target, key, desc) {
|
|
7975
8348
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7976
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
7977
|
-
|
|
8349
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8350
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8351
|
+
} else {
|
|
8352
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8353
|
+
if (d = decorators[i]) {
|
|
8354
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8355
|
+
}
|
|
8356
|
+
}
|
|
8357
|
+
}
|
|
7978
8358
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7979
8359
|
}
|
|
7980
8360
|
__name(_ts_decorate33, "_ts_decorate");
|
|
7981
|
-
function _ts_metadata32(
|
|
7982
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8361
|
+
function _ts_metadata32(metadataKey, metadataValue) {
|
|
8362
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8363
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8364
|
+
}
|
|
7983
8365
|
}
|
|
7984
8366
|
__name(_ts_metadata32, "_ts_metadata");
|
|
7985
8367
|
var MfaSetupDto = class {
|
|
@@ -8014,13 +8396,22 @@ _ts_decorate33([
|
|
|
8014
8396
|
], MfaSetupDto.prototype, "password", void 0);
|
|
8015
8397
|
function _ts_decorate34(decorators, target, key, desc) {
|
|
8016
8398
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8017
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
8018
|
-
|
|
8399
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8400
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8401
|
+
} else {
|
|
8402
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8403
|
+
if (d = decorators[i]) {
|
|
8404
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8405
|
+
}
|
|
8406
|
+
}
|
|
8407
|
+
}
|
|
8019
8408
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8020
8409
|
}
|
|
8021
8410
|
__name(_ts_decorate34, "_ts_decorate");
|
|
8022
|
-
function _ts_metadata33(
|
|
8023
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8411
|
+
function _ts_metadata33(metadataKey, metadataValue) {
|
|
8412
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8413
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8414
|
+
}
|
|
8024
8415
|
}
|
|
8025
8416
|
__name(_ts_metadata33, "_ts_metadata");
|
|
8026
8417
|
var MfaVerifyDto = class {
|
|
@@ -8096,13 +8487,22 @@ __name(decrypt, "decrypt");
|
|
|
8096
8487
|
// src/server/services/mfa.service.ts
|
|
8097
8488
|
function _ts_decorate35(decorators, target, key, desc) {
|
|
8098
8489
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8099
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
8100
|
-
|
|
8490
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8491
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
8492
|
+
} else {
|
|
8493
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8494
|
+
if (d = decorators[i]) {
|
|
8495
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8496
|
+
}
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8101
8499
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8102
8500
|
}
|
|
8103
8501
|
__name(_ts_decorate35, "_ts_decorate");
|
|
8104
|
-
function _ts_metadata34(
|
|
8105
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
8502
|
+
function _ts_metadata34(metadataKey, metadataValue) {
|
|
8503
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8504
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
8505
|
+
}
|
|
8106
8506
|
}
|
|
8107
8507
|
__name(_ts_metadata34, "_ts_metadata");
|
|
8108
8508
|
function _ts_param20(paramIndex, decorator) {
|
|
@@ -8189,8 +8589,9 @@ exports.MfaService = class _MfaService {
|
|
|
8189
8589
|
* @param context - Which identity plane the account belongs to.
|
|
8190
8590
|
* @param secretBase32 - The decrypted secret.
|
|
8191
8591
|
* @param recoveryCodes - The stored recovery digests, written back unchanged.
|
|
8592
|
+
* @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
|
|
8192
8593
|
*/
|
|
8193
|
-
async reencryptSecret(userId, context, secretBase32, recoveryCodes) {
|
|
8594
|
+
async reencryptSecret(userId, context, secretBase32, recoveryCodes, tenantId) {
|
|
8194
8595
|
const update = {
|
|
8195
8596
|
mfaEnabled: true,
|
|
8196
8597
|
mfaSecret: this.encryptSecret(secretBase32),
|
|
@@ -8200,7 +8601,7 @@ exports.MfaService = class _MfaService {
|
|
|
8200
8601
|
if (context === "platform" && this.platformUserRepo) {
|
|
8201
8602
|
await this.platformUserRepo.updateMfa(userId, update);
|
|
8202
8603
|
} else {
|
|
8203
|
-
await this.userRepo.updateMfa(userId, update);
|
|
8604
|
+
await this.userRepo.updateMfa(userId, tenantId, update);
|
|
8204
8605
|
}
|
|
8205
8606
|
} catch (err) {
|
|
8206
8607
|
this.logger.error("re-encryption under the current MFA key failed", err);
|
|
@@ -8243,14 +8644,24 @@ exports.MfaService = class _MfaService {
|
|
|
8243
8644
|
* @returns `true` when a write happened, `false` when `mutate` abandoned the transition.
|
|
8244
8645
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
8245
8646
|
*/
|
|
8246
|
-
async transitionMfaRecord(context, userId, mutate) {
|
|
8247
|
-
const
|
|
8647
|
+
async transitionMfaRecord(context, userId, tenantId, mutate) {
|
|
8648
|
+
const scopedLockKey = `mfalock:${hmacSha256(mfaSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
8649
|
+
const legacyLockKey = `mfalock:${hmacSha256(`${context}:${userId}`, this.options.hmacKey)}`;
|
|
8650
|
+
const acquireLegacy = legacyLockKey !== scopedLockKey;
|
|
8248
8651
|
const lockToken = crypto.randomBytes(16).toString("hex");
|
|
8249
|
-
if (!await this.redis.setIfAbsent(
|
|
8652
|
+
if (!await this.redis.setIfAbsent(scopedLockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
|
|
8653
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT, common.HttpStatus.CONFLICT);
|
|
8654
|
+
}
|
|
8655
|
+
if (acquireLegacy && !await this.redis.setIfAbsent(legacyLockKey, lockToken, MFA_TRANSITION_LOCK_TTL_SECONDS)) {
|
|
8656
|
+
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
8657
|
+
scopedLockKey
|
|
8658
|
+
], [
|
|
8659
|
+
lockToken
|
|
8660
|
+
]);
|
|
8250
8661
|
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT, common.HttpStatus.CONFLICT);
|
|
8251
8662
|
}
|
|
8252
8663
|
try {
|
|
8253
|
-
const current = await this.fetchUserForContext(context, userId);
|
|
8664
|
+
const current = await this.fetchUserForContext(context, userId, tenantId);
|
|
8254
8665
|
const update = mutate(current);
|
|
8255
8666
|
if (update === null) return false;
|
|
8256
8667
|
const write = {
|
|
@@ -8261,15 +8672,22 @@ exports.MfaService = class _MfaService {
|
|
|
8261
8672
|
if (context === "platform" && this.platformUserRepo) {
|
|
8262
8673
|
await this.platformUserRepo.updateMfa(userId, write);
|
|
8263
8674
|
} else {
|
|
8264
|
-
await this.userRepo.updateMfa(userId, write);
|
|
8675
|
+
await this.userRepo.updateMfa(userId, tenantId, write);
|
|
8265
8676
|
}
|
|
8266
8677
|
return true;
|
|
8267
8678
|
} finally {
|
|
8268
8679
|
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
8269
|
-
|
|
8680
|
+
scopedLockKey
|
|
8270
8681
|
], [
|
|
8271
8682
|
lockToken
|
|
8272
8683
|
]);
|
|
8684
|
+
if (acquireLegacy) {
|
|
8685
|
+
await this.redis.eval(RELEASE_LOCK_LUA, [
|
|
8686
|
+
legacyLockKey
|
|
8687
|
+
], [
|
|
8688
|
+
lockToken
|
|
8689
|
+
]);
|
|
8690
|
+
}
|
|
8273
8691
|
}
|
|
8274
8692
|
}
|
|
8275
8693
|
/**
|
|
@@ -8458,8 +8876,8 @@ exports.MfaService = class _MfaService {
|
|
|
8458
8876
|
* @param code - The submitted code, never stored — only its keyed MAC becomes a key.
|
|
8459
8877
|
* @returns `true` when this challenge is the one that claimed it.
|
|
8460
8878
|
*/
|
|
8461
|
-
async claimRecoveryCode(context, userId, code) {
|
|
8462
|
-
const claimKey = `rcu:${hmacSha256(`${context
|
|
8879
|
+
async claimRecoveryCode(context, userId, code, tenantId) {
|
|
8880
|
+
const claimKey = `rcu:${hmacSha256(`${mfaSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
|
|
8463
8881
|
return await this.redis.setnx(claimKey, RECOVERY_CODE_CLAIM_TTL_SECONDS);
|
|
8464
8882
|
}
|
|
8465
8883
|
/**
|
|
@@ -8517,14 +8935,15 @@ exports.MfaService = class _MfaService {
|
|
|
8517
8935
|
* reused (rather than introducing a new one) because the consumer-facing
|
|
8518
8936
|
* meaning is the same: "platform MFA cannot operate".
|
|
8519
8937
|
*/
|
|
8520
|
-
async setup(userId, context = "dashboard", password) {
|
|
8938
|
+
async setup(userId, context = "dashboard", password, tenantId) {
|
|
8939
|
+
this.assertPlaneTenant(context, tenantId);
|
|
8521
8940
|
if (context === "platform" && !this.platformUserRepo) {
|
|
8522
8941
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
8523
8942
|
}
|
|
8524
|
-
const user = await this.fetchUserForContext(context, userId);
|
|
8943
|
+
const user = await this.fetchUserForContext(context, userId, tenantId);
|
|
8525
8944
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
8526
|
-
await this.assertReauthenticated(context, userId, user.passwordHash, password);
|
|
8527
|
-
const setupKey = `mfa_setup:${hmacSha256(
|
|
8945
|
+
await this.assertReauthenticated(context, userId, user.passwordHash, password, tenantId);
|
|
8946
|
+
const setupKey = `mfa_setup:${hmacSha256(mfaSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
8528
8947
|
const existingFast = await this.redis.get(setupKey);
|
|
8529
8948
|
if (existingFast !== null) {
|
|
8530
8949
|
const data = this.parseSetupData(existingFast, userId);
|
|
@@ -8597,19 +9016,20 @@ exports.MfaService = class _MfaService {
|
|
|
8597
9016
|
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
8598
9017
|
* repository was not configured at module registration.
|
|
8599
9018
|
*/
|
|
8600
|
-
async verifyAndEnable(userId, code, ip, userAgent, context = "dashboard") {
|
|
9019
|
+
async verifyAndEnable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
|
|
9020
|
+
this.assertPlaneTenant(context, tenantId);
|
|
8601
9021
|
if (context === "platform" && !this.platformUserRepo) {
|
|
8602
9022
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
8603
9023
|
}
|
|
8604
|
-
const user = await this.fetchUserForContext(context, userId);
|
|
9024
|
+
const user = await this.fetchUserForContext(context, userId, tenantId);
|
|
8605
9025
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
8606
|
-
const setupKey = `mfa_setup:${hmacSha256(
|
|
9026
|
+
const setupKey = `mfa_setup:${hmacSha256(mfaSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
8607
9027
|
const raw = await this.redis.get(setupKey);
|
|
8608
9028
|
if (raw === null) throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
8609
9029
|
const data = this.parseSetupData(raw, userId);
|
|
8610
9030
|
const secretBase32 = this.decryptSecret(data.encryptedSecret);
|
|
8611
9031
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
8612
|
-
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow);
|
|
9032
|
+
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
8613
9033
|
if (!codeValid) {
|
|
8614
9034
|
this.logger.warn(`verifyAndEnable: invalid TOTP code userId=${userId}`);
|
|
8615
9035
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
@@ -8619,7 +9039,7 @@ exports.MfaService = class _MfaService {
|
|
|
8619
9039
|
this.logger.warn(`verifyAndEnable: setup key consumed by concurrent request userId=${userId}`);
|
|
8620
9040
|
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
8621
9041
|
}
|
|
8622
|
-
await this.transitionMfaRecord(context, userId, () => ({
|
|
9042
|
+
await this.transitionMfaRecord(context, userId, tenantId, () => ({
|
|
8623
9043
|
mfaEnabled: true,
|
|
8624
9044
|
mfaSecret: data.encryptedSecret,
|
|
8625
9045
|
mfaRecoveryCodes: data.hashedCodes
|
|
@@ -8659,13 +9079,12 @@ exports.MfaService = class _MfaService {
|
|
|
8659
9079
|
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
8660
9080
|
*/
|
|
8661
9081
|
async challenge(mfaTempToken, code, ip, userAgent) {
|
|
8662
|
-
const { userId, context, jti: tempTokenJti } = await this.tokenManager.verifyMfaTempToken(mfaTempToken);
|
|
8663
|
-
|
|
8664
|
-
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
9082
|
+
const { userId, context, tenantId, jti: tempTokenJti } = await this.tokenManager.verifyMfaTempToken(mfaTempToken);
|
|
9083
|
+
if (await this.isMfaFlowLockedOut("challenge", context, userId, tenantId)) {
|
|
8665
9084
|
this.logger.warn(`challenge: account locked userId=${userId}`);
|
|
8666
9085
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
8667
9086
|
}
|
|
8668
|
-
const user = await this.fetchUserForContext(context, userId);
|
|
9087
|
+
const user = await this.fetchUserForContext(context, userId, tenantId);
|
|
8669
9088
|
if (!user.mfaEnabled || !user.mfaSecret) {
|
|
8670
9089
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
8671
9090
|
}
|
|
@@ -8675,18 +9094,18 @@ exports.MfaService = class _MfaService {
|
|
|
8675
9094
|
let codeValid = false;
|
|
8676
9095
|
let usedRecoveryIndex = -1;
|
|
8677
9096
|
if (isTotpCode) {
|
|
8678
|
-
codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow);
|
|
9097
|
+
codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
8679
9098
|
} else {
|
|
8680
9099
|
const recoveryCodes = user.mfaRecoveryCodes ?? [];
|
|
8681
9100
|
usedRecoveryIndex = await this.verifyRecoveryCode(code, recoveryCodes);
|
|
8682
|
-
codeValid = usedRecoveryIndex >= 0 && await this.claimRecoveryCode(context, userId, code);
|
|
9101
|
+
codeValid = usedRecoveryIndex >= 0 && await this.claimRecoveryCode(context, userId, code, tenantId);
|
|
8683
9102
|
}
|
|
8684
9103
|
if (!codeValid) {
|
|
8685
|
-
await this.
|
|
9104
|
+
await this.recordMfaFlowFailure("challenge", context, userId, tenantId);
|
|
8686
9105
|
this.logger.warn(`challenge: invalid MFA code userId=${userId} context=${context}`);
|
|
8687
9106
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
8688
9107
|
}
|
|
8689
|
-
await this.
|
|
9108
|
+
await this.resetMfaFlowFailures("challenge", context, userId, tenantId);
|
|
8690
9109
|
if (!await this.tokenManager.consumeMfaTempToken(tempTokenJti)) {
|
|
8691
9110
|
throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
|
|
8692
9111
|
}
|
|
@@ -8695,7 +9114,7 @@ exports.MfaService = class _MfaService {
|
|
|
8695
9114
|
// Stryker disable next-line ArrayDeclaration: unreachable — this branch is only taken
|
|
8696
9115
|
// when `verifyRecoveryCode` matched a code inside an array it had to iterate first.
|
|
8697
9116
|
[];
|
|
8698
|
-
await this.transitionMfaRecord(context, userId, (current) => {
|
|
9117
|
+
await this.transitionMfaRecord(context, userId, tenantId, (current) => {
|
|
8699
9118
|
if (!current.mfaEnabled) return null;
|
|
8700
9119
|
const currentCodes = current.mfaRecoveryCodes ?? [];
|
|
8701
9120
|
const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
|
|
@@ -8714,7 +9133,7 @@ exports.MfaService = class _MfaService {
|
|
|
8714
9133
|
};
|
|
8715
9134
|
});
|
|
8716
9135
|
} else if (encryptedUnderRetiredKey) {
|
|
8717
|
-
void this.reencryptSecret(userId, context, secretBase32, user.mfaRecoveryCodes ?? []);
|
|
9136
|
+
void this.reencryptSecret(userId, context, secretBase32, user.mfaRecoveryCodes ?? [], tenantId);
|
|
8718
9137
|
}
|
|
8719
9138
|
this.logger.log(`challenge: MFA challenge passed userId=${userId} context=${context}`);
|
|
8720
9139
|
if (context === "dashboard") {
|
|
@@ -8776,11 +9195,11 @@ exports.MfaService = class _MfaService {
|
|
|
8776
9195
|
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
8777
9196
|
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
8778
9197
|
*/
|
|
8779
|
-
async disable(userId, code, ip, userAgent, context = "dashboard") {
|
|
8780
|
-
|
|
9198
|
+
async disable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
|
|
9199
|
+
this.assertPlaneTenant(context, tenantId);
|
|
9200
|
+
const user = await this.fetchUserForContext(context, userId, tenantId);
|
|
8781
9201
|
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
8782
|
-
|
|
8783
|
-
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
9202
|
+
if (await this.isMfaFlowLockedOut("disable", context, userId, tenantId)) {
|
|
8784
9203
|
this.logger.warn(`disable: account locked userId=${userId} context=${context}`);
|
|
8785
9204
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
8786
9205
|
}
|
|
@@ -8789,14 +9208,14 @@ exports.MfaService = class _MfaService {
|
|
|
8789
9208
|
}
|
|
8790
9209
|
const secretBase32 = this.decryptSecret(user.mfaSecret);
|
|
8791
9210
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
8792
|
-
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow);
|
|
9211
|
+
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
8793
9212
|
if (!codeValid) {
|
|
8794
|
-
await this.
|
|
9213
|
+
await this.recordMfaFlowFailure("disable", context, userId, tenantId);
|
|
8795
9214
|
this.logger.warn(`disable: invalid MFA code userId=${userId} context=${context}`);
|
|
8796
9215
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
8797
9216
|
}
|
|
8798
|
-
await this.
|
|
8799
|
-
await this.transitionMfaRecord(context, userId, () => ({
|
|
9217
|
+
await this.resetMfaFlowFailures("disable", context, userId, tenantId);
|
|
9218
|
+
await this.transitionMfaRecord(context, userId, tenantId, () => ({
|
|
8800
9219
|
mfaEnabled: false,
|
|
8801
9220
|
mfaSecret: null,
|
|
8802
9221
|
mfaRecoveryCodes: null
|
|
@@ -8856,13 +9275,14 @@ exports.MfaService = class _MfaService {
|
|
|
8856
9275
|
* `'platform'`. Must match the plane the account lives in, or the lookup misses.
|
|
8857
9276
|
* @throws `TOKEN_INVALID` if no user with that ID exists in the given plane.
|
|
8858
9277
|
*/
|
|
8859
|
-
async resetMfa(userId, context = "dashboard") {
|
|
8860
|
-
|
|
9278
|
+
async resetMfa(userId, context = "dashboard", tenantId) {
|
|
9279
|
+
this.assertPlaneTenant(context, tenantId);
|
|
9280
|
+
const user = await this.fetchUserForContext(context, userId, tenantId);
|
|
8861
9281
|
if (!user.mfaEnabled) {
|
|
8862
9282
|
this.logger.log(`resetMfa: no second factor to remove userId=${userId} context=${context}`);
|
|
8863
9283
|
return;
|
|
8864
9284
|
}
|
|
8865
|
-
await this.transitionMfaRecord(context, userId, () => ({
|
|
9285
|
+
await this.transitionMfaRecord(context, userId, tenantId, () => ({
|
|
8866
9286
|
mfaEnabled: false,
|
|
8867
9287
|
mfaSecret: null,
|
|
8868
9288
|
mfaRecoveryCodes: null
|
|
@@ -8923,14 +9343,14 @@ exports.MfaService = class _MfaService {
|
|
|
8923
9343
|
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
8924
9344
|
* @returns The freshly generated plain-text recovery codes, one-time display.
|
|
8925
9345
|
*/
|
|
8926
|
-
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard") {
|
|
9346
|
+
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard", tenantId) {
|
|
9347
|
+
this.assertPlaneTenant(context, tenantId);
|
|
8927
9348
|
if (context === "platform" && !this.platformUserRepo) {
|
|
8928
9349
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
8929
9350
|
}
|
|
8930
|
-
const user = await this.fetchUserForContext(context, userId);
|
|
9351
|
+
const user = await this.fetchUserForContext(context, userId, tenantId);
|
|
8931
9352
|
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
8932
|
-
|
|
8933
|
-
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
9353
|
+
if (await this.isMfaFlowLockedOut("disable", context, userId, tenantId)) {
|
|
8934
9354
|
this.logger.warn(`regenerateRecoveryCodes: account locked userId=${userId} context=${context}`);
|
|
8935
9355
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
8936
9356
|
}
|
|
@@ -8939,16 +9359,16 @@ exports.MfaService = class _MfaService {
|
|
|
8939
9359
|
}
|
|
8940
9360
|
const secretBase32 = this.decryptSecret(user.mfaSecret);
|
|
8941
9361
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
8942
|
-
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow);
|
|
9362
|
+
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow, tenantId);
|
|
8943
9363
|
if (!codeValid) {
|
|
8944
|
-
await this.
|
|
9364
|
+
await this.recordMfaFlowFailure("disable", context, userId, tenantId);
|
|
8945
9365
|
this.logger.warn(`regenerateRecoveryCodes: invalid MFA code userId=${userId} context=${context}`);
|
|
8946
9366
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
8947
9367
|
}
|
|
8948
|
-
await this.
|
|
9368
|
+
await this.resetMfaFlowFailures("disable", context, userId, tenantId);
|
|
8949
9369
|
const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
8950
9370
|
const { plainCodes, hashedCodes } = this.hashRecoveryCodes(recoveryCount);
|
|
8951
|
-
const replaced = await this.transitionMfaRecord(context, userId, (current) => {
|
|
9371
|
+
const replaced = await this.transitionMfaRecord(context, userId, tenantId, (current) => {
|
|
8952
9372
|
if (!current.mfaEnabled) return null;
|
|
8953
9373
|
return {
|
|
8954
9374
|
mfaEnabled: true,
|
|
@@ -8984,12 +9404,15 @@ exports.MfaService = class _MfaService {
|
|
|
8984
9404
|
*
|
|
8985
9405
|
* @returns `true` if the code is valid and has not been replayed, `false` otherwise.
|
|
8986
9406
|
*/
|
|
8987
|
-
async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window) {
|
|
9407
|
+
async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
|
|
8988
9408
|
if (!verifyTotp(secretBase32, code, window)) return false;
|
|
8989
|
-
const
|
|
8990
|
-
const
|
|
8991
|
-
|
|
8992
|
-
|
|
9409
|
+
const ttl = totpAntiReplayTtlSeconds(window);
|
|
9410
|
+
const scopedReplayKey = `tu:${hmacSha256(`${mfaSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
|
|
9411
|
+
const legacyReplayKey = `tu:${hmacSha256(`${context}:${userId}:${code}`, this.options.hmacKey)}`;
|
|
9412
|
+
const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
|
|
9413
|
+
if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
|
|
9414
|
+
const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
|
|
9415
|
+
return scopedIsNew && legacyIsNew;
|
|
8993
9416
|
}
|
|
8994
9417
|
/**
|
|
8995
9418
|
* Requires the caller to re-prove the account password before a factor is changed.
|
|
@@ -9015,27 +9438,26 @@ exports.MfaService = class _MfaService {
|
|
|
9015
9438
|
* absent or wrong. The latter is deliberately the same code a failed login returns: an
|
|
9016
9439
|
* attacker holding a stolen token learns nothing from it beyond what they already knew.
|
|
9017
9440
|
*/
|
|
9018
|
-
async assertReauthenticated(context, userId, passwordHash, password) {
|
|
9441
|
+
async assertReauthenticated(context, userId, passwordHash, password, tenantId) {
|
|
9019
9442
|
if (passwordHash === null) {
|
|
9020
|
-
const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey));
|
|
9443
|
+
const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey, tenantId));
|
|
9021
9444
|
if (recent === null) {
|
|
9022
9445
|
this.logger.warn(`reauthenticate: no recent authentication userId=${userId} context=${context}`);
|
|
9023
9446
|
throw new AuthException(AUTH_ERROR_CODES.REAUTHENTICATION_REQUIRED, 403);
|
|
9024
9447
|
}
|
|
9025
9448
|
return;
|
|
9026
9449
|
}
|
|
9027
|
-
|
|
9028
|
-
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
9450
|
+
if (await this.isMfaFlowLockedOut("reauth", context, userId, tenantId)) {
|
|
9029
9451
|
this.logger.warn(`reauthenticate: account locked userId=${userId} context=${context}`);
|
|
9030
9452
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
9031
9453
|
}
|
|
9032
9454
|
const supplied = password ?? "";
|
|
9033
9455
|
const matches = await this.passwordService.compare(supplied, passwordHash);
|
|
9034
9456
|
if (!matches) {
|
|
9035
|
-
await this.
|
|
9457
|
+
await this.recordMfaFlowFailure("reauth", context, userId, tenantId);
|
|
9036
9458
|
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
9037
9459
|
}
|
|
9038
|
-
await this.
|
|
9460
|
+
await this.resetMfaFlowFailures("reauth", context, userId, tenantId);
|
|
9039
9461
|
}
|
|
9040
9462
|
/**
|
|
9041
9463
|
* Fetches a user from the correct repository based on the MFA context, and refuses one whose
|
|
@@ -9063,9 +9485,82 @@ exports.MfaService = class _MfaService {
|
|
|
9063
9485
|
* @throws `TOKEN_INVALID` if the user is not found.
|
|
9064
9486
|
* @throws {@link AuthException} the status error when the account is blocked.
|
|
9065
9487
|
*/
|
|
9066
|
-
|
|
9488
|
+
/**
|
|
9489
|
+
* A dashboard MFA flow MUST carry the tenant it was authenticated in; a platform flow MUST NOT.
|
|
9490
|
+
*
|
|
9491
|
+
* The controller sources the tenant from the verified JWT, which always carries a validated
|
|
9492
|
+
* `tenantId`, so this never trips through the HTTP surface. It guards the OTHER caller:
|
|
9493
|
+
* `MfaService` is a public API, and a host wiring it directly — or a future SSO path — could hand
|
|
9494
|
+
* a dashboard `userId` with no tenant, which would silently reach the tenant-blind account read
|
|
9495
|
+
* and key derivation. Refuse it here, naming the field, rather than let it degrade to the
|
|
9496
|
+
* pre-tenant behaviour, which is exactly the fallback an attacker would aim for.
|
|
9497
|
+
*
|
|
9498
|
+
* @param context - The identity plane the call is on.
|
|
9499
|
+
* @param tenantId - The tenant supplied by the caller, if any.
|
|
9500
|
+
* @throws {@link AuthException} `VALIDATION` (400) when a dashboard call omits the tenant, or a
|
|
9501
|
+
* platform call supplies one.
|
|
9502
|
+
*/
|
|
9503
|
+
assertPlaneTenant(context, tenantId) {
|
|
9504
|
+
if (context === "dashboard" && (tenantId === void 0 || tenantId === "") || context === "platform" && tenantId !== void 0) {
|
|
9505
|
+
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, common.HttpStatus.BAD_REQUEST, [
|
|
9506
|
+
{
|
|
9507
|
+
field: "tenantId",
|
|
9508
|
+
message: "tenantId must be a non-empty value on the dashboard plane and absent on the platform plane"
|
|
9509
|
+
}
|
|
9510
|
+
]);
|
|
9511
|
+
}
|
|
9512
|
+
}
|
|
9513
|
+
/**
|
|
9514
|
+
* The tenant-scoped brute-force identifier for one MFA flow, and the legacy plane-only one it
|
|
9515
|
+
* replaces — equal on the platform plane, where the subject never carried a tenant, and distinct
|
|
9516
|
+
* on the dashboard plane, where it now does.
|
|
9517
|
+
*
|
|
9518
|
+
* A rolling upgrade runs old and new code against one Redis at once: on the dashboard plane an
|
|
9519
|
+
* old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
|
|
9520
|
+
* `{flow}:{mfaSubject}`, and either alone leaves a hole — a lockout an old pod filled would not
|
|
9521
|
+
* stop a new pod, and a success on one would not clear the other. For one release every read
|
|
9522
|
+
* consults both and every write touches both, so the two move as one; a later release drops the
|
|
9523
|
+
* legacy arm. On the platform plane the two ids are identical (no tenant ever entered the
|
|
9524
|
+
* subject), so the legacy arm is skipped — operating it would just be the same key a second time,
|
|
9525
|
+
* double-counting a failure and locking a platform admin out at half the threshold. `{flow}`
|
|
9526
|
+
* (`challenge` / `disable` / `reauth`) keeps the three counters isolated, exactly as before.
|
|
9527
|
+
*/
|
|
9528
|
+
mfaFlowCounterIds(flow, context, userId, tenantId) {
|
|
9529
|
+
return {
|
|
9530
|
+
legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
|
|
9531
|
+
scoped: hmacSha256(`${flow}:${mfaSubject(context, userId, tenantId)}`, this.options.hmacKey)
|
|
9532
|
+
};
|
|
9533
|
+
}
|
|
9534
|
+
/**
|
|
9535
|
+
* Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
|
|
9536
|
+
* neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
|
|
9537
|
+
*/
|
|
9538
|
+
async isMfaFlowLockedOut(flow, context, userId, tenantId) {
|
|
9539
|
+
const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
|
|
9540
|
+
if (await this.bruteForce.isLockedOut(scoped)) return true;
|
|
9541
|
+
return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
|
|
9542
|
+
}
|
|
9543
|
+
/**
|
|
9544
|
+
* Records the failure under both counters so the budget an attacker spends is seen by old and
|
|
9545
|
+
* new code alike — but under the scoped id ONCE when the two coincide (platform plane).
|
|
9546
|
+
*/
|
|
9547
|
+
async recordMfaFlowFailure(flow, context, userId, tenantId) {
|
|
9548
|
+
const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
|
|
9549
|
+
await this.bruteForce.recordFailure(scoped);
|
|
9550
|
+
if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
|
|
9551
|
+
}
|
|
9552
|
+
/**
|
|
9553
|
+
* Clears both counters on success — resetting only one would leave the other to lock a
|
|
9554
|
+
* legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
|
|
9555
|
+
*/
|
|
9556
|
+
async resetMfaFlowFailures(flow, context, userId, tenantId) {
|
|
9557
|
+
const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
|
|
9558
|
+
await this.bruteForce.resetFailures(scoped);
|
|
9559
|
+
if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
|
|
9560
|
+
}
|
|
9561
|
+
async fetchUserForContext(context, userId, tenantId) {
|
|
9067
9562
|
if (context === "dashboard") {
|
|
9068
|
-
const user = await this.userRepo.findById(userId);
|
|
9563
|
+
const user = await this.userRepo.findById(userId, tenantId);
|
|
9069
9564
|
if (!user) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
9070
9565
|
assertNotBlocked(user.status, this.options.blockedStatuses);
|
|
9071
9566
|
return user;
|
|
@@ -9110,13 +9605,22 @@ exports.MfaService = _ts_decorate35([
|
|
|
9110
9605
|
// src/server/controllers/mfa.controller.ts
|
|
9111
9606
|
function _ts_decorate36(decorators, target, key, desc) {
|
|
9112
9607
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9113
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9114
|
-
|
|
9608
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9609
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
9610
|
+
} else {
|
|
9611
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9612
|
+
if (d = decorators[i]) {
|
|
9613
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9614
|
+
}
|
|
9615
|
+
}
|
|
9616
|
+
}
|
|
9115
9617
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9116
9618
|
}
|
|
9117
9619
|
__name(_ts_decorate36, "_ts_decorate");
|
|
9118
|
-
function _ts_metadata35(
|
|
9119
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
9620
|
+
function _ts_metadata35(metadataKey, metadataValue) {
|
|
9621
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9622
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
9623
|
+
}
|
|
9120
9624
|
}
|
|
9121
9625
|
__name(_ts_metadata35, "_ts_metadata");
|
|
9122
9626
|
function _ts_param21(paramIndex, decorator) {
|
|
@@ -9197,7 +9701,7 @@ var MfaController = class {
|
|
|
9197
9701
|
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
9198
9702
|
*/
|
|
9199
9703
|
async setup(user, dto) {
|
|
9200
|
-
return this.mfaService.setup(user.sub, "dashboard", dto.password);
|
|
9704
|
+
return this.mfaService.setup(user.sub, "dashboard", dto.password, user.tenantId);
|
|
9201
9705
|
}
|
|
9202
9706
|
/**
|
|
9203
9707
|
* Verifies the first TOTP code and permanently enables MFA on the account.
|
|
@@ -9214,7 +9718,7 @@ var MfaController = class {
|
|
|
9214
9718
|
async verifyEnable(user, dto, req) {
|
|
9215
9719
|
const ip = req.ip ?? "";
|
|
9216
9720
|
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
9217
|
-
await this.mfaService.verifyAndEnable(user.sub, dto.code, ip, userAgent);
|
|
9721
|
+
await this.mfaService.verifyAndEnable(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
|
|
9218
9722
|
}
|
|
9219
9723
|
/**
|
|
9220
9724
|
* Exchanges a valid MFA temp token + TOTP or recovery code for full auth tokens.
|
|
@@ -9286,7 +9790,7 @@ var MfaController = class {
|
|
|
9286
9790
|
async disable(user, dto, req) {
|
|
9287
9791
|
const ip = req.ip ?? "";
|
|
9288
9792
|
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
9289
|
-
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, "dashboard");
|
|
9793
|
+
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
|
|
9290
9794
|
}
|
|
9291
9795
|
/**
|
|
9292
9796
|
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
@@ -9310,11 +9814,11 @@ var MfaController = class {
|
|
|
9310
9814
|
async regenerateRecoveryCodes(user, dto, req) {
|
|
9311
9815
|
const ip = req.ip ?? "";
|
|
9312
9816
|
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
9313
|
-
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard");
|
|
9817
|
+
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
|
|
9314
9818
|
}
|
|
9315
9819
|
};
|
|
9316
9820
|
_ts_decorate36([
|
|
9317
|
-
common.UseGuards(exports.JwtAuthGuard),
|
|
9821
|
+
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
9318
9822
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
9319
9823
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
9320
9824
|
common.Post("setup"),
|
|
@@ -9328,7 +9832,7 @@ _ts_decorate36([
|
|
|
9328
9832
|
_ts_metadata35("design:returntype", Promise)
|
|
9329
9833
|
], MfaController.prototype, "setup", null);
|
|
9330
9834
|
_ts_decorate36([
|
|
9331
|
-
common.UseGuards(exports.JwtAuthGuard),
|
|
9835
|
+
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
9332
9836
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
9333
9837
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
9334
9838
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
@@ -9365,7 +9869,7 @@ _ts_decorate36([
|
|
|
9365
9869
|
_ts_metadata35("design:returntype", Promise)
|
|
9366
9870
|
], MfaController.prototype, "challenge", null);
|
|
9367
9871
|
_ts_decorate36([
|
|
9368
|
-
common.UseGuards(exports.JwtAuthGuard),
|
|
9872
|
+
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
9369
9873
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9370
9874
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9371
9875
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
@@ -9382,7 +9886,7 @@ _ts_decorate36([
|
|
|
9382
9886
|
_ts_metadata35("design:returntype", Promise)
|
|
9383
9887
|
], MfaController.prototype, "disable", null);
|
|
9384
9888
|
_ts_decorate36([
|
|
9385
|
-
common.UseGuards(exports.JwtAuthGuard),
|
|
9889
|
+
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
9386
9890
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9387
9891
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9388
9892
|
common.HttpCode(common.HttpStatus.OK),
|
|
@@ -9418,13 +9922,22 @@ MfaController = _ts_decorate36([
|
|
|
9418
9922
|
var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
|
|
9419
9923
|
function _ts_decorate37(decorators, target, key, desc) {
|
|
9420
9924
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9421
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9422
|
-
|
|
9925
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9926
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
9927
|
+
} else {
|
|
9928
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9929
|
+
if (d = decorators[i]) {
|
|
9930
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9931
|
+
}
|
|
9932
|
+
}
|
|
9933
|
+
}
|
|
9423
9934
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9424
9935
|
}
|
|
9425
9936
|
__name(_ts_decorate37, "_ts_decorate");
|
|
9426
|
-
function _ts_metadata36(
|
|
9427
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
9937
|
+
function _ts_metadata36(metadataKey, metadataValue) {
|
|
9938
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9939
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
9940
|
+
}
|
|
9428
9941
|
}
|
|
9429
9942
|
__name(_ts_metadata36, "_ts_metadata");
|
|
9430
9943
|
var ChangePasswordDto = class {
|
|
@@ -9473,13 +9986,22 @@ _ts_decorate37([
|
|
|
9473
9986
|
], ChangePasswordDto.prototype, "newPassword", void 0);
|
|
9474
9987
|
function _ts_decorate38(decorators, target, key, desc) {
|
|
9475
9988
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9476
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9477
|
-
|
|
9989
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9990
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
9991
|
+
} else {
|
|
9992
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9993
|
+
if (d = decorators[i]) {
|
|
9994
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9995
|
+
}
|
|
9996
|
+
}
|
|
9997
|
+
}
|
|
9478
9998
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9479
9999
|
}
|
|
9480
10000
|
__name(_ts_decorate38, "_ts_decorate");
|
|
9481
|
-
function _ts_metadata37(
|
|
9482
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
10001
|
+
function _ts_metadata37(metadataKey, metadataValue) {
|
|
10002
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10003
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10004
|
+
}
|
|
9483
10005
|
}
|
|
9484
10006
|
__name(_ts_metadata37, "_ts_metadata");
|
|
9485
10007
|
var ForgotPasswordDto = class {
|
|
@@ -9515,13 +10037,22 @@ _ts_decorate38([
|
|
|
9515
10037
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
9516
10038
|
function _ts_decorate39(decorators, target, key, desc) {
|
|
9517
10039
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9518
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9519
|
-
|
|
10040
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10041
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10042
|
+
} else {
|
|
10043
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10044
|
+
if (d = decorators[i]) {
|
|
10045
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10046
|
+
}
|
|
10047
|
+
}
|
|
10048
|
+
}
|
|
9520
10049
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9521
10050
|
}
|
|
9522
10051
|
__name(_ts_decorate39, "_ts_decorate");
|
|
9523
|
-
function _ts_metadata38(
|
|
9524
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
10052
|
+
function _ts_metadata38(metadataKey, metadataValue) {
|
|
10053
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10054
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10055
|
+
}
|
|
9525
10056
|
}
|
|
9526
10057
|
__name(_ts_metadata38, "_ts_metadata");
|
|
9527
10058
|
var ResendOtpDto = class {
|
|
@@ -9556,13 +10087,22 @@ _ts_decorate39([
|
|
|
9556
10087
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
9557
10088
|
function _ts_decorate40(decorators, target, key, desc) {
|
|
9558
10089
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9559
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9560
|
-
|
|
10090
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10091
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10092
|
+
} else {
|
|
10093
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10094
|
+
if (d = decorators[i]) {
|
|
10095
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10096
|
+
}
|
|
10097
|
+
}
|
|
10098
|
+
}
|
|
9561
10099
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9562
10100
|
}
|
|
9563
10101
|
__name(_ts_decorate40, "_ts_decorate");
|
|
9564
|
-
function _ts_metadata39(
|
|
9565
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
10102
|
+
function _ts_metadata39(metadataKey, metadataValue) {
|
|
10103
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10104
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10105
|
+
}
|
|
9566
10106
|
}
|
|
9567
10107
|
__name(_ts_metadata39, "_ts_metadata");
|
|
9568
10108
|
var ResetPasswordDto = class {
|
|
@@ -9654,13 +10194,22 @@ _ts_decorate40([
|
|
|
9654
10194
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
9655
10195
|
function _ts_decorate41(decorators, target, key, desc) {
|
|
9656
10196
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9657
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9658
|
-
|
|
10197
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10198
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10199
|
+
} else {
|
|
10200
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10201
|
+
if (d = decorators[i]) {
|
|
10202
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10203
|
+
}
|
|
10204
|
+
}
|
|
10205
|
+
}
|
|
9659
10206
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9660
10207
|
}
|
|
9661
10208
|
__name(_ts_decorate41, "_ts_decorate");
|
|
9662
|
-
function _ts_metadata40(
|
|
9663
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
10209
|
+
function _ts_metadata40(metadataKey, metadataValue) {
|
|
10210
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10211
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10212
|
+
}
|
|
9664
10213
|
}
|
|
9665
10214
|
__name(_ts_metadata40, "_ts_metadata");
|
|
9666
10215
|
var VerifyOtpDto = class {
|
|
@@ -9707,13 +10256,22 @@ _ts_decorate41([
|
|
|
9707
10256
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
9708
10257
|
function _ts_decorate42(decorators, target, key, desc) {
|
|
9709
10258
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9710
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
9711
|
-
|
|
10259
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10260
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10261
|
+
} else {
|
|
10262
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10263
|
+
if (d = decorators[i]) {
|
|
10264
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
}
|
|
9712
10268
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9713
10269
|
}
|
|
9714
10270
|
__name(_ts_decorate42, "_ts_decorate");
|
|
9715
|
-
function _ts_metadata41(
|
|
9716
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
10271
|
+
function _ts_metadata41(metadataKey, metadataValue) {
|
|
10272
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10273
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10274
|
+
}
|
|
9717
10275
|
}
|
|
9718
10276
|
__name(_ts_metadata41, "_ts_metadata");
|
|
9719
10277
|
function _ts_param22(paramIndex, decorator) {
|
|
@@ -10269,13 +10827,22 @@ __name(toSafeUser3, "toSafeUser");
|
|
|
10269
10827
|
// src/server/controllers/password-reset.controller.ts
|
|
10270
10828
|
function _ts_decorate43(decorators, target, key, desc) {
|
|
10271
10829
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10272
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
10273
|
-
|
|
10830
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10831
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10832
|
+
} else {
|
|
10833
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10834
|
+
if (d = decorators[i]) {
|
|
10835
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10836
|
+
}
|
|
10837
|
+
}
|
|
10838
|
+
}
|
|
10274
10839
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10275
10840
|
}
|
|
10276
10841
|
__name(_ts_decorate43, "_ts_decorate");
|
|
10277
|
-
function _ts_metadata42(
|
|
10278
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
10842
|
+
function _ts_metadata42(metadataKey, metadataValue) {
|
|
10843
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10844
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10845
|
+
}
|
|
10279
10846
|
}
|
|
10280
10847
|
__name(_ts_metadata42, "_ts_metadata");
|
|
10281
10848
|
function _ts_param23(paramIndex, decorator) {
|
|
@@ -10484,13 +11051,22 @@ PasswordResetController = _ts_decorate43([
|
|
|
10484
11051
|
], PasswordResetController);
|
|
10485
11052
|
function _ts_decorate44(decorators, target, key, desc) {
|
|
10486
11053
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10487
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
10488
|
-
|
|
11054
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11055
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11056
|
+
} else {
|
|
11057
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11058
|
+
if (d = decorators[i]) {
|
|
11059
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11060
|
+
}
|
|
11061
|
+
}
|
|
11062
|
+
}
|
|
10489
11063
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10490
11064
|
}
|
|
10491
11065
|
__name(_ts_decorate44, "_ts_decorate");
|
|
10492
|
-
function _ts_metadata43(
|
|
10493
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
11066
|
+
function _ts_metadata43(metadataKey, metadataValue) {
|
|
11067
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11068
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11069
|
+
}
|
|
10494
11070
|
}
|
|
10495
11071
|
__name(_ts_metadata43, "_ts_metadata");
|
|
10496
11072
|
var PlatformLoginDto = class {
|
|
@@ -10539,13 +11115,22 @@ _ts_decorate44([
|
|
|
10539
11115
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
10540
11116
|
function _ts_decorate45(decorators, target, key, desc) {
|
|
10541
11117
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10542
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
10543
|
-
|
|
11118
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11119
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11120
|
+
} else {
|
|
11121
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11122
|
+
if (d = decorators[i]) {
|
|
11123
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11124
|
+
}
|
|
11125
|
+
}
|
|
11126
|
+
}
|
|
10544
11127
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10545
11128
|
}
|
|
10546
11129
|
__name(_ts_decorate45, "_ts_decorate");
|
|
10547
|
-
function _ts_metadata44(
|
|
10548
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
11130
|
+
function _ts_metadata44(metadataKey, metadataValue) {
|
|
11131
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11132
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11133
|
+
}
|
|
10549
11134
|
}
|
|
10550
11135
|
__name(_ts_metadata44, "_ts_metadata");
|
|
10551
11136
|
function _ts_param24(paramIndex, decorator) {
|
|
@@ -10617,13 +11202,22 @@ exports.JwtPlatformGuard = _ts_decorate45([
|
|
|
10617
11202
|
], exports.JwtPlatformGuard);
|
|
10618
11203
|
function _ts_decorate46(decorators, target, key, desc) {
|
|
10619
11204
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10620
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
10621
|
-
|
|
11205
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11206
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11207
|
+
} else {
|
|
11208
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11209
|
+
if (d = decorators[i]) {
|
|
11210
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11211
|
+
}
|
|
11212
|
+
}
|
|
11213
|
+
}
|
|
10622
11214
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10623
11215
|
}
|
|
10624
11216
|
__name(_ts_decorate46, "_ts_decorate");
|
|
10625
|
-
function _ts_metadata45(
|
|
10626
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
11217
|
+
function _ts_metadata45(metadataKey, metadataValue) {
|
|
11218
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11219
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11220
|
+
}
|
|
10627
11221
|
}
|
|
10628
11222
|
__name(_ts_metadata45, "_ts_metadata");
|
|
10629
11223
|
function _ts_param25(paramIndex, decorator) {
|
|
@@ -10875,13 +11469,22 @@ exports.PlatformAuthService = _ts_decorate46([
|
|
|
10875
11469
|
// src/server/controllers/platform-auth.controller.ts
|
|
10876
11470
|
function _ts_decorate47(decorators, target, key, desc) {
|
|
10877
11471
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10878
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
10879
|
-
|
|
11472
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11473
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11474
|
+
} else {
|
|
11475
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11476
|
+
if (d = decorators[i]) {
|
|
11477
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11478
|
+
}
|
|
11479
|
+
}
|
|
11480
|
+
}
|
|
10880
11481
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10881
11482
|
}
|
|
10882
11483
|
__name(_ts_decorate47, "_ts_decorate");
|
|
10883
|
-
function _ts_metadata46(
|
|
10884
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
11484
|
+
function _ts_metadata46(metadataKey, metadataValue) {
|
|
11485
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11486
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11487
|
+
}
|
|
10885
11488
|
}
|
|
10886
11489
|
__name(_ts_metadata46, "_ts_metadata");
|
|
10887
11490
|
function _ts_param26(paramIndex, decorator) {
|
|
@@ -11145,13 +11748,22 @@ PlatformAuthController = _ts_decorate47([
|
|
|
11145
11748
|
], PlatformAuthController);
|
|
11146
11749
|
function _ts_decorate48(decorators, target, key, desc) {
|
|
11147
11750
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11148
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11149
|
-
|
|
11751
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11752
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11753
|
+
} else {
|
|
11754
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11755
|
+
if (d = decorators[i]) {
|
|
11756
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11757
|
+
}
|
|
11758
|
+
}
|
|
11759
|
+
}
|
|
11150
11760
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11151
11761
|
}
|
|
11152
11762
|
__name(_ts_decorate48, "_ts_decorate");
|
|
11153
|
-
function _ts_metadata47(
|
|
11154
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
11763
|
+
function _ts_metadata47(metadataKey, metadataValue) {
|
|
11764
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11765
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11766
|
+
}
|
|
11155
11767
|
}
|
|
11156
11768
|
__name(_ts_metadata47, "_ts_metadata");
|
|
11157
11769
|
function _ts_param27(paramIndex, decorator) {
|
|
@@ -11318,13 +11930,22 @@ PlatformMfaController = _ts_decorate48([
|
|
|
11318
11930
|
], PlatformMfaController);
|
|
11319
11931
|
function _ts_decorate49(decorators, target, key, desc) {
|
|
11320
11932
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11321
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11322
|
-
|
|
11933
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11934
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11935
|
+
} else {
|
|
11936
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11937
|
+
if (d = decorators[i]) {
|
|
11938
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11941
|
+
}
|
|
11323
11942
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11324
11943
|
}
|
|
11325
11944
|
__name(_ts_decorate49, "_ts_decorate");
|
|
11326
|
-
function _ts_metadata48(
|
|
11327
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
11945
|
+
function _ts_metadata48(metadataKey, metadataValue) {
|
|
11946
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11947
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11948
|
+
}
|
|
11328
11949
|
}
|
|
11329
11950
|
__name(_ts_metadata48, "_ts_metadata");
|
|
11330
11951
|
function _ts_param28(paramIndex, decorator) {
|
|
@@ -11464,13 +12085,22 @@ SessionController = _ts_decorate49([
|
|
|
11464
12085
|
], SessionController);
|
|
11465
12086
|
function _ts_decorate50(decorators, target, key, desc) {
|
|
11466
12087
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11467
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11468
|
-
|
|
12088
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12089
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12090
|
+
} else {
|
|
12091
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12092
|
+
if (d = decorators[i]) {
|
|
12093
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12094
|
+
}
|
|
12095
|
+
}
|
|
12096
|
+
}
|
|
11469
12097
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11470
12098
|
}
|
|
11471
12099
|
__name(_ts_decorate50, "_ts_decorate");
|
|
11472
|
-
function _ts_metadata49(
|
|
11473
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12100
|
+
function _ts_metadata49(metadataKey, metadataValue) {
|
|
12101
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12102
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12103
|
+
}
|
|
11474
12104
|
}
|
|
11475
12105
|
__name(_ts_metadata49, "_ts_metadata");
|
|
11476
12106
|
function _ts_param29(paramIndex, decorator) {
|
|
@@ -11519,13 +12149,22 @@ var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLAT
|
|
|
11519
12149
|
// src/server/guards/platform-roles.guard.ts
|
|
11520
12150
|
function _ts_decorate51(decorators, target, key, desc) {
|
|
11521
12151
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11522
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11523
|
-
|
|
12152
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12153
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12154
|
+
} else {
|
|
12155
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12156
|
+
if (d = decorators[i]) {
|
|
12157
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12158
|
+
}
|
|
12159
|
+
}
|
|
12160
|
+
}
|
|
11524
12161
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11525
12162
|
}
|
|
11526
12163
|
__name(_ts_decorate51, "_ts_decorate");
|
|
11527
|
-
function _ts_metadata50(
|
|
11528
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12164
|
+
function _ts_metadata50(metadataKey, metadataValue) {
|
|
12165
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12166
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12167
|
+
}
|
|
11529
12168
|
}
|
|
11530
12169
|
__name(_ts_metadata50, "_ts_metadata");
|
|
11531
12170
|
function _ts_param30(paramIndex, decorator) {
|
|
@@ -11583,13 +12222,22 @@ var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, r
|
|
|
11583
12222
|
// src/server/guards/roles.guard.ts
|
|
11584
12223
|
function _ts_decorate52(decorators, target, key, desc) {
|
|
11585
12224
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11586
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11587
|
-
|
|
12225
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12226
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12227
|
+
} else {
|
|
12228
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12229
|
+
if (d = decorators[i]) {
|
|
12230
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12231
|
+
}
|
|
12232
|
+
}
|
|
12233
|
+
}
|
|
11588
12234
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11589
12235
|
}
|
|
11590
12236
|
__name(_ts_decorate52, "_ts_decorate");
|
|
11591
|
-
function _ts_metadata51(
|
|
11592
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12237
|
+
function _ts_metadata51(metadataKey, metadataValue) {
|
|
12238
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12239
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12240
|
+
}
|
|
11593
12241
|
}
|
|
11594
12242
|
__name(_ts_metadata51, "_ts_metadata");
|
|
11595
12243
|
function _ts_param31(paramIndex, decorator) {
|
|
@@ -11639,8 +12287,15 @@ exports.RolesGuard = _ts_decorate52([
|
|
|
11639
12287
|
], exports.RolesGuard);
|
|
11640
12288
|
function _ts_decorate53(decorators, target, key, desc) {
|
|
11641
12289
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11642
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11643
|
-
|
|
12290
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12291
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12292
|
+
} else {
|
|
12293
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12294
|
+
if (d = decorators[i]) {
|
|
12295
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12296
|
+
}
|
|
12297
|
+
}
|
|
12298
|
+
}
|
|
11644
12299
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11645
12300
|
}
|
|
11646
12301
|
__name(_ts_decorate53, "_ts_decorate");
|
|
@@ -11701,13 +12356,22 @@ var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
|
|
|
11701
12356
|
// src/server/oauth/oauth.service.ts
|
|
11702
12357
|
function _ts_decorate54(decorators, target, key, desc) {
|
|
11703
12358
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11704
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
11705
|
-
|
|
12359
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12360
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12361
|
+
} else {
|
|
12362
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12363
|
+
if (d = decorators[i]) {
|
|
12364
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12365
|
+
}
|
|
12366
|
+
}
|
|
12367
|
+
}
|
|
11706
12368
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11707
12369
|
}
|
|
11708
12370
|
__name(_ts_decorate54, "_ts_decorate");
|
|
11709
|
-
function _ts_metadata52(
|
|
11710
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12371
|
+
function _ts_metadata52(metadataKey, metadataValue) {
|
|
12372
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12373
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12374
|
+
}
|
|
11711
12375
|
}
|
|
11712
12376
|
__name(_ts_metadata52, "_ts_metadata");
|
|
11713
12377
|
function _ts_param32(paramIndex, decorator) {
|
|
@@ -11934,7 +12598,7 @@ exports.OAuthService = class _OAuthService {
|
|
|
11934
12598
|
throw new AuthException(AUTH_ERROR_CODES.EMAIL_NOT_VERIFIED, common.HttpStatus.FORBIDDEN);
|
|
11935
12599
|
}
|
|
11936
12600
|
if (authUser.mfaEnabled) {
|
|
11937
|
-
const mfaTempToken = await this.tokenManager.issueMfaTempToken(authUser.id, "dashboard");
|
|
12601
|
+
const mfaTempToken = await this.tokenManager.issueMfaTempToken(authUser.id, "dashboard", authUser.tenantId);
|
|
11938
12602
|
this.logger.log(`handleCallback: OAuth MFA challenge issued provider=${provider} userId=${authUser.id} tenantId=${logSafe(tenantId)} action=${hookResult.action}`);
|
|
11939
12603
|
return {
|
|
11940
12604
|
mfaRequired: true,
|
|
@@ -11998,13 +12662,22 @@ exports.OAuthService = _ts_decorate54([
|
|
|
11998
12662
|
], exports.OAuthService);
|
|
11999
12663
|
function _ts_decorate55(decorators, target, key, desc) {
|
|
12000
12664
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12001
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
12002
|
-
|
|
12665
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12666
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12667
|
+
} else {
|
|
12668
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12669
|
+
if (d = decorators[i]) {
|
|
12670
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12671
|
+
}
|
|
12672
|
+
}
|
|
12673
|
+
}
|
|
12003
12674
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12004
12675
|
}
|
|
12005
12676
|
__name(_ts_decorate55, "_ts_decorate");
|
|
12006
|
-
function _ts_metadata53(
|
|
12007
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12677
|
+
function _ts_metadata53(metadataKey, metadataValue) {
|
|
12678
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12679
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12680
|
+
}
|
|
12008
12681
|
}
|
|
12009
12682
|
__name(_ts_metadata53, "_ts_metadata");
|
|
12010
12683
|
var OAuthCallbackQueryDto = class {
|
|
@@ -12149,13 +12822,22 @@ _ts_decorate55([
|
|
|
12149
12822
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
12150
12823
|
function _ts_decorate56(decorators, target, key, desc) {
|
|
12151
12824
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12152
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
12153
|
-
|
|
12825
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12826
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12827
|
+
} else {
|
|
12828
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12829
|
+
if (d = decorators[i]) {
|
|
12830
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12831
|
+
}
|
|
12832
|
+
}
|
|
12833
|
+
}
|
|
12154
12834
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12155
12835
|
}
|
|
12156
12836
|
__name(_ts_decorate56, "_ts_decorate");
|
|
12157
|
-
function _ts_metadata54(
|
|
12158
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12837
|
+
function _ts_metadata54(metadataKey, metadataValue) {
|
|
12838
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12839
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12840
|
+
}
|
|
12159
12841
|
}
|
|
12160
12842
|
__name(_ts_metadata54, "_ts_metadata");
|
|
12161
12843
|
var OAuthInitiateQueryDto = class {
|
|
@@ -12188,13 +12870,22 @@ _ts_decorate56([
|
|
|
12188
12870
|
// src/server/oauth/oauth.controller.ts
|
|
12189
12871
|
function _ts_decorate57(decorators, target, key, desc) {
|
|
12190
12872
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12191
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
12192
|
-
|
|
12873
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12874
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
12875
|
+
} else {
|
|
12876
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12877
|
+
if (d = decorators[i]) {
|
|
12878
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12879
|
+
}
|
|
12880
|
+
}
|
|
12881
|
+
}
|
|
12193
12882
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12194
12883
|
}
|
|
12195
12884
|
__name(_ts_decorate57, "_ts_decorate");
|
|
12196
|
-
function _ts_metadata55(
|
|
12197
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
12885
|
+
function _ts_metadata55(metadataKey, metadataValue) {
|
|
12886
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12887
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
12888
|
+
}
|
|
12198
12889
|
}
|
|
12199
12890
|
__name(_ts_metadata55, "_ts_metadata");
|
|
12200
12891
|
function _ts_param33(paramIndex, decorator) {
|
|
@@ -12613,8 +13304,15 @@ var GoogleOAuthPlugin = class {
|
|
|
12613
13304
|
// src/server/oauth/oauth.module.ts
|
|
12614
13305
|
function _ts_decorate58(decorators, target, key, desc) {
|
|
12615
13306
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12616
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
12617
|
-
|
|
13307
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13308
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
13309
|
+
} else {
|
|
13310
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13311
|
+
if (d = decorators[i]) {
|
|
13312
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13313
|
+
}
|
|
13314
|
+
}
|
|
13315
|
+
}
|
|
12618
13316
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12619
13317
|
}
|
|
12620
13318
|
__name(_ts_decorate58, "_ts_decorate");
|
|
@@ -12692,13 +13390,22 @@ OAuthModule = _ts_decorate58([
|
|
|
12692
13390
|
], OAuthModule);
|
|
12693
13391
|
function _ts_decorate59(decorators, target, key, desc) {
|
|
12694
13392
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12695
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
12696
|
-
|
|
13393
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13394
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
13395
|
+
} else {
|
|
13396
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13397
|
+
if (d = decorators[i]) {
|
|
13398
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13399
|
+
}
|
|
13400
|
+
}
|
|
13401
|
+
}
|
|
12697
13402
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12698
13403
|
}
|
|
12699
13404
|
__name(_ts_decorate59, "_ts_decorate");
|
|
12700
|
-
function _ts_metadata56(
|
|
12701
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
13405
|
+
function _ts_metadata56(metadataKey, metadataValue) {
|
|
13406
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13407
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
13408
|
+
}
|
|
12702
13409
|
}
|
|
12703
13410
|
__name(_ts_metadata56, "_ts_metadata");
|
|
12704
13411
|
function _ts_param34(paramIndex, decorator) {
|
|
@@ -13023,8 +13730,15 @@ exports.CommonPasswordChecker = _ts_decorate59([
|
|
|
13023
13730
|
], exports.CommonPasswordChecker);
|
|
13024
13731
|
function _ts_decorate60(decorators, target, key, desc) {
|
|
13025
13732
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13026
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13027
|
-
|
|
13733
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13734
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
13735
|
+
} else {
|
|
13736
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13737
|
+
if (d = decorators[i]) {
|
|
13738
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13739
|
+
}
|
|
13740
|
+
}
|
|
13741
|
+
}
|
|
13028
13742
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13029
13743
|
}
|
|
13030
13744
|
__name(_ts_decorate60, "_ts_decorate");
|
|
@@ -13069,8 +13783,15 @@ exports.NoOpEmailProvider = _ts_decorate60([
|
|
|
13069
13783
|
// src/server/bymax-auth.module.ts
|
|
13070
13784
|
function _ts_decorate61(decorators, target, key, desc) {
|
|
13071
13785
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13072
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13073
|
-
|
|
13786
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13787
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
13788
|
+
} else {
|
|
13789
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
13790
|
+
if (d = decorators[i]) {
|
|
13791
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13792
|
+
}
|
|
13793
|
+
}
|
|
13794
|
+
}
|
|
13074
13795
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13075
13796
|
}
|
|
13076
13797
|
__name(_ts_decorate61, "_ts_decorate");
|
|
@@ -13587,13 +14308,22 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
13587
14308
|
};
|
|
13588
14309
|
function _ts_decorate62(decorators, target, key, desc) {
|
|
13589
14310
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13590
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13591
|
-
|
|
14311
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14312
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
14313
|
+
} else {
|
|
14314
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
14315
|
+
if (d = decorators[i]) {
|
|
14316
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14317
|
+
}
|
|
14318
|
+
}
|
|
14319
|
+
}
|
|
13592
14320
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13593
14321
|
}
|
|
13594
14322
|
__name(_ts_decorate62, "_ts_decorate");
|
|
13595
|
-
function _ts_metadata57(
|
|
13596
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
14323
|
+
function _ts_metadata57(metadataKey, metadataValue) {
|
|
14324
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14325
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
14326
|
+
}
|
|
13597
14327
|
}
|
|
13598
14328
|
__name(_ts_metadata57, "_ts_metadata");
|
|
13599
14329
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
@@ -13673,8 +14403,15 @@ exports.AllowAllBreachChecker = _ts_decorate62([
|
|
|
13673
14403
|
], exports.AllowAllBreachChecker);
|
|
13674
14404
|
function _ts_decorate63(decorators, target, key, desc) {
|
|
13675
14405
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13676
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13677
|
-
|
|
14406
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14407
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
14408
|
+
} else {
|
|
14409
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
14410
|
+
if (d = decorators[i]) {
|
|
14411
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
}
|
|
13678
14415
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13679
14416
|
}
|
|
13680
14417
|
__name(_ts_decorate63, "_ts_decorate");
|
|
@@ -13697,13 +14434,22 @@ exports.OptionalAuthGuard = _ts_decorate63([
|
|
|
13697
14434
|
], exports.OptionalAuthGuard);
|
|
13698
14435
|
function _ts_decorate64(decorators, target, key, desc) {
|
|
13699
14436
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13700
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13701
|
-
|
|
14437
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14438
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
14439
|
+
} else {
|
|
14440
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
14441
|
+
if (d = decorators[i]) {
|
|
14442
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14443
|
+
}
|
|
14444
|
+
}
|
|
14445
|
+
}
|
|
13702
14446
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13703
14447
|
}
|
|
13704
14448
|
__name(_ts_decorate64, "_ts_decorate");
|
|
13705
|
-
function _ts_metadata58(
|
|
13706
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
14449
|
+
function _ts_metadata58(metadataKey, metadataValue) {
|
|
14450
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14451
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
14452
|
+
}
|
|
13707
14453
|
}
|
|
13708
14454
|
__name(_ts_metadata58, "_ts_metadata");
|
|
13709
14455
|
function _ts_param35(paramIndex, decorator) {
|
|
@@ -13760,13 +14506,22 @@ function isHexLooking(value) {
|
|
|
13760
14506
|
__name(isHexLooking, "isHexLooking");
|
|
13761
14507
|
function _ts_decorate65(decorators, target, key, desc) {
|
|
13762
14508
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13763
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13764
|
-
|
|
14509
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14510
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
14511
|
+
} else {
|
|
14512
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
14513
|
+
if (d = decorators[i]) {
|
|
14514
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14515
|
+
}
|
|
14516
|
+
}
|
|
14517
|
+
}
|
|
13765
14518
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13766
14519
|
}
|
|
13767
14520
|
__name(_ts_decorate65, "_ts_decorate");
|
|
13768
|
-
function _ts_metadata59(
|
|
13769
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
14521
|
+
function _ts_metadata59(metadataKey, metadataValue) {
|
|
14522
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14523
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
14524
|
+
}
|
|
13770
14525
|
}
|
|
13771
14526
|
__name(_ts_metadata59, "_ts_metadata");
|
|
13772
14527
|
function _ts_param36(paramIndex, decorator) {
|
|
@@ -13874,8 +14629,15 @@ function readUpgradeTicket(client) {
|
|
|
13874
14629
|
__name(readUpgradeTicket, "readUpgradeTicket");
|
|
13875
14630
|
function _ts_decorate66(decorators, target, key, desc) {
|
|
13876
14631
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13877
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
13878
|
-
|
|
14632
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14633
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
14634
|
+
} else {
|
|
14635
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
14636
|
+
if (d = decorators[i]) {
|
|
14637
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14638
|
+
}
|
|
14639
|
+
}
|
|
14640
|
+
}
|
|
13879
14641
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13880
14642
|
}
|
|
13881
14643
|
__name(_ts_decorate66, "_ts_decorate");
|