@bymax-one/nest-auth 1.0.4 → 1.0.6
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 +41 -0
- package/dist/server/index.cjs +705 -333
- package/dist/server/index.d.cts +120 -4
- package/dist/server/index.d.ts +120 -4
- package/dist/server/index.mjs +705 -334
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -43,7 +43,13 @@ var DEFAULT_OPTIONS = {
|
|
|
43
43
|
accessTokenName: "access_token",
|
|
44
44
|
refreshTokenName: "refresh_token",
|
|
45
45
|
sessionSignalName: "has_session",
|
|
46
|
-
refreshCookiePath: "/auth"
|
|
46
|
+
refreshCookiePath: "/auth",
|
|
47
|
+
// 'lax' matches Chromium's default for cookies that omit SameSite. It
|
|
48
|
+
// delivers auth cookies on top-level cross-site GET navigations — the
|
|
49
|
+
// case that makes OAuth redirects (Google → callback → dashboard) work
|
|
50
|
+
// without dropping the freshly-issued session on the first hop. Consumers
|
|
51
|
+
// that want the stricter posture can override via `cookies.sameSite`.
|
|
52
|
+
sameSite: "lax"
|
|
47
53
|
},
|
|
48
54
|
mfa: {
|
|
49
55
|
recoveryCodeCount: 8,
|
|
@@ -142,6 +148,7 @@ function resolveOptions(userOptions) {
|
|
|
142
148
|
validateOAuthProviders(userOptions.oauth);
|
|
143
149
|
validateOAuthSuccessRedirectUrl(userOptions);
|
|
144
150
|
validateRefreshCookiePath(userOptions.routePrefix, userOptions.cookies);
|
|
151
|
+
validateSameSiteNoneRequiresSecure(userOptions);
|
|
145
152
|
validateRefreshGraceWindow(userOptions.jwt);
|
|
146
153
|
const { mfa: _mfa, ...userOptionsWithoutMfa } = userOptions;
|
|
147
154
|
const resolved = {
|
|
@@ -342,6 +349,15 @@ function validateRefreshCookiePath(routePrefix, cookies) {
|
|
|
342
349
|
}
|
|
343
350
|
}
|
|
344
351
|
__name(validateRefreshCookiePath, "validateRefreshCookiePath");
|
|
352
|
+
function validateSameSiteNoneRequiresSecure(userOptions) {
|
|
353
|
+
const sameSite = userOptions.cookies?.sameSite;
|
|
354
|
+
if (sameSite !== "none") return;
|
|
355
|
+
const secureCookies = userOptions.secureCookies ?? process.env["NODE_ENV"] === "production";
|
|
356
|
+
if (!secureCookies) {
|
|
357
|
+
throw new Error(`[BymaxAuthModule] cookies.sameSite is 'none' but secureCookies is false. Browsers reject SameSite=None cookies without the Secure attribute, so the auth cookies would never be stored. Set secureCookies: true (and serve over HTTPS) or use cookies.sameSite: 'lax' / 'strict'.`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
__name(validateSameSiteNoneRequiresSecure, "validateSameSiteNoneRequiresSecure");
|
|
345
361
|
function validateRefreshGraceWindow(jwt) {
|
|
346
362
|
const graceSeconds = jwt.refreshGraceWindowSeconds ?? DEFAULT_OPTIONS.jwt.refreshGraceWindowSeconds;
|
|
347
363
|
const refreshExpiresInDays = jwt.refreshExpiresInDays ?? DEFAULT_OPTIONS.jwt.refreshExpiresInDays;
|
|
@@ -1456,9 +1472,16 @@ var TokenDeliveryService = class {
|
|
|
1456
1472
|
maxAge: refreshMaxAge
|
|
1457
1473
|
});
|
|
1458
1474
|
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Returns the shared cookie attributes applied to every cookie issued by
|
|
1477
|
+
* this service. `sameSite` comes from the resolved options (defaults to
|
|
1478
|
+
* `'lax'`); the `domain` is folded in only when the consumer supplies a
|
|
1479
|
+
* resolver. Other per-cookie attributes (`httpOnly`, `secure`, `path`,
|
|
1480
|
+
* `maxAge`) are spread on top of this base by the callers.
|
|
1481
|
+
*/
|
|
1459
1482
|
baseCookieOptions(domain) {
|
|
1460
1483
|
return {
|
|
1461
|
-
sameSite:
|
|
1484
|
+
sameSite: this.options.cookies.sameSite,
|
|
1462
1485
|
...domain ? {
|
|
1463
1486
|
domain
|
|
1464
1487
|
} : {}
|
|
@@ -4210,6 +4233,39 @@ function _ts_metadata21(k, v) {
|
|
|
4210
4233
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4211
4234
|
}
|
|
4212
4235
|
__name(_ts_metadata21, "_ts_metadata");
|
|
4236
|
+
var MfaRegenerateRecoveryCodesDto = class {
|
|
4237
|
+
static {
|
|
4238
|
+
__name(this, "MfaRegenerateRecoveryCodesDto");
|
|
4239
|
+
}
|
|
4240
|
+
/**
|
|
4241
|
+
* The 6-digit TOTP code generated by the user's authenticator app.
|
|
4242
|
+
*
|
|
4243
|
+
* Must be exactly 6 decimal digits. Recovery codes are not accepted by design.
|
|
4244
|
+
* Alphabetic characters, spaces, or other symbols are rejected before reaching
|
|
4245
|
+
* the service layer.
|
|
4246
|
+
*/
|
|
4247
|
+
code;
|
|
4248
|
+
};
|
|
4249
|
+
_ts_decorate21([
|
|
4250
|
+
MaxLength(6),
|
|
4251
|
+
Matches(/^\d{6}$/, {
|
|
4252
|
+
message: "code must be exactly 6 digits"
|
|
4253
|
+
}),
|
|
4254
|
+
IsString(),
|
|
4255
|
+
IsNotEmpty(),
|
|
4256
|
+
_ts_metadata21("design:type", String)
|
|
4257
|
+
], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
|
|
4258
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
4259
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4260
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4261
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4262
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4263
|
+
}
|
|
4264
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
4265
|
+
function _ts_metadata22(k, v) {
|
|
4266
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4267
|
+
}
|
|
4268
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
4213
4269
|
var MfaVerifyDto = class {
|
|
4214
4270
|
static {
|
|
4215
4271
|
__name(this, "MfaVerifyDto");
|
|
@@ -4222,14 +4278,14 @@ var MfaVerifyDto = class {
|
|
|
4222
4278
|
*/
|
|
4223
4279
|
code;
|
|
4224
4280
|
};
|
|
4225
|
-
|
|
4281
|
+
_ts_decorate22([
|
|
4226
4282
|
MaxLength(6),
|
|
4227
4283
|
Matches(/^\d{6}$/, {
|
|
4228
4284
|
message: "code must be exactly 6 digits"
|
|
4229
4285
|
}),
|
|
4230
4286
|
IsString(),
|
|
4231
4287
|
IsNotEmpty(),
|
|
4232
|
-
|
|
4288
|
+
_ts_metadata22("design:type", String)
|
|
4233
4289
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
4234
4290
|
var IV_LENGTH = 12;
|
|
4235
4291
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
@@ -4386,17 +4442,17 @@ function verifyTotp(secretBase32, code, window = 1) {
|
|
|
4386
4442
|
__name(verifyTotp, "verifyTotp");
|
|
4387
4443
|
|
|
4388
4444
|
// src/server/services/mfa.service.ts
|
|
4389
|
-
function
|
|
4445
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
4390
4446
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4391
4447
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4392
4448
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4393
4449
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4394
4450
|
}
|
|
4395
|
-
__name(
|
|
4396
|
-
function
|
|
4451
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
4452
|
+
function _ts_metadata23(k, v) {
|
|
4397
4453
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4398
4454
|
}
|
|
4399
|
-
__name(
|
|
4455
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
4400
4456
|
function _ts_param12(paramIndex, decorator) {
|
|
4401
4457
|
return function(target, key) {
|
|
4402
4458
|
decorator(target, key, paramIndex);
|
|
@@ -4587,7 +4643,7 @@ var MfaService = class _MfaService {
|
|
|
4587
4643
|
// setup — TOTP secret generation, idempotent key reservation, recovery codes
|
|
4588
4644
|
// ---------------------------------------------------------------------------
|
|
4589
4645
|
/**
|
|
4590
|
-
* Initiates the MFA setup flow for a dashboard user.
|
|
4646
|
+
* Initiates the MFA setup flow for a dashboard user or platform administrator.
|
|
4591
4647
|
*
|
|
4592
4648
|
* Generates a TOTP secret and 8 recovery codes, stores them temporarily in
|
|
4593
4649
|
* Redis (10 minutes), and returns the data needed to display the QR code and
|
|
@@ -4598,12 +4654,19 @@ var MfaService = class _MfaService {
|
|
|
4598
4654
|
* requests cannot generate different secrets.
|
|
4599
4655
|
*
|
|
4600
4656
|
* @param userId - Internal ID of the user enabling MFA.
|
|
4657
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4601
4658
|
* @returns Setup result containing the secret, QR URI, and plain recovery codes.
|
|
4602
4659
|
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
4660
|
+
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
4661
|
+
* repository was not configured at module registration. The error code is
|
|
4662
|
+
* reused (rather than introducing a new one) because the consumer-facing
|
|
4663
|
+
* meaning is the same: "platform MFA cannot operate".
|
|
4603
4664
|
*/
|
|
4604
|
-
async setup(userId) {
|
|
4605
|
-
|
|
4606
|
-
|
|
4665
|
+
async setup(userId, context = "dashboard") {
|
|
4666
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
4667
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
4668
|
+
}
|
|
4669
|
+
const user = await this.fetchUserForContext(context, userId);
|
|
4607
4670
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
4608
4671
|
const setupKey = `mfa_setup:${hmacSha256(userId, this.options.hmacKey)}`;
|
|
4609
4672
|
const existingFast = await this.redis.get(setupKey);
|
|
@@ -4648,7 +4711,7 @@ var MfaService = class _MfaService {
|
|
|
4648
4711
|
await this.redis.set(setupKey, payload, MFA_SETUP_TTL_SECONDS);
|
|
4649
4712
|
}
|
|
4650
4713
|
const qrCodeUri = buildTotpUri(secretBase32, user.email, this.mfaOptions.issuer);
|
|
4651
|
-
this.logger.log(`setup: MFA setup initiated userId=${userId}`);
|
|
4714
|
+
this.logger.log(`setup: MFA setup initiated userId=${userId} context=${context}`);
|
|
4652
4715
|
return {
|
|
4653
4716
|
secret: secretBase32,
|
|
4654
4717
|
qrCodeUri,
|
|
@@ -4671,12 +4734,17 @@ var MfaService = class _MfaService {
|
|
|
4671
4734
|
* @param code - 6-digit TOTP code from the authenticator app.
|
|
4672
4735
|
* @param ip - Client IP address (forwarded to hooks).
|
|
4673
4736
|
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
4737
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4674
4738
|
* @throws `MFA_SETUP_REQUIRED` if no pending setup data is found in Redis.
|
|
4675
4739
|
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is invalid.
|
|
4740
|
+
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
4741
|
+
* repository was not configured at module registration.
|
|
4676
4742
|
*/
|
|
4677
|
-
async verifyAndEnable(userId, code, ip, userAgent) {
|
|
4678
|
-
|
|
4679
|
-
|
|
4743
|
+
async verifyAndEnable(userId, code, ip, userAgent, context = "dashboard") {
|
|
4744
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
4745
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
4746
|
+
}
|
|
4747
|
+
const user = await this.fetchUserForContext(context, userId);
|
|
4680
4748
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
4681
4749
|
const setupKey = `mfa_setup:${hmacSha256(userId, this.options.hmacKey)}`;
|
|
4682
4750
|
const raw = await this.redis.get(setupKey);
|
|
@@ -4694,16 +4762,22 @@ var MfaService = class _MfaService {
|
|
|
4694
4762
|
this.logger.warn(`verifyAndEnable: setup key consumed by concurrent request userId=${userId}`);
|
|
4695
4763
|
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
4696
4764
|
}
|
|
4697
|
-
|
|
4765
|
+
const enableData = {
|
|
4698
4766
|
mfaEnabled: true,
|
|
4699
4767
|
mfaSecret: data.encryptedSecret,
|
|
4700
4768
|
mfaRecoveryCodes: data.hashedCodes
|
|
4701
|
-
}
|
|
4769
|
+
};
|
|
4770
|
+
if (context === "platform" && this.platformUserRepo) {
|
|
4771
|
+
await this.platformUserRepo.updateMfa(userId, enableData);
|
|
4772
|
+
} else {
|
|
4773
|
+
await this.userRepo.updateMfa(userId, enableData);
|
|
4774
|
+
}
|
|
4702
4775
|
await this.redis.invalidateUserSessions(userId);
|
|
4703
|
-
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId}`);
|
|
4776
|
+
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId} context=${context}`);
|
|
4704
4777
|
await this.emailProvider.sendMfaEnabledNotification(user.email);
|
|
4705
4778
|
if (this.hooks.afterMfaEnabled) {
|
|
4706
|
-
|
|
4779
|
+
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
4780
|
+
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
4707
4781
|
userId,
|
|
4708
4782
|
ip,
|
|
4709
4783
|
userAgent,
|
|
@@ -4882,6 +4956,95 @@ var MfaService = class _MfaService {
|
|
|
4882
4956
|
}
|
|
4883
4957
|
}
|
|
4884
4958
|
// ---------------------------------------------------------------------------
|
|
4959
|
+
// regenerateRecoveryCodes — rotate the recovery code set for an MFA-enabled user
|
|
4960
|
+
// ---------------------------------------------------------------------------
|
|
4961
|
+
/**
|
|
4962
|
+
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
4963
|
+
*
|
|
4964
|
+
* Mirrors {@link disable} in its security posture: only TOTP codes are accepted
|
|
4965
|
+
* (recovery codes cannot rotate themselves by design), the brute-force counter
|
|
4966
|
+
* is checked, and the regeneration is fired against the correct repository for
|
|
4967
|
+
* the supplied `context`. The TOTP secret on the user record is unchanged — only
|
|
4968
|
+
* the recovery code list is replaced.
|
|
4969
|
+
*
|
|
4970
|
+
* Returns the plain-text codes once. They are NOT persisted in plain form; only
|
|
4971
|
+
* scrypt hashes go into the database. The caller is responsible for showing the
|
|
4972
|
+
* codes to the user exactly once and warning them to save them safely.
|
|
4973
|
+
*
|
|
4974
|
+
* @remarks
|
|
4975
|
+
* **Sessions are intentionally NOT invalidated after this call.** Unlike
|
|
4976
|
+
* {@link verifyAndEnable} (which flips `mfaEnabled` from `false` to `true`) and
|
|
4977
|
+
* {@link disable} (which flips it back to `false`), this method does not change
|
|
4978
|
+
* the verification credential — the TOTP secret stays the same and existing
|
|
4979
|
+
* `mfaVerified: true` access tokens remain valid. Invalidating sessions here
|
|
4980
|
+
* would force a redundant re-auth on every recovery-code rotation, which is a
|
|
4981
|
+
* routine hygiene action a user might perform several times over the lifetime
|
|
4982
|
+
* of an account.
|
|
4983
|
+
*
|
|
4984
|
+
* @param userId - Internal ID of the user rotating recovery codes.
|
|
4985
|
+
* @param totpCode - 6-digit TOTP code from the authenticator app.
|
|
4986
|
+
* @param ip - Client IP address (forwarded to hooks).
|
|
4987
|
+
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
4988
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4989
|
+
* @throws `TOKEN_INVALID` if the user is not found or `mfaSecret` is missing
|
|
4990
|
+
* when `mfaEnabled` is `true` (database inconsistency).
|
|
4991
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active, or if
|
|
4992
|
+
* `context === 'platform'` and the platform user repository was not
|
|
4993
|
+
* configured at module registration.
|
|
4994
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
4995
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
4996
|
+
* @returns The freshly generated plain-text recovery codes, one-time display.
|
|
4997
|
+
*/
|
|
4998
|
+
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard") {
|
|
4999
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
5000
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
5001
|
+
}
|
|
5002
|
+
const user = await this.fetchUserForContext(context, userId);
|
|
5003
|
+
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
5004
|
+
const bfIdentifier = hmacSha256(`disable:${userId}`, this.options.hmacKey);
|
|
5005
|
+
if (await this.bruteForce.isLockedOut(bfIdentifier)) {
|
|
5006
|
+
this.logger.warn(`regenerateRecoveryCodes: account locked userId=${userId} context=${context}`);
|
|
5007
|
+
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
5008
|
+
}
|
|
5009
|
+
if (!user.mfaSecret) {
|
|
5010
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
5011
|
+
}
|
|
5012
|
+
const secretBase32 = this.decryptSecret(user.mfaSecret);
|
|
5013
|
+
const totpWindow = this.mfaOptions.totpWindow;
|
|
5014
|
+
const codeValid = await this.verifyTotpWithAntiReplay(userId, secretBase32, totpCode, totpWindow);
|
|
5015
|
+
if (!codeValid) {
|
|
5016
|
+
await this.bruteForce.recordFailure(bfIdentifier);
|
|
5017
|
+
this.logger.warn(`regenerateRecoveryCodes: invalid MFA code userId=${userId} context=${context}`);
|
|
5018
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
5019
|
+
}
|
|
5020
|
+
await this.bruteForce.resetFailures(bfIdentifier);
|
|
5021
|
+
const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
5022
|
+
const { plainCodes, hashedCodes } = await this.hashRecoveryCodes(recoveryCount);
|
|
5023
|
+
const updateData = {
|
|
5024
|
+
mfaEnabled: true,
|
|
5025
|
+
mfaSecret: user.mfaSecret,
|
|
5026
|
+
mfaRecoveryCodes: hashedCodes
|
|
5027
|
+
};
|
|
5028
|
+
if (context === "platform" && this.platformUserRepo) {
|
|
5029
|
+
await this.platformUserRepo.updateMfa(userId, updateData);
|
|
5030
|
+
} else {
|
|
5031
|
+
await this.userRepo.updateMfa(userId, updateData);
|
|
5032
|
+
}
|
|
5033
|
+
this.logger.log(`regenerateRecoveryCodes: recovery codes regenerated userId=${userId} context=${context}`);
|
|
5034
|
+
if (this.hooks.afterMfaRecoveryCodesRegenerated) {
|
|
5035
|
+
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
5036
|
+
void Promise.resolve(this.hooks.afterMfaRecoveryCodesRegenerated(safeUser, {
|
|
5037
|
+
userId,
|
|
5038
|
+
ip,
|
|
5039
|
+
userAgent,
|
|
5040
|
+
sanitizedHeaders: {}
|
|
5041
|
+
})).catch(() => void 0);
|
|
5042
|
+
}
|
|
5043
|
+
return {
|
|
5044
|
+
recoveryCodes: plainCodes
|
|
5045
|
+
};
|
|
5046
|
+
}
|
|
5047
|
+
// ---------------------------------------------------------------------------
|
|
4885
5048
|
// Private helpers
|
|
4886
5049
|
// ---------------------------------------------------------------------------
|
|
4887
5050
|
/**
|
|
@@ -4920,7 +5083,7 @@ var MfaService = class _MfaService {
|
|
|
4920
5083
|
return admin;
|
|
4921
5084
|
}
|
|
4922
5085
|
};
|
|
4923
|
-
MfaService =
|
|
5086
|
+
MfaService = _ts_decorate23([
|
|
4924
5087
|
Injectable(),
|
|
4925
5088
|
_ts_param12(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
4926
5089
|
_ts_param12(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -4928,8 +5091,8 @@ MfaService = _ts_decorate22([
|
|
|
4928
5091
|
_ts_param12(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
4929
5092
|
_ts_param12(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
4930
5093
|
_ts_param12(9, Inject(BYMAX_AUTH_HOOKS)),
|
|
4931
|
-
|
|
4932
|
-
|
|
5094
|
+
_ts_metadata23("design:type", Function),
|
|
5095
|
+
_ts_metadata23("design:paramtypes", [
|
|
4933
5096
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
4934
5097
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
4935
5098
|
Object,
|
|
@@ -4944,17 +5107,17 @@ MfaService = _ts_decorate22([
|
|
|
4944
5107
|
], MfaService);
|
|
4945
5108
|
|
|
4946
5109
|
// src/server/controllers/mfa.controller.ts
|
|
4947
|
-
function
|
|
5110
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
4948
5111
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4949
5112
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4950
5113
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4951
5114
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4952
5115
|
}
|
|
4953
|
-
__name(
|
|
4954
|
-
function
|
|
5116
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
5117
|
+
function _ts_metadata24(k, v) {
|
|
4955
5118
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4956
5119
|
}
|
|
4957
|
-
__name(
|
|
5120
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
4958
5121
|
function _ts_param13(paramIndex, decorator) {
|
|
4959
5122
|
return function(target, key) {
|
|
4960
5123
|
decorator(target, key, paramIndex);
|
|
@@ -5053,19 +5216,44 @@ var MfaController = class {
|
|
|
5053
5216
|
const context = user.type === "platform" ? "platform" : "dashboard";
|
|
5054
5217
|
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, context);
|
|
5055
5218
|
}
|
|
5219
|
+
/**
|
|
5220
|
+
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
5221
|
+
*
|
|
5222
|
+
* Requires a valid TOTP code (recovery codes are not accepted by design — see
|
|
5223
|
+
* {@link MfaRegenerateRecoveryCodesDto} for the rationale). The freshly
|
|
5224
|
+
* generated plain-text codes are returned in the response body and are shown
|
|
5225
|
+
* once. Only their scrypt hashes are persisted.
|
|
5226
|
+
*
|
|
5227
|
+
* Shares the disable throttle config because the security posture is identical
|
|
5228
|
+
* (authenticated, TOTP-gated, MFA-affecting state change).
|
|
5229
|
+
*
|
|
5230
|
+
* @param user - JWT payload of the authenticated user.
|
|
5231
|
+
* @param dto - Contains the 6-digit TOTP code confirming the action.
|
|
5232
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
5233
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active on the account.
|
|
5234
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
5235
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
5236
|
+
* @returns The fresh plain-text recovery codes, one-time display.
|
|
5237
|
+
*/
|
|
5238
|
+
async regenerateRecoveryCodes(user, dto, req) {
|
|
5239
|
+
const ip = req.ip ?? "";
|
|
5240
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
5241
|
+
const context = user.type === "platform" ? "platform" : "dashboard";
|
|
5242
|
+
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, context);
|
|
5243
|
+
}
|
|
5056
5244
|
};
|
|
5057
|
-
|
|
5245
|
+
_ts_decorate24([
|
|
5058
5246
|
UseGuards(JwtAuthGuard),
|
|
5059
5247
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
5060
5248
|
Post("setup"),
|
|
5061
5249
|
_ts_param13(0, CurrentUser()),
|
|
5062
|
-
|
|
5063
|
-
|
|
5250
|
+
_ts_metadata24("design:type", Function),
|
|
5251
|
+
_ts_metadata24("design:paramtypes", [
|
|
5064
5252
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
5065
5253
|
]),
|
|
5066
|
-
|
|
5254
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5067
5255
|
], MfaController.prototype, "setup", null);
|
|
5068
|
-
|
|
5256
|
+
_ts_decorate24([
|
|
5069
5257
|
UseGuards(JwtAuthGuard),
|
|
5070
5258
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
5071
5259
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
@@ -5073,15 +5261,15 @@ _ts_decorate23([
|
|
|
5073
5261
|
_ts_param13(0, CurrentUser()),
|
|
5074
5262
|
_ts_param13(1, Body()),
|
|
5075
5263
|
_ts_param13(2, Req()),
|
|
5076
|
-
|
|
5077
|
-
|
|
5264
|
+
_ts_metadata24("design:type", Function),
|
|
5265
|
+
_ts_metadata24("design:paramtypes", [
|
|
5078
5266
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
5079
5267
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
5080
5268
|
typeof Request === "undefined" ? Object : Request
|
|
5081
5269
|
]),
|
|
5082
|
-
|
|
5270
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5083
5271
|
], MfaController.prototype, "verifyEnable", null);
|
|
5084
|
-
|
|
5272
|
+
_ts_decorate24([
|
|
5085
5273
|
Public(),
|
|
5086
5274
|
SkipMfa(),
|
|
5087
5275
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
@@ -5092,15 +5280,15 @@ _ts_decorate23([
|
|
|
5092
5280
|
_ts_param13(2, Res({
|
|
5093
5281
|
passthrough: true
|
|
5094
5282
|
})),
|
|
5095
|
-
|
|
5096
|
-
|
|
5283
|
+
_ts_metadata24("design:type", Function),
|
|
5284
|
+
_ts_metadata24("design:paramtypes", [
|
|
5097
5285
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
5098
5286
|
typeof Request === "undefined" ? Object : Request,
|
|
5099
5287
|
typeof Response === "undefined" ? Object : Response
|
|
5100
5288
|
]),
|
|
5101
|
-
|
|
5289
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5102
5290
|
], MfaController.prototype, "challenge", null);
|
|
5103
|
-
|
|
5291
|
+
_ts_decorate24([
|
|
5104
5292
|
UseGuards(JwtAuthGuard),
|
|
5105
5293
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
5106
5294
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
@@ -5108,38 +5296,54 @@ _ts_decorate23([
|
|
|
5108
5296
|
_ts_param13(0, CurrentUser()),
|
|
5109
5297
|
_ts_param13(1, Body()),
|
|
5110
5298
|
_ts_param13(2, Req()),
|
|
5111
|
-
|
|
5112
|
-
|
|
5299
|
+
_ts_metadata24("design:type", Function),
|
|
5300
|
+
_ts_metadata24("design:paramtypes", [
|
|
5113
5301
|
Object,
|
|
5114
5302
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
5115
5303
|
typeof Request === "undefined" ? Object : Request
|
|
5116
5304
|
]),
|
|
5117
|
-
|
|
5305
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5118
5306
|
], MfaController.prototype, "disable", null);
|
|
5119
|
-
|
|
5307
|
+
_ts_decorate24([
|
|
5308
|
+
UseGuards(JwtAuthGuard),
|
|
5309
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
5310
|
+
HttpCode(HttpStatus.OK),
|
|
5311
|
+
Post("recovery-codes"),
|
|
5312
|
+
_ts_param13(0, CurrentUser()),
|
|
5313
|
+
_ts_param13(1, Body()),
|
|
5314
|
+
_ts_param13(2, Req()),
|
|
5315
|
+
_ts_metadata24("design:type", Function),
|
|
5316
|
+
_ts_metadata24("design:paramtypes", [
|
|
5317
|
+
Object,
|
|
5318
|
+
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
5319
|
+
typeof Request === "undefined" ? Object : Request
|
|
5320
|
+
]),
|
|
5321
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5322
|
+
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
5323
|
+
MfaController = _ts_decorate24([
|
|
5120
5324
|
Controller("mfa"),
|
|
5121
5325
|
UsePipes(new ValidationPipe({
|
|
5122
5326
|
whitelist: true,
|
|
5123
5327
|
forbidNonWhitelisted: true,
|
|
5124
5328
|
forbidUnknownValues: true
|
|
5125
5329
|
})),
|
|
5126
|
-
|
|
5127
|
-
|
|
5330
|
+
_ts_metadata24("design:type", Function),
|
|
5331
|
+
_ts_metadata24("design:paramtypes", [
|
|
5128
5332
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
5129
5333
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
5130
5334
|
])
|
|
5131
5335
|
], MfaController);
|
|
5132
|
-
function
|
|
5336
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
5133
5337
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5134
5338
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5135
5339
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5136
5340
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5137
5341
|
}
|
|
5138
|
-
__name(
|
|
5139
|
-
function
|
|
5342
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
5343
|
+
function _ts_metadata25(k, v) {
|
|
5140
5344
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5141
5345
|
}
|
|
5142
|
-
__name(
|
|
5346
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
5143
5347
|
var ForgotPasswordDto = class {
|
|
5144
5348
|
static {
|
|
5145
5349
|
__name(this, "ForgotPasswordDto");
|
|
@@ -5155,29 +5359,29 @@ var ForgotPasswordDto = class {
|
|
|
5155
5359
|
*/
|
|
5156
5360
|
tenantId;
|
|
5157
5361
|
};
|
|
5158
|
-
|
|
5362
|
+
_ts_decorate25([
|
|
5159
5363
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5160
5364
|
IsEmail(),
|
|
5161
5365
|
MaxLength(255),
|
|
5162
|
-
|
|
5366
|
+
_ts_metadata25("design:type", String)
|
|
5163
5367
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
5164
|
-
|
|
5368
|
+
_ts_decorate25([
|
|
5165
5369
|
IsString(),
|
|
5166
5370
|
IsNotEmpty(),
|
|
5167
5371
|
MaxLength(128),
|
|
5168
|
-
|
|
5372
|
+
_ts_metadata25("design:type", String)
|
|
5169
5373
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
5170
|
-
function
|
|
5374
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
5171
5375
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5172
5376
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5173
5377
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5174
5378
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5175
5379
|
}
|
|
5176
|
-
__name(
|
|
5177
|
-
function
|
|
5380
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
5381
|
+
function _ts_metadata26(k, v) {
|
|
5178
5382
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5179
5383
|
}
|
|
5180
|
-
__name(
|
|
5384
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
5181
5385
|
var ResendOtpDto = class {
|
|
5182
5386
|
static {
|
|
5183
5387
|
__name(this, "ResendOtpDto");
|
|
@@ -5192,29 +5396,29 @@ var ResendOtpDto = class {
|
|
|
5192
5396
|
*/
|
|
5193
5397
|
tenantId;
|
|
5194
5398
|
};
|
|
5195
|
-
|
|
5399
|
+
_ts_decorate26([
|
|
5196
5400
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5197
5401
|
IsEmail(),
|
|
5198
5402
|
MaxLength(255),
|
|
5199
|
-
|
|
5403
|
+
_ts_metadata26("design:type", String)
|
|
5200
5404
|
], ResendOtpDto.prototype, "email", void 0);
|
|
5201
|
-
|
|
5405
|
+
_ts_decorate26([
|
|
5202
5406
|
IsString(),
|
|
5203
5407
|
IsNotEmpty(),
|
|
5204
5408
|
MaxLength(128),
|
|
5205
|
-
|
|
5409
|
+
_ts_metadata26("design:type", String)
|
|
5206
5410
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
5207
|
-
function
|
|
5411
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
5208
5412
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5209
5413
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5210
5414
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5211
5415
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5212
5416
|
}
|
|
5213
|
-
__name(
|
|
5214
|
-
function
|
|
5417
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
5418
|
+
function _ts_metadata27(k, v) {
|
|
5215
5419
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5216
5420
|
}
|
|
5217
|
-
__name(
|
|
5421
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
5218
5422
|
var ResetPasswordDto = class {
|
|
5219
5423
|
static {
|
|
5220
5424
|
__name(this, "ResetPasswordDto");
|
|
@@ -5254,54 +5458,54 @@ var ResetPasswordDto = class {
|
|
|
5254
5458
|
*/
|
|
5255
5459
|
tenantId;
|
|
5256
5460
|
};
|
|
5257
|
-
|
|
5461
|
+
_ts_decorate27([
|
|
5258
5462
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5259
5463
|
IsEmail(),
|
|
5260
5464
|
MaxLength(255),
|
|
5261
|
-
|
|
5465
|
+
_ts_metadata27("design:type", String)
|
|
5262
5466
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
5263
|
-
|
|
5467
|
+
_ts_decorate27([
|
|
5264
5468
|
IsString(),
|
|
5265
5469
|
MinLength(8),
|
|
5266
5470
|
MaxLength(128),
|
|
5267
|
-
|
|
5471
|
+
_ts_metadata27("design:type", String)
|
|
5268
5472
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
5269
|
-
|
|
5473
|
+
_ts_decorate27([
|
|
5270
5474
|
IsOptional(),
|
|
5271
5475
|
IsString(),
|
|
5272
5476
|
IsNotEmpty(),
|
|
5273
5477
|
MaxLength(2048),
|
|
5274
|
-
|
|
5478
|
+
_ts_metadata27("design:type", String)
|
|
5275
5479
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
5276
|
-
|
|
5480
|
+
_ts_decorate27([
|
|
5277
5481
|
IsOptional(),
|
|
5278
5482
|
IsString(),
|
|
5279
5483
|
Length(4, 8),
|
|
5280
|
-
|
|
5484
|
+
_ts_metadata27("design:type", String)
|
|
5281
5485
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
5282
|
-
|
|
5486
|
+
_ts_decorate27([
|
|
5283
5487
|
IsOptional(),
|
|
5284
5488
|
IsString(),
|
|
5285
5489
|
Length(64, 64),
|
|
5286
|
-
|
|
5490
|
+
_ts_metadata27("design:type", String)
|
|
5287
5491
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
5288
|
-
|
|
5492
|
+
_ts_decorate27([
|
|
5289
5493
|
IsString(),
|
|
5290
5494
|
IsNotEmpty(),
|
|
5291
5495
|
MaxLength(128),
|
|
5292
|
-
|
|
5496
|
+
_ts_metadata27("design:type", String)
|
|
5293
5497
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
5294
|
-
function
|
|
5498
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
5295
5499
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5296
5500
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5297
5501
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5298
5502
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5299
5503
|
}
|
|
5300
|
-
__name(
|
|
5301
|
-
function
|
|
5504
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
5505
|
+
function _ts_metadata28(k, v) {
|
|
5302
5506
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5303
5507
|
}
|
|
5304
|
-
__name(
|
|
5508
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
5305
5509
|
var VerifyOtpDto = class {
|
|
5306
5510
|
static {
|
|
5307
5511
|
__name(this, "VerifyOtpDto");
|
|
@@ -5323,34 +5527,34 @@ var VerifyOtpDto = class {
|
|
|
5323
5527
|
*/
|
|
5324
5528
|
tenantId;
|
|
5325
5529
|
};
|
|
5326
|
-
|
|
5530
|
+
_ts_decorate28([
|
|
5327
5531
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5328
5532
|
IsEmail(),
|
|
5329
5533
|
MaxLength(255),
|
|
5330
|
-
|
|
5534
|
+
_ts_metadata28("design:type", String)
|
|
5331
5535
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
5332
|
-
|
|
5536
|
+
_ts_decorate28([
|
|
5333
5537
|
IsString(),
|
|
5334
5538
|
Length(4, 8),
|
|
5335
|
-
|
|
5539
|
+
_ts_metadata28("design:type", String)
|
|
5336
5540
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
5337
|
-
|
|
5541
|
+
_ts_decorate28([
|
|
5338
5542
|
IsString(),
|
|
5339
5543
|
IsNotEmpty(),
|
|
5340
5544
|
MaxLength(128),
|
|
5341
|
-
|
|
5545
|
+
_ts_metadata28("design:type", String)
|
|
5342
5546
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
5343
|
-
function
|
|
5547
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
5344
5548
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5345
5549
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5346
5550
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5347
5551
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5348
5552
|
}
|
|
5349
|
-
__name(
|
|
5350
|
-
function
|
|
5553
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
5554
|
+
function _ts_metadata29(k, v) {
|
|
5351
5555
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5352
5556
|
}
|
|
5353
|
-
__name(
|
|
5557
|
+
__name(_ts_metadata29, "_ts_metadata");
|
|
5354
5558
|
function _ts_param14(paramIndex, decorator) {
|
|
5355
5559
|
return function(target, key) {
|
|
5356
5560
|
decorator(target, key, paramIndex);
|
|
@@ -5707,7 +5911,7 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
5707
5911
|
return parsed;
|
|
5708
5912
|
}
|
|
5709
5913
|
};
|
|
5710
|
-
PasswordResetService =
|
|
5914
|
+
PasswordResetService = _ts_decorate29([
|
|
5711
5915
|
Injectable(),
|
|
5712
5916
|
_ts_param14(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
5713
5917
|
_ts_param14(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -5715,8 +5919,8 @@ PasswordResetService = _ts_decorate28([
|
|
|
5715
5919
|
_ts_param14(2, Optional()),
|
|
5716
5920
|
_ts_param14(3, Inject(BYMAX_AUTH_HOOKS)),
|
|
5717
5921
|
_ts_param14(3, Optional()),
|
|
5718
|
-
|
|
5719
|
-
|
|
5922
|
+
_ts_metadata29("design:type", Function),
|
|
5923
|
+
_ts_metadata29("design:paramtypes", [
|
|
5720
5924
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
5721
5925
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
5722
5926
|
Object,
|
|
@@ -5733,17 +5937,17 @@ function toSafeUser3(user) {
|
|
|
5733
5937
|
__name(toSafeUser3, "toSafeUser");
|
|
5734
5938
|
|
|
5735
5939
|
// src/server/controllers/password-reset.controller.ts
|
|
5736
|
-
function
|
|
5940
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
5737
5941
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5738
5942
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5739
5943
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5740
5944
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5741
5945
|
}
|
|
5742
|
-
__name(
|
|
5743
|
-
function
|
|
5946
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
5947
|
+
function _ts_metadata30(k, v) {
|
|
5744
5948
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5745
5949
|
}
|
|
5746
|
-
__name(
|
|
5950
|
+
__name(_ts_metadata30, "_ts_metadata");
|
|
5747
5951
|
function _ts_param15(paramIndex, decorator) {
|
|
5748
5952
|
return function(target, key) {
|
|
5749
5953
|
decorator(target, key, paramIndex);
|
|
@@ -5827,73 +6031,73 @@ var PasswordResetController = class {
|
|
|
5827
6031
|
await this.passwordResetService.resendOtp(dto);
|
|
5828
6032
|
}
|
|
5829
6033
|
};
|
|
5830
|
-
|
|
6034
|
+
_ts_decorate30([
|
|
5831
6035
|
Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
5832
6036
|
HttpCode(HttpStatus.OK),
|
|
5833
6037
|
Post("forgot-password"),
|
|
5834
6038
|
_ts_param15(0, Body()),
|
|
5835
|
-
|
|
5836
|
-
|
|
6039
|
+
_ts_metadata30("design:type", Function),
|
|
6040
|
+
_ts_metadata30("design:paramtypes", [
|
|
5837
6041
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto
|
|
5838
6042
|
]),
|
|
5839
|
-
|
|
6043
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5840
6044
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
5841
|
-
|
|
6045
|
+
_ts_decorate30([
|
|
5842
6046
|
Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
5843
6047
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
5844
6048
|
Post("reset-password"),
|
|
5845
6049
|
_ts_param15(0, Body()),
|
|
5846
|
-
|
|
5847
|
-
|
|
6050
|
+
_ts_metadata30("design:type", Function),
|
|
6051
|
+
_ts_metadata30("design:paramtypes", [
|
|
5848
6052
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto
|
|
5849
6053
|
]),
|
|
5850
|
-
|
|
6054
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5851
6055
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
5852
|
-
|
|
6056
|
+
_ts_decorate30([
|
|
5853
6057
|
Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
5854
6058
|
HttpCode(HttpStatus.OK),
|
|
5855
6059
|
Post("verify-otp"),
|
|
5856
6060
|
_ts_param15(0, Body()),
|
|
5857
|
-
|
|
5858
|
-
|
|
6061
|
+
_ts_metadata30("design:type", Function),
|
|
6062
|
+
_ts_metadata30("design:paramtypes", [
|
|
5859
6063
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto
|
|
5860
6064
|
]),
|
|
5861
|
-
|
|
6065
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5862
6066
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
5863
|
-
|
|
6067
|
+
_ts_decorate30([
|
|
5864
6068
|
Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
5865
6069
|
HttpCode(HttpStatus.OK),
|
|
5866
6070
|
Post("resend-otp"),
|
|
5867
6071
|
_ts_param15(0, Body()),
|
|
5868
|
-
|
|
5869
|
-
|
|
6072
|
+
_ts_metadata30("design:type", Function),
|
|
6073
|
+
_ts_metadata30("design:paramtypes", [
|
|
5870
6074
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto
|
|
5871
6075
|
]),
|
|
5872
|
-
|
|
6076
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5873
6077
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
5874
|
-
PasswordResetController =
|
|
6078
|
+
PasswordResetController = _ts_decorate30([
|
|
5875
6079
|
Public(),
|
|
5876
6080
|
Controller("password"),
|
|
5877
6081
|
UsePipes(new ValidationPipe({
|
|
5878
6082
|
whitelist: true,
|
|
5879
6083
|
forbidNonWhitelisted: true
|
|
5880
6084
|
})),
|
|
5881
|
-
|
|
5882
|
-
|
|
6085
|
+
_ts_metadata30("design:type", Function),
|
|
6086
|
+
_ts_metadata30("design:paramtypes", [
|
|
5883
6087
|
typeof PasswordResetService === "undefined" ? Object : PasswordResetService
|
|
5884
6088
|
])
|
|
5885
6089
|
], PasswordResetController);
|
|
5886
|
-
function
|
|
6090
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
5887
6091
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5888
6092
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5889
6093
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5890
6094
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5891
6095
|
}
|
|
5892
|
-
__name(
|
|
5893
|
-
function
|
|
6096
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
6097
|
+
function _ts_metadata31(k, v) {
|
|
5894
6098
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5895
6099
|
}
|
|
5896
|
-
__name(
|
|
6100
|
+
__name(_ts_metadata31, "_ts_metadata");
|
|
5897
6101
|
var PlatformLoginDto = class {
|
|
5898
6102
|
static {
|
|
5899
6103
|
__name(this, "PlatformLoginDto");
|
|
@@ -5915,14 +6119,14 @@ var PlatformLoginDto = class {
|
|
|
5915
6119
|
*/
|
|
5916
6120
|
password;
|
|
5917
6121
|
};
|
|
5918
|
-
|
|
6122
|
+
_ts_decorate31([
|
|
5919
6123
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5920
6124
|
IsEmail(),
|
|
5921
6125
|
IsNotEmpty(),
|
|
5922
6126
|
MaxLength(255),
|
|
5923
|
-
|
|
6127
|
+
_ts_metadata31("design:type", String)
|
|
5924
6128
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
5925
|
-
|
|
6129
|
+
_ts_decorate31([
|
|
5926
6130
|
IsString(),
|
|
5927
6131
|
IsNotEmpty(),
|
|
5928
6132
|
Matches(/\S/, {
|
|
@@ -5930,19 +6134,19 @@ _ts_decorate30([
|
|
|
5930
6134
|
}),
|
|
5931
6135
|
MinLength(12),
|
|
5932
6136
|
MaxLength(128),
|
|
5933
|
-
|
|
6137
|
+
_ts_metadata31("design:type", String)
|
|
5934
6138
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
5935
|
-
function
|
|
6139
|
+
function _ts_decorate32(decorators, target, key, desc) {
|
|
5936
6140
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5937
6141
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5938
6142
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5939
6143
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5940
6144
|
}
|
|
5941
|
-
__name(
|
|
5942
|
-
function
|
|
6145
|
+
__name(_ts_decorate32, "_ts_decorate");
|
|
6146
|
+
function _ts_metadata32(k, v) {
|
|
5943
6147
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5944
6148
|
}
|
|
5945
|
-
__name(
|
|
6149
|
+
__name(_ts_metadata32, "_ts_metadata");
|
|
5946
6150
|
function _ts_param16(paramIndex, decorator) {
|
|
5947
6151
|
return function(target, key) {
|
|
5948
6152
|
decorator(target, key, paramIndex);
|
|
@@ -5999,11 +6203,11 @@ var JwtPlatformGuard = class {
|
|
|
5999
6203
|
return true;
|
|
6000
6204
|
}
|
|
6001
6205
|
};
|
|
6002
|
-
JwtPlatformGuard =
|
|
6206
|
+
JwtPlatformGuard = _ts_decorate32([
|
|
6003
6207
|
Injectable(),
|
|
6004
6208
|
_ts_param16(4, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6005
|
-
|
|
6006
|
-
|
|
6209
|
+
_ts_metadata32("design:type", Function),
|
|
6210
|
+
_ts_metadata32("design:paramtypes", [
|
|
6007
6211
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
6008
6212
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
6009
6213
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -6011,17 +6215,17 @@ JwtPlatformGuard = _ts_decorate31([
|
|
|
6011
6215
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6012
6216
|
])
|
|
6013
6217
|
], JwtPlatformGuard);
|
|
6014
|
-
function
|
|
6218
|
+
function _ts_decorate33(decorators, target, key, desc) {
|
|
6015
6219
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6016
6220
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6017
6221
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6018
6222
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6019
6223
|
}
|
|
6020
|
-
__name(
|
|
6021
|
-
function
|
|
6224
|
+
__name(_ts_decorate33, "_ts_decorate");
|
|
6225
|
+
function _ts_metadata33(k, v) {
|
|
6022
6226
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6023
6227
|
}
|
|
6024
|
-
__name(
|
|
6228
|
+
__name(_ts_metadata33, "_ts_metadata");
|
|
6025
6229
|
function _ts_param17(paramIndex, decorator) {
|
|
6026
6230
|
return function(target, key) {
|
|
6027
6231
|
decorator(target, key, paramIndex);
|
|
@@ -6180,12 +6384,12 @@ var PlatformAuthService = class _PlatformAuthService {
|
|
|
6180
6384
|
await this.redis.invalidateUserSessions(userId);
|
|
6181
6385
|
}
|
|
6182
6386
|
};
|
|
6183
|
-
PlatformAuthService =
|
|
6387
|
+
PlatformAuthService = _ts_decorate33([
|
|
6184
6388
|
Injectable(),
|
|
6185
6389
|
_ts_param17(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
6186
6390
|
_ts_param17(5, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6187
|
-
|
|
6188
|
-
|
|
6391
|
+
_ts_metadata33("design:type", Function),
|
|
6392
|
+
_ts_metadata33("design:paramtypes", [
|
|
6189
6393
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
6190
6394
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
6191
6395
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -6196,17 +6400,17 @@ PlatformAuthService = _ts_decorate32([
|
|
|
6196
6400
|
], PlatformAuthService);
|
|
6197
6401
|
|
|
6198
6402
|
// src/server/controllers/platform-auth.controller.ts
|
|
6199
|
-
function
|
|
6403
|
+
function _ts_decorate34(decorators, target, key, desc) {
|
|
6200
6404
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6201
6405
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6202
6406
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6203
6407
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6204
6408
|
}
|
|
6205
|
-
__name(
|
|
6206
|
-
function
|
|
6409
|
+
__name(_ts_decorate34, "_ts_decorate");
|
|
6410
|
+
function _ts_metadata34(k, v) {
|
|
6207
6411
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6208
6412
|
}
|
|
6209
|
-
__name(
|
|
6413
|
+
__name(_ts_metadata34, "_ts_metadata");
|
|
6210
6414
|
function _ts_param18(paramIndex, decorator) {
|
|
6211
6415
|
return function(target, key) {
|
|
6212
6416
|
decorator(target, key, paramIndex);
|
|
@@ -6367,111 +6571,277 @@ var PlatformAuthController = class {
|
|
|
6367
6571
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
6368
6572
|
}
|
|
6369
6573
|
};
|
|
6370
|
-
|
|
6574
|
+
_ts_decorate34([
|
|
6371
6575
|
Public(),
|
|
6372
6576
|
Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
6373
6577
|
HttpCode(HttpStatus.OK),
|
|
6374
6578
|
Post("login"),
|
|
6375
6579
|
_ts_param18(0, Body()),
|
|
6376
6580
|
_ts_param18(1, Req()),
|
|
6377
|
-
|
|
6378
|
-
|
|
6581
|
+
_ts_metadata34("design:type", Function),
|
|
6582
|
+
_ts_metadata34("design:paramtypes", [
|
|
6379
6583
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
6380
6584
|
typeof Request === "undefined" ? Object : Request
|
|
6381
6585
|
]),
|
|
6382
|
-
|
|
6586
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6383
6587
|
], PlatformAuthController.prototype, "login", null);
|
|
6384
|
-
|
|
6588
|
+
_ts_decorate34([
|
|
6385
6589
|
Public(),
|
|
6386
6590
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
6387
6591
|
HttpCode(HttpStatus.OK),
|
|
6388
6592
|
Post("mfa/challenge"),
|
|
6389
6593
|
_ts_param18(0, Body()),
|
|
6390
6594
|
_ts_param18(1, Req()),
|
|
6391
|
-
|
|
6392
|
-
|
|
6595
|
+
_ts_metadata34("design:type", Function),
|
|
6596
|
+
_ts_metadata34("design:paramtypes", [
|
|
6393
6597
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
6394
6598
|
typeof Request === "undefined" ? Object : Request
|
|
6395
6599
|
]),
|
|
6396
|
-
|
|
6600
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6397
6601
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
6398
|
-
|
|
6602
|
+
_ts_decorate34([
|
|
6399
6603
|
UseGuards(JwtPlatformGuard),
|
|
6400
6604
|
Get("me"),
|
|
6401
6605
|
_ts_param18(0, CurrentUser()),
|
|
6402
|
-
|
|
6403
|
-
|
|
6606
|
+
_ts_metadata34("design:type", Function),
|
|
6607
|
+
_ts_metadata34("design:paramtypes", [
|
|
6404
6608
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6405
6609
|
]),
|
|
6406
|
-
|
|
6610
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6407
6611
|
], PlatformAuthController.prototype, "me", null);
|
|
6408
|
-
|
|
6612
|
+
_ts_decorate34([
|
|
6409
6613
|
UseGuards(JwtPlatformGuard),
|
|
6410
6614
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6411
6615
|
Post("logout"),
|
|
6412
6616
|
_ts_param18(0, CurrentUser()),
|
|
6413
6617
|
_ts_param18(1, Req()),
|
|
6414
|
-
|
|
6415
|
-
|
|
6618
|
+
_ts_metadata34("design:type", Function),
|
|
6619
|
+
_ts_metadata34("design:paramtypes", [
|
|
6416
6620
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6417
6621
|
typeof Request === "undefined" ? Object : Request
|
|
6418
6622
|
]),
|
|
6419
|
-
|
|
6623
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6420
6624
|
], PlatformAuthController.prototype, "logout", null);
|
|
6421
|
-
|
|
6625
|
+
_ts_decorate34([
|
|
6422
6626
|
Public(),
|
|
6423
6627
|
Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6424
6628
|
HttpCode(HttpStatus.OK),
|
|
6425
6629
|
Post("refresh"),
|
|
6426
6630
|
_ts_param18(0, Req()),
|
|
6427
|
-
|
|
6428
|
-
|
|
6631
|
+
_ts_metadata34("design:type", Function),
|
|
6632
|
+
_ts_metadata34("design:paramtypes", [
|
|
6429
6633
|
typeof Request === "undefined" ? Object : Request
|
|
6430
6634
|
]),
|
|
6431
|
-
|
|
6635
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6432
6636
|
], PlatformAuthController.prototype, "refresh", null);
|
|
6433
|
-
|
|
6637
|
+
_ts_decorate34([
|
|
6434
6638
|
UseGuards(JwtPlatformGuard),
|
|
6435
6639
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
6436
6640
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6437
6641
|
Delete("sessions"),
|
|
6438
6642
|
_ts_param18(0, CurrentUser()),
|
|
6439
|
-
|
|
6440
|
-
|
|
6643
|
+
_ts_metadata34("design:type", Function),
|
|
6644
|
+
_ts_metadata34("design:paramtypes", [
|
|
6441
6645
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6442
6646
|
]),
|
|
6443
|
-
|
|
6647
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6444
6648
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
6445
|
-
PlatformAuthController =
|
|
6649
|
+
PlatformAuthController = _ts_decorate34([
|
|
6446
6650
|
Controller("platform"),
|
|
6447
6651
|
UsePipes(new ValidationPipe({
|
|
6448
6652
|
whitelist: true,
|
|
6449
6653
|
forbidNonWhitelisted: true
|
|
6450
6654
|
})),
|
|
6451
|
-
|
|
6452
|
-
|
|
6655
|
+
_ts_metadata34("design:type", Function),
|
|
6656
|
+
_ts_metadata34("design:paramtypes", [
|
|
6453
6657
|
typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
|
|
6454
6658
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
6455
6659
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
6456
6660
|
])
|
|
6457
6661
|
], PlatformAuthController);
|
|
6458
|
-
function
|
|
6662
|
+
function _ts_decorate35(decorators, target, key, desc) {
|
|
6459
6663
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6460
6664
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6461
6665
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6462
6666
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6463
6667
|
}
|
|
6464
|
-
__name(
|
|
6465
|
-
function
|
|
6668
|
+
__name(_ts_decorate35, "_ts_decorate");
|
|
6669
|
+
function _ts_metadata35(k, v) {
|
|
6466
6670
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6467
6671
|
}
|
|
6468
|
-
__name(
|
|
6672
|
+
__name(_ts_metadata35, "_ts_metadata");
|
|
6469
6673
|
function _ts_param19(paramIndex, decorator) {
|
|
6470
6674
|
return function(target, key) {
|
|
6471
6675
|
decorator(target, key, paramIndex);
|
|
6472
6676
|
};
|
|
6473
6677
|
}
|
|
6474
6678
|
__name(_ts_param19, "_ts_param");
|
|
6679
|
+
var PlatformMfaController = class {
|
|
6680
|
+
static {
|
|
6681
|
+
__name(this, "PlatformMfaController");
|
|
6682
|
+
}
|
|
6683
|
+
mfaService;
|
|
6684
|
+
constructor(mfaService) {
|
|
6685
|
+
this.mfaService = mfaService;
|
|
6686
|
+
}
|
|
6687
|
+
/**
|
|
6688
|
+
* Initiates the MFA setup flow for the authenticated platform administrator.
|
|
6689
|
+
*
|
|
6690
|
+
* Returns a TOTP secret, QR code URI, and plain-text recovery codes (shown once).
|
|
6691
|
+
* Idempotent within the 10-minute setup window — repeated calls return the
|
|
6692
|
+
* same payload until the user completes or abandons the flow.
|
|
6693
|
+
*
|
|
6694
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6695
|
+
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
6696
|
+
*/
|
|
6697
|
+
async setup(user) {
|
|
6698
|
+
return this.mfaService.setup(user.sub, "platform");
|
|
6699
|
+
}
|
|
6700
|
+
/**
|
|
6701
|
+
* Verifies the first TOTP code and permanently enables MFA on the platform
|
|
6702
|
+
* admin's account.
|
|
6703
|
+
*
|
|
6704
|
+
* After a successful call, all existing refresh sessions are invalidated so
|
|
6705
|
+
* the admin must re-authenticate through the MFA challenge endpoint.
|
|
6706
|
+
*
|
|
6707
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6708
|
+
* @param dto - Contains the 6-digit TOTP code from the authenticator app.
|
|
6709
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
6710
|
+
* @throws `MFA_SETUP_REQUIRED` if no pending setup data is found in Redis.
|
|
6711
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is invalid.
|
|
6712
|
+
*/
|
|
6713
|
+
async verifyEnable(user, dto, req) {
|
|
6714
|
+
const ip = req.ip ?? "";
|
|
6715
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
6716
|
+
await this.mfaService.verifyAndEnable(user.sub, dto.code, ip, userAgent, "platform");
|
|
6717
|
+
}
|
|
6718
|
+
/**
|
|
6719
|
+
* Disables MFA on the authenticated platform admin's account.
|
|
6720
|
+
*
|
|
6721
|
+
* Requires a valid TOTP code (recovery codes are not accepted by design).
|
|
6722
|
+
* All existing refresh sessions are invalidated after disabling.
|
|
6723
|
+
*
|
|
6724
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6725
|
+
* @param dto - Contains the 6-digit TOTP code confirming the action.
|
|
6726
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
6727
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active on the account.
|
|
6728
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
6729
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
6730
|
+
*/
|
|
6731
|
+
async disable(user, dto, req) {
|
|
6732
|
+
const ip = req.ip ?? "";
|
|
6733
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
6734
|
+
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, "platform");
|
|
6735
|
+
}
|
|
6736
|
+
/**
|
|
6737
|
+
* Regenerates the platform admin's MFA recovery codes.
|
|
6738
|
+
*
|
|
6739
|
+
* Requires a valid TOTP code (recovery codes are not accepted by design).
|
|
6740
|
+
* Returns the fresh plain-text codes once — only their scrypt hashes are
|
|
6741
|
+
* persisted.
|
|
6742
|
+
*
|
|
6743
|
+
* @param user - JWT payload of the authenticated platform admin.
|
|
6744
|
+
* @param dto - Contains the 6-digit TOTP code confirming the action.
|
|
6745
|
+
* @param req - Incoming request (provides IP and User-Agent for hooks).
|
|
6746
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active on the account.
|
|
6747
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
6748
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
6749
|
+
* @returns The fresh plain-text recovery codes, one-time display.
|
|
6750
|
+
*/
|
|
6751
|
+
async regenerateRecoveryCodes(user, dto, req) {
|
|
6752
|
+
const ip = req.ip ?? "";
|
|
6753
|
+
const userAgent = String(req.headers["user-agent"] ?? "");
|
|
6754
|
+
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
6755
|
+
}
|
|
6756
|
+
};
|
|
6757
|
+
_ts_decorate35([
|
|
6758
|
+
UseGuards(JwtPlatformGuard),
|
|
6759
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
6760
|
+
Post("setup"),
|
|
6761
|
+
_ts_param19(0, CurrentUser()),
|
|
6762
|
+
_ts_metadata35("design:type", Function),
|
|
6763
|
+
_ts_metadata35("design:paramtypes", [
|
|
6764
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6765
|
+
]),
|
|
6766
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6767
|
+
], PlatformMfaController.prototype, "setup", null);
|
|
6768
|
+
_ts_decorate35([
|
|
6769
|
+
UseGuards(JwtPlatformGuard),
|
|
6770
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
6771
|
+
HttpCode(HttpStatus.NO_CONTENT),
|
|
6772
|
+
Post("verify-enable"),
|
|
6773
|
+
_ts_param19(0, CurrentUser()),
|
|
6774
|
+
_ts_param19(1, Body()),
|
|
6775
|
+
_ts_param19(2, Req()),
|
|
6776
|
+
_ts_metadata35("design:type", Function),
|
|
6777
|
+
_ts_metadata35("design:paramtypes", [
|
|
6778
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6779
|
+
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
6780
|
+
typeof Request === "undefined" ? Object : Request
|
|
6781
|
+
]),
|
|
6782
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6783
|
+
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
6784
|
+
_ts_decorate35([
|
|
6785
|
+
UseGuards(JwtPlatformGuard),
|
|
6786
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
6787
|
+
HttpCode(HttpStatus.NO_CONTENT),
|
|
6788
|
+
Post("disable"),
|
|
6789
|
+
_ts_param19(0, CurrentUser()),
|
|
6790
|
+
_ts_param19(1, Body()),
|
|
6791
|
+
_ts_param19(2, Req()),
|
|
6792
|
+
_ts_metadata35("design:type", Function),
|
|
6793
|
+
_ts_metadata35("design:paramtypes", [
|
|
6794
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6795
|
+
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
6796
|
+
typeof Request === "undefined" ? Object : Request
|
|
6797
|
+
]),
|
|
6798
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6799
|
+
], PlatformMfaController.prototype, "disable", null);
|
|
6800
|
+
_ts_decorate35([
|
|
6801
|
+
UseGuards(JwtPlatformGuard),
|
|
6802
|
+
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
6803
|
+
HttpCode(HttpStatus.OK),
|
|
6804
|
+
Post("recovery-codes"),
|
|
6805
|
+
_ts_param19(0, CurrentUser()),
|
|
6806
|
+
_ts_param19(1, Body()),
|
|
6807
|
+
_ts_param19(2, Req()),
|
|
6808
|
+
_ts_metadata35("design:type", Function),
|
|
6809
|
+
_ts_metadata35("design:paramtypes", [
|
|
6810
|
+
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6811
|
+
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
6812
|
+
typeof Request === "undefined" ? Object : Request
|
|
6813
|
+
]),
|
|
6814
|
+
_ts_metadata35("design:returntype", Promise)
|
|
6815
|
+
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
6816
|
+
PlatformMfaController = _ts_decorate35([
|
|
6817
|
+
Controller("platform/mfa"),
|
|
6818
|
+
UsePipes(new ValidationPipe({
|
|
6819
|
+
whitelist: true,
|
|
6820
|
+
forbidNonWhitelisted: true,
|
|
6821
|
+
forbidUnknownValues: true
|
|
6822
|
+
})),
|
|
6823
|
+
_ts_metadata35("design:type", Function),
|
|
6824
|
+
_ts_metadata35("design:paramtypes", [
|
|
6825
|
+
typeof MfaService === "undefined" ? Object : MfaService
|
|
6826
|
+
])
|
|
6827
|
+
], PlatformMfaController);
|
|
6828
|
+
function _ts_decorate36(decorators, target, key, desc) {
|
|
6829
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6830
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6831
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6832
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6833
|
+
}
|
|
6834
|
+
__name(_ts_decorate36, "_ts_decorate");
|
|
6835
|
+
function _ts_metadata36(k, v) {
|
|
6836
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6837
|
+
}
|
|
6838
|
+
__name(_ts_metadata36, "_ts_metadata");
|
|
6839
|
+
function _ts_param20(paramIndex, decorator) {
|
|
6840
|
+
return function(target, key) {
|
|
6841
|
+
decorator(target, key, paramIndex);
|
|
6842
|
+
};
|
|
6843
|
+
}
|
|
6844
|
+
__name(_ts_param20, "_ts_param");
|
|
6475
6845
|
var STATUS_ERROR_MAP = {
|
|
6476
6846
|
banned: AUTH_ERROR_CODES.ACCOUNT_BANNED,
|
|
6477
6847
|
inactive: AUTH_ERROR_CODES.ACCOUNT_INACTIVE,
|
|
@@ -6519,12 +6889,12 @@ var UserStatusGuard = class {
|
|
|
6519
6889
|
return true;
|
|
6520
6890
|
}
|
|
6521
6891
|
};
|
|
6522
|
-
UserStatusGuard =
|
|
6892
|
+
UserStatusGuard = _ts_decorate36([
|
|
6523
6893
|
Injectable(),
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6894
|
+
_ts_param20(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
6895
|
+
_ts_param20(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6896
|
+
_ts_metadata36("design:type", Function),
|
|
6897
|
+
_ts_metadata36("design:paramtypes", [
|
|
6528
6898
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
6529
6899
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6530
6900
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -6532,23 +6902,23 @@ UserStatusGuard = _ts_decorate34([
|
|
|
6532
6902
|
], UserStatusGuard);
|
|
6533
6903
|
|
|
6534
6904
|
// src/server/controllers/session.controller.ts
|
|
6535
|
-
function
|
|
6905
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
6536
6906
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6537
6907
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6538
6908
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6539
6909
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6540
6910
|
}
|
|
6541
|
-
__name(
|
|
6542
|
-
function
|
|
6911
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
6912
|
+
function _ts_metadata37(k, v) {
|
|
6543
6913
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6544
6914
|
}
|
|
6545
|
-
__name(
|
|
6546
|
-
function
|
|
6915
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
6916
|
+
function _ts_param21(paramIndex, decorator) {
|
|
6547
6917
|
return function(target, key) {
|
|
6548
6918
|
decorator(target, key, paramIndex);
|
|
6549
6919
|
};
|
|
6550
6920
|
}
|
|
6551
|
-
__name(
|
|
6921
|
+
__name(_ts_param21, "_ts_param");
|
|
6552
6922
|
var SessionController = class {
|
|
6553
6923
|
static {
|
|
6554
6924
|
__name(this, "SessionController");
|
|
@@ -6625,68 +6995,68 @@ var SessionController = class {
|
|
|
6625
6995
|
await this.sessionService.revokeSession(user.sub, id);
|
|
6626
6996
|
}
|
|
6627
6997
|
};
|
|
6628
|
-
|
|
6998
|
+
_ts_decorate37([
|
|
6629
6999
|
Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
6630
7000
|
Get(),
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
7001
|
+
_ts_param21(0, CurrentUser()),
|
|
7002
|
+
_ts_param21(1, Req()),
|
|
7003
|
+
_ts_metadata37("design:type", Function),
|
|
7004
|
+
_ts_metadata37("design:paramtypes", [
|
|
6635
7005
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6636
7006
|
typeof Request === "undefined" ? Object : Request
|
|
6637
7007
|
]),
|
|
6638
|
-
|
|
7008
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6639
7009
|
], SessionController.prototype, "listSessions", null);
|
|
6640
|
-
|
|
7010
|
+
_ts_decorate37([
|
|
6641
7011
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
6642
7012
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6643
7013
|
Delete("all"),
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
7014
|
+
_ts_param21(0, CurrentUser()),
|
|
7015
|
+
_ts_param21(1, Req()),
|
|
7016
|
+
_ts_metadata37("design:type", Function),
|
|
7017
|
+
_ts_metadata37("design:paramtypes", [
|
|
6648
7018
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6649
7019
|
typeof Request === "undefined" ? Object : Request
|
|
6650
7020
|
]),
|
|
6651
|
-
|
|
7021
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6652
7022
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
6653
|
-
|
|
7023
|
+
_ts_decorate37([
|
|
6654
7024
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
6655
7025
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
6656
7026
|
Delete(":id"),
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
7027
|
+
_ts_param21(0, CurrentUser()),
|
|
7028
|
+
_ts_param21(1, Param("id")),
|
|
7029
|
+
_ts_metadata37("design:type", Function),
|
|
7030
|
+
_ts_metadata37("design:paramtypes", [
|
|
6661
7031
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6662
7032
|
String
|
|
6663
7033
|
]),
|
|
6664
|
-
|
|
7034
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6665
7035
|
], SessionController.prototype, "revokeSession", null);
|
|
6666
|
-
SessionController =
|
|
7036
|
+
SessionController = _ts_decorate37([
|
|
6667
7037
|
Controller("sessions"),
|
|
6668
7038
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
6669
7039
|
UsePipes(new ValidationPipe({
|
|
6670
7040
|
whitelist: true,
|
|
6671
7041
|
forbidNonWhitelisted: true
|
|
6672
7042
|
})),
|
|
6673
|
-
|
|
6674
|
-
|
|
7043
|
+
_ts_metadata37("design:type", Function),
|
|
7044
|
+
_ts_metadata37("design:paramtypes", [
|
|
6675
7045
|
typeof SessionService === "undefined" ? Object : SessionService,
|
|
6676
7046
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
6677
7047
|
])
|
|
6678
7048
|
], SessionController);
|
|
6679
|
-
function
|
|
7049
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
6680
7050
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6681
7051
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6682
7052
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6683
7053
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6684
7054
|
}
|
|
6685
|
-
__name(
|
|
6686
|
-
function
|
|
7055
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
7056
|
+
function _ts_metadata38(k, v) {
|
|
6687
7057
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6688
7058
|
}
|
|
6689
|
-
__name(
|
|
7059
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
6690
7060
|
var MfaRequiredGuard = class {
|
|
6691
7061
|
static {
|
|
6692
7062
|
__name(this, "MfaRequiredGuard");
|
|
@@ -6713,10 +7083,10 @@ var MfaRequiredGuard = class {
|
|
|
6713
7083
|
return true;
|
|
6714
7084
|
}
|
|
6715
7085
|
};
|
|
6716
|
-
MfaRequiredGuard =
|
|
7086
|
+
MfaRequiredGuard = _ts_decorate38([
|
|
6717
7087
|
Injectable(),
|
|
6718
|
-
|
|
6719
|
-
|
|
7088
|
+
_ts_metadata38("design:type", Function),
|
|
7089
|
+
_ts_metadata38("design:paramtypes", [
|
|
6720
7090
|
typeof Reflector === "undefined" ? Object : Reflector
|
|
6721
7091
|
])
|
|
6722
7092
|
], MfaRequiredGuard);
|
|
@@ -6724,23 +7094,23 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
6724
7094
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
6725
7095
|
|
|
6726
7096
|
// src/server/guards/platform-roles.guard.ts
|
|
6727
|
-
function
|
|
7097
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
6728
7098
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6729
7099
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6730
7100
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6731
7101
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6732
7102
|
}
|
|
6733
|
-
__name(
|
|
6734
|
-
function
|
|
7103
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
7104
|
+
function _ts_metadata39(k, v) {
|
|
6735
7105
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6736
7106
|
}
|
|
6737
|
-
__name(
|
|
6738
|
-
function
|
|
7107
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
7108
|
+
function _ts_param22(paramIndex, decorator) {
|
|
6739
7109
|
return function(target, key) {
|
|
6740
7110
|
decorator(target, key, paramIndex);
|
|
6741
7111
|
};
|
|
6742
7112
|
}
|
|
6743
|
-
__name(
|
|
7113
|
+
__name(_ts_param22, "_ts_param");
|
|
6744
7114
|
var PlatformRolesGuard = class {
|
|
6745
7115
|
static {
|
|
6746
7116
|
__name(this, "PlatformRolesGuard");
|
|
@@ -6774,11 +7144,11 @@ var PlatformRolesGuard = class {
|
|
|
6774
7144
|
return true;
|
|
6775
7145
|
}
|
|
6776
7146
|
};
|
|
6777
|
-
PlatformRolesGuard =
|
|
7147
|
+
PlatformRolesGuard = _ts_decorate39([
|
|
6778
7148
|
Injectable(),
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
7149
|
+
_ts_param22(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7150
|
+
_ts_metadata39("design:type", Function),
|
|
7151
|
+
_ts_metadata39("design:paramtypes", [
|
|
6782
7152
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
6783
7153
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6784
7154
|
])
|
|
@@ -6787,23 +7157,23 @@ var ROLES_KEY = "roles";
|
|
|
6787
7157
|
var Roles = /* @__PURE__ */ __name((...roles) => SetMetadata(ROLES_KEY, roles), "Roles");
|
|
6788
7158
|
|
|
6789
7159
|
// src/server/guards/roles.guard.ts
|
|
6790
|
-
function
|
|
7160
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
6791
7161
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6792
7162
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6793
7163
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6794
7164
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6795
7165
|
}
|
|
6796
|
-
__name(
|
|
6797
|
-
function
|
|
7166
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
7167
|
+
function _ts_metadata40(k, v) {
|
|
6798
7168
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6799
7169
|
}
|
|
6800
|
-
__name(
|
|
6801
|
-
function
|
|
7170
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
7171
|
+
function _ts_param23(paramIndex, decorator) {
|
|
6802
7172
|
return function(target, key) {
|
|
6803
7173
|
decorator(target, key, paramIndex);
|
|
6804
7174
|
};
|
|
6805
7175
|
}
|
|
6806
|
-
__name(
|
|
7176
|
+
__name(_ts_param23, "_ts_param");
|
|
6807
7177
|
var RolesGuard = class {
|
|
6808
7178
|
static {
|
|
6809
7179
|
__name(this, "RolesGuard");
|
|
@@ -6833,22 +7203,22 @@ var RolesGuard = class {
|
|
|
6833
7203
|
return true;
|
|
6834
7204
|
}
|
|
6835
7205
|
};
|
|
6836
|
-
RolesGuard =
|
|
7206
|
+
RolesGuard = _ts_decorate40([
|
|
6837
7207
|
Injectable(),
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
7208
|
+
_ts_param23(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7209
|
+
_ts_metadata40("design:type", Function),
|
|
7210
|
+
_ts_metadata40("design:paramtypes", [
|
|
6841
7211
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
6842
7212
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6843
7213
|
])
|
|
6844
7214
|
], RolesGuard);
|
|
6845
|
-
function
|
|
7215
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
6846
7216
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6847
7217
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6848
7218
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6849
7219
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6850
7220
|
}
|
|
6851
|
-
__name(
|
|
7221
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
6852
7222
|
var NoOpAuthHooks = class {
|
|
6853
7223
|
static {
|
|
6854
7224
|
__name(this, "NoOpAuthHooks");
|
|
@@ -6888,29 +7258,29 @@ var NoOpAuthHooks = class {
|
|
|
6888
7258
|
};
|
|
6889
7259
|
}
|
|
6890
7260
|
};
|
|
6891
|
-
NoOpAuthHooks =
|
|
7261
|
+
NoOpAuthHooks = _ts_decorate41([
|
|
6892
7262
|
Injectable()
|
|
6893
7263
|
], NoOpAuthHooks);
|
|
6894
7264
|
|
|
6895
7265
|
// src/server/oauth/oauth.constants.ts
|
|
6896
7266
|
var OAUTH_PLUGINS = /* @__PURE__ */ Symbol("OAUTH_PLUGINS");
|
|
6897
|
-
function
|
|
7267
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
6898
7268
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6899
7269
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6900
7270
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6901
7271
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6902
7272
|
}
|
|
6903
|
-
__name(
|
|
6904
|
-
function
|
|
7273
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
7274
|
+
function _ts_metadata41(k, v) {
|
|
6905
7275
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6906
7276
|
}
|
|
6907
|
-
__name(
|
|
6908
|
-
function
|
|
7277
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
7278
|
+
function _ts_param24(paramIndex, decorator) {
|
|
6909
7279
|
return function(target, key) {
|
|
6910
7280
|
decorator(target, key, paramIndex);
|
|
6911
7281
|
};
|
|
6912
7282
|
}
|
|
6913
|
-
__name(
|
|
7283
|
+
__name(_ts_param24, "_ts_param");
|
|
6914
7284
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
6915
7285
|
function isStoredOAuthState(value) {
|
|
6916
7286
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -7120,15 +7490,15 @@ var OAuthService = class _OAuthService {
|
|
|
7120
7490
|
return plugin;
|
|
7121
7491
|
}
|
|
7122
7492
|
};
|
|
7123
|
-
OAuthService =
|
|
7493
|
+
OAuthService = _ts_decorate42([
|
|
7124
7494
|
Injectable(),
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7495
|
+
_ts_param24(0, Inject(OAUTH_PLUGINS)),
|
|
7496
|
+
_ts_param24(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
7497
|
+
_ts_param24(2, Inject(BYMAX_AUTH_HOOKS)),
|
|
7498
|
+
_ts_param24(2, Optional()),
|
|
7499
|
+
_ts_param24(6, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7500
|
+
_ts_metadata41("design:type", Function),
|
|
7501
|
+
_ts_metadata41("design:paramtypes", [
|
|
7132
7502
|
Array,
|
|
7133
7503
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
7134
7504
|
Object,
|
|
@@ -7138,17 +7508,17 @@ OAuthService = _ts_decorate40([
|
|
|
7138
7508
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
7139
7509
|
])
|
|
7140
7510
|
], OAuthService);
|
|
7141
|
-
function
|
|
7511
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
7142
7512
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7143
7513
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7144
7514
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7145
7515
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7146
7516
|
}
|
|
7147
|
-
__name(
|
|
7148
|
-
function
|
|
7517
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
7518
|
+
function _ts_metadata42(k, v) {
|
|
7149
7519
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7150
7520
|
}
|
|
7151
|
-
__name(
|
|
7521
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
7152
7522
|
var OAuthCallbackQueryDto = class {
|
|
7153
7523
|
static {
|
|
7154
7524
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -7202,59 +7572,59 @@ var OAuthCallbackQueryDto = class {
|
|
|
7202
7572
|
*/
|
|
7203
7573
|
hd;
|
|
7204
7574
|
};
|
|
7205
|
-
|
|
7575
|
+
_ts_decorate43([
|
|
7206
7576
|
IsString(),
|
|
7207
7577
|
IsNotEmpty(),
|
|
7208
7578
|
MaxLength(2048),
|
|
7209
|
-
|
|
7579
|
+
_ts_metadata42("design:type", String)
|
|
7210
7580
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
7211
|
-
|
|
7581
|
+
_ts_decorate43([
|
|
7212
7582
|
IsString(),
|
|
7213
7583
|
IsNotEmpty(),
|
|
7214
7584
|
MaxLength(128),
|
|
7215
|
-
|
|
7585
|
+
_ts_metadata42("design:type", String)
|
|
7216
7586
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
7217
|
-
|
|
7587
|
+
_ts_decorate43([
|
|
7218
7588
|
IsOptional(),
|
|
7219
7589
|
IsString(),
|
|
7220
7590
|
MaxLength(512),
|
|
7221
|
-
|
|
7591
|
+
_ts_metadata42("design:type", String)
|
|
7222
7592
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
7223
|
-
|
|
7593
|
+
_ts_decorate43([
|
|
7224
7594
|
IsOptional(),
|
|
7225
7595
|
IsString(),
|
|
7226
7596
|
MaxLength(2048),
|
|
7227
|
-
|
|
7597
|
+
_ts_metadata42("design:type", String)
|
|
7228
7598
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
7229
|
-
|
|
7599
|
+
_ts_decorate43([
|
|
7230
7600
|
IsOptional(),
|
|
7231
7601
|
IsString(),
|
|
7232
7602
|
MaxLength(16),
|
|
7233
|
-
|
|
7603
|
+
_ts_metadata42("design:type", String)
|
|
7234
7604
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
7235
|
-
|
|
7605
|
+
_ts_decorate43([
|
|
7236
7606
|
IsOptional(),
|
|
7237
7607
|
IsString(),
|
|
7238
7608
|
MaxLength(64),
|
|
7239
|
-
|
|
7609
|
+
_ts_metadata42("design:type", String)
|
|
7240
7610
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
7241
|
-
|
|
7611
|
+
_ts_decorate43([
|
|
7242
7612
|
IsOptional(),
|
|
7243
7613
|
IsString(),
|
|
7244
7614
|
MaxLength(253),
|
|
7245
|
-
|
|
7615
|
+
_ts_metadata42("design:type", String)
|
|
7246
7616
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
7247
|
-
function
|
|
7617
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
7248
7618
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7249
7619
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7250
7620
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7251
7621
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7252
7622
|
}
|
|
7253
|
-
__name(
|
|
7254
|
-
function
|
|
7623
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
7624
|
+
function _ts_metadata43(k, v) {
|
|
7255
7625
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7256
7626
|
}
|
|
7257
|
-
__name(
|
|
7627
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
7258
7628
|
var OAuthInitiateQueryDto = class {
|
|
7259
7629
|
static {
|
|
7260
7630
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -7271,31 +7641,31 @@ var OAuthInitiateQueryDto = class {
|
|
|
7271
7641
|
*/
|
|
7272
7642
|
tenantId;
|
|
7273
7643
|
};
|
|
7274
|
-
|
|
7644
|
+
_ts_decorate44([
|
|
7275
7645
|
IsString(),
|
|
7276
7646
|
IsNotEmpty(),
|
|
7277
7647
|
MaxLength(128),
|
|
7278
|
-
|
|
7648
|
+
_ts_metadata43("design:type", String)
|
|
7279
7649
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
7280
7650
|
|
|
7281
7651
|
// src/server/oauth/oauth.controller.ts
|
|
7282
|
-
function
|
|
7652
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
7283
7653
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7284
7654
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7285
7655
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7286
7656
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7287
7657
|
}
|
|
7288
|
-
__name(
|
|
7289
|
-
function
|
|
7658
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
7659
|
+
function _ts_metadata44(k, v) {
|
|
7290
7660
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7291
7661
|
}
|
|
7292
|
-
__name(
|
|
7293
|
-
function
|
|
7662
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
7663
|
+
function _ts_param25(paramIndex, decorator) {
|
|
7294
7664
|
return function(target, key) {
|
|
7295
7665
|
decorator(target, key, paramIndex);
|
|
7296
7666
|
};
|
|
7297
7667
|
}
|
|
7298
|
-
__name(
|
|
7668
|
+
__name(_ts_param25, "_ts_param");
|
|
7299
7669
|
var OAuthController = class {
|
|
7300
7670
|
static {
|
|
7301
7671
|
__name(this, "OAuthController");
|
|
@@ -7366,42 +7736,42 @@ var OAuthController = class {
|
|
|
7366
7736
|
return body;
|
|
7367
7737
|
}
|
|
7368
7738
|
};
|
|
7369
|
-
|
|
7739
|
+
_ts_decorate45([
|
|
7370
7740
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
7371
7741
|
Get(":provider"),
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7742
|
+
_ts_param25(0, Param("provider")),
|
|
7743
|
+
_ts_param25(1, Query()),
|
|
7744
|
+
_ts_param25(2, Res({
|
|
7375
7745
|
passthrough: true
|
|
7376
7746
|
})),
|
|
7377
|
-
|
|
7378
|
-
|
|
7747
|
+
_ts_metadata44("design:type", Function),
|
|
7748
|
+
_ts_metadata44("design:paramtypes", [
|
|
7379
7749
|
String,
|
|
7380
7750
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
7381
7751
|
typeof Response === "undefined" ? Object : Response
|
|
7382
7752
|
]),
|
|
7383
|
-
|
|
7753
|
+
_ts_metadata44("design:returntype", Promise)
|
|
7384
7754
|
], OAuthController.prototype, "initiate", null);
|
|
7385
|
-
|
|
7755
|
+
_ts_decorate45([
|
|
7386
7756
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
7387
7757
|
HttpCode(HttpStatus.OK),
|
|
7388
7758
|
Get(":provider/callback"),
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7759
|
+
_ts_param25(0, Param("provider")),
|
|
7760
|
+
_ts_param25(1, Query()),
|
|
7761
|
+
_ts_param25(2, Req()),
|
|
7762
|
+
_ts_param25(3, Res({
|
|
7393
7763
|
passthrough: true
|
|
7394
7764
|
})),
|
|
7395
|
-
|
|
7396
|
-
|
|
7765
|
+
_ts_metadata44("design:type", Function),
|
|
7766
|
+
_ts_metadata44("design:paramtypes", [
|
|
7397
7767
|
String,
|
|
7398
7768
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
7399
7769
|
typeof Request === "undefined" ? Object : Request,
|
|
7400
7770
|
typeof Response === "undefined" ? Object : Response
|
|
7401
7771
|
]),
|
|
7402
|
-
|
|
7772
|
+
_ts_metadata44("design:returntype", Promise)
|
|
7403
7773
|
], OAuthController.prototype, "callback", null);
|
|
7404
|
-
OAuthController =
|
|
7774
|
+
OAuthController = _ts_decorate45([
|
|
7405
7775
|
Public(),
|
|
7406
7776
|
SkipMfa(),
|
|
7407
7777
|
Controller("oauth"),
|
|
@@ -7410,9 +7780,9 @@ OAuthController = _ts_decorate43([
|
|
|
7410
7780
|
forbidNonWhitelisted: true,
|
|
7411
7781
|
forbidUnknownValues: true
|
|
7412
7782
|
})),
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7783
|
+
_ts_param25(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7784
|
+
_ts_metadata44("design:type", Function),
|
|
7785
|
+
_ts_metadata44("design:paramtypes", [
|
|
7416
7786
|
typeof OAuthService === "undefined" ? Object : OAuthService,
|
|
7417
7787
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
7418
7788
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -7548,13 +7918,13 @@ var GoogleOAuthPlugin = class {
|
|
|
7548
7918
|
};
|
|
7549
7919
|
|
|
7550
7920
|
// src/server/oauth/oauth.module.ts
|
|
7551
|
-
function
|
|
7921
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
7552
7922
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7553
7923
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7554
7924
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7555
7925
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7556
7926
|
}
|
|
7557
|
-
__name(
|
|
7927
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
7558
7928
|
function buildOAuthPlugins(options) {
|
|
7559
7929
|
const plugins = [];
|
|
7560
7930
|
if (options.oauth?.google) {
|
|
@@ -7624,16 +7994,16 @@ var OAuthModule = class _OAuthModule {
|
|
|
7624
7994
|
};
|
|
7625
7995
|
}
|
|
7626
7996
|
};
|
|
7627
|
-
OAuthModule =
|
|
7997
|
+
OAuthModule = _ts_decorate46([
|
|
7628
7998
|
Module({})
|
|
7629
7999
|
], OAuthModule);
|
|
7630
|
-
function
|
|
8000
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
7631
8001
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7632
8002
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7633
8003
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7634
8004
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7635
8005
|
}
|
|
7636
|
-
__name(
|
|
8006
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
7637
8007
|
var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
7638
8008
|
static {
|
|
7639
8009
|
__name(this, "NoOpEmailProvider");
|
|
@@ -7668,18 +8038,18 @@ var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
7668
8038
|
this.logger.log(`sendInvitation \u2192 ${email} (no-op)`);
|
|
7669
8039
|
}
|
|
7670
8040
|
};
|
|
7671
|
-
NoOpEmailProvider =
|
|
8041
|
+
NoOpEmailProvider = _ts_decorate47([
|
|
7672
8042
|
Injectable()
|
|
7673
8043
|
], NoOpEmailProvider);
|
|
7674
8044
|
|
|
7675
8045
|
// src/server/bymax-auth.module.ts
|
|
7676
|
-
function
|
|
8046
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
7677
8047
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7678
8048
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7679
8049
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7680
8050
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7681
8051
|
}
|
|
7682
|
-
__name(
|
|
8052
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
7683
8053
|
function hasProviderToken(providers, token) {
|
|
7684
8054
|
return providers.some((p) => {
|
|
7685
8055
|
if (typeof p === "function") return false;
|
|
@@ -7773,7 +8143,8 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
7773
8143
|
SessionController
|
|
7774
8144
|
] : [],
|
|
7775
8145
|
...includePlatform ? [
|
|
7776
|
-
PlatformAuthController
|
|
8146
|
+
PlatformAuthController,
|
|
8147
|
+
PlatformMfaController
|
|
7777
8148
|
] : [],
|
|
7778
8149
|
...includeOAuth ? [
|
|
7779
8150
|
OAuthController
|
|
@@ -7925,16 +8296,16 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
7925
8296
|
};
|
|
7926
8297
|
}
|
|
7927
8298
|
};
|
|
7928
|
-
BymaxAuthModule =
|
|
8299
|
+
BymaxAuthModule = _ts_decorate48([
|
|
7929
8300
|
Module({})
|
|
7930
8301
|
], BymaxAuthModule);
|
|
7931
|
-
function
|
|
8302
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
7932
8303
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7933
8304
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7934
8305
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7935
8306
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7936
8307
|
}
|
|
7937
|
-
__name(
|
|
8308
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
7938
8309
|
var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
7939
8310
|
static {
|
|
7940
8311
|
__name(this, "OptionalAuthGuard");
|
|
@@ -7949,26 +8320,26 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
|
7949
8320
|
return super.canActivate(context);
|
|
7950
8321
|
}
|
|
7951
8322
|
};
|
|
7952
|
-
OptionalAuthGuard =
|
|
8323
|
+
OptionalAuthGuard = _ts_decorate49([
|
|
7953
8324
|
Injectable()
|
|
7954
8325
|
], OptionalAuthGuard);
|
|
7955
|
-
function
|
|
8326
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
7956
8327
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7957
8328
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7958
8329
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7959
8330
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7960
8331
|
}
|
|
7961
|
-
__name(
|
|
7962
|
-
function
|
|
8332
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
8333
|
+
function _ts_metadata45(k, v) {
|
|
7963
8334
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7964
8335
|
}
|
|
7965
|
-
__name(
|
|
7966
|
-
function
|
|
8336
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
8337
|
+
function _ts_param26(paramIndex, decorator) {
|
|
7967
8338
|
return function(target, key) {
|
|
7968
8339
|
decorator(target, key, paramIndex);
|
|
7969
8340
|
};
|
|
7970
8341
|
}
|
|
7971
|
-
__name(
|
|
8342
|
+
__name(_ts_param26, "_ts_param");
|
|
7972
8343
|
var SelfOrAdminGuard = class {
|
|
7973
8344
|
static {
|
|
7974
8345
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -7998,11 +8369,11 @@ var SelfOrAdminGuard = class {
|
|
|
7998
8369
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE, HttpStatus.FORBIDDEN);
|
|
7999
8370
|
}
|
|
8000
8371
|
};
|
|
8001
|
-
SelfOrAdminGuard =
|
|
8372
|
+
SelfOrAdminGuard = _ts_decorate50([
|
|
8002
8373
|
Injectable(),
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8374
|
+
_ts_param26(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
8375
|
+
_ts_metadata45("design:type", Function),
|
|
8376
|
+
_ts_metadata45("design:paramtypes", [
|
|
8006
8377
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
8007
8378
|
])
|
|
8008
8379
|
], SelfOrAdminGuard);
|
|
@@ -8015,23 +8386,23 @@ function isHexLooking(value) {
|
|
|
8015
8386
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
8016
8387
|
}
|
|
8017
8388
|
__name(isHexLooking, "isHexLooking");
|
|
8018
|
-
function
|
|
8389
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
8019
8390
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8020
8391
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8021
8392
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8022
8393
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8023
8394
|
}
|
|
8024
|
-
__name(
|
|
8025
|
-
function
|
|
8395
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
8396
|
+
function _ts_metadata46(k, v) {
|
|
8026
8397
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8027
8398
|
}
|
|
8028
|
-
__name(
|
|
8029
|
-
function
|
|
8399
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
8400
|
+
function _ts_param27(paramIndex, decorator) {
|
|
8030
8401
|
return function(target, key) {
|
|
8031
8402
|
decorator(target, key, paramIndex);
|
|
8032
8403
|
};
|
|
8033
8404
|
}
|
|
8034
|
-
__name(
|
|
8405
|
+
__name(_ts_param27, "_ts_param");
|
|
8035
8406
|
var WsJwtGuard = class {
|
|
8036
8407
|
static {
|
|
8037
8408
|
__name(this, "WsJwtGuard");
|
|
@@ -8080,15 +8451,15 @@ var WsJwtGuard = class {
|
|
|
8080
8451
|
return true;
|
|
8081
8452
|
}
|
|
8082
8453
|
};
|
|
8083
|
-
WsJwtGuard =
|
|
8454
|
+
WsJwtGuard = _ts_decorate51([
|
|
8084
8455
|
Injectable(),
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8456
|
+
_ts_param27(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
8457
|
+
_ts_metadata46("design:type", Function),
|
|
8458
|
+
_ts_metadata46("design:paramtypes", [
|
|
8088
8459
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
8089
8460
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
8090
8461
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
8091
8462
|
])
|
|
8092
8463
|
], WsJwtGuard);
|
|
8093
8464
|
|
|
8094
|
-
export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AuthException, AuthService, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BymaxAuthModule, CreateInvitationDto, CurrentUser, ForgotPasswordDto, IS_PUBLIC_KEY, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, SessionService, SkipMfa, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WsJwtGuard, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
8465
|
+
export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AuthException, AuthService, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BymaxAuthModule, CreateInvitationDto, CurrentUser, ForgotPasswordDto, IS_PUBLIC_KEY, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, SessionService, SkipMfa, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WsJwtGuard, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|