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