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