@bymax-one/nest-auth 1.0.5 → 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 +25 -0
- package/dist/server/index.cjs +680 -331
- package/dist/server/index.d.cts +93 -4
- package/dist/server/index.d.ts +93 -4
- package/dist/server/index.mjs +680 -332
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -4235,6 +4235,39 @@ function _ts_metadata21(k, v) {
|
|
|
4235
4235
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4236
4236
|
}
|
|
4237
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");
|
|
4238
4271
|
var MfaVerifyDto = class {
|
|
4239
4272
|
static {
|
|
4240
4273
|
__name(this, "MfaVerifyDto");
|
|
@@ -4247,14 +4280,14 @@ var MfaVerifyDto = class {
|
|
|
4247
4280
|
*/
|
|
4248
4281
|
code;
|
|
4249
4282
|
};
|
|
4250
|
-
|
|
4283
|
+
_ts_decorate22([
|
|
4251
4284
|
classValidator.MaxLength(6),
|
|
4252
4285
|
classValidator.Matches(/^\d{6}$/, {
|
|
4253
4286
|
message: "code must be exactly 6 digits"
|
|
4254
4287
|
}),
|
|
4255
4288
|
classValidator.IsString(),
|
|
4256
4289
|
classValidator.IsNotEmpty(),
|
|
4257
|
-
|
|
4290
|
+
_ts_metadata22("design:type", String)
|
|
4258
4291
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
4259
4292
|
var IV_LENGTH = 12;
|
|
4260
4293
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
@@ -4411,17 +4444,17 @@ function verifyTotp(secretBase32, code, window = 1) {
|
|
|
4411
4444
|
__name(verifyTotp, "verifyTotp");
|
|
4412
4445
|
|
|
4413
4446
|
// src/server/services/mfa.service.ts
|
|
4414
|
-
function
|
|
4447
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
4415
4448
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4416
4449
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4417
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;
|
|
4418
4451
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4419
4452
|
}
|
|
4420
|
-
__name(
|
|
4421
|
-
function
|
|
4453
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
4454
|
+
function _ts_metadata23(k, v) {
|
|
4422
4455
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4423
4456
|
}
|
|
4424
|
-
__name(
|
|
4457
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
4425
4458
|
function _ts_param12(paramIndex, decorator) {
|
|
4426
4459
|
return function(target, key) {
|
|
4427
4460
|
decorator(target, key, paramIndex);
|
|
@@ -4612,7 +4645,7 @@ exports.MfaService = class _MfaService {
|
|
|
4612
4645
|
// setup — TOTP secret generation, idempotent key reservation, recovery codes
|
|
4613
4646
|
// ---------------------------------------------------------------------------
|
|
4614
4647
|
/**
|
|
4615
|
-
* Initiates the MFA setup flow for a dashboard user.
|
|
4648
|
+
* Initiates the MFA setup flow for a dashboard user or platform administrator.
|
|
4616
4649
|
*
|
|
4617
4650
|
* Generates a TOTP secret and 8 recovery codes, stores them temporarily in
|
|
4618
4651
|
* Redis (10 minutes), and returns the data needed to display the QR code and
|
|
@@ -4623,12 +4656,19 @@ exports.MfaService = class _MfaService {
|
|
|
4623
4656
|
* requests cannot generate different secrets.
|
|
4624
4657
|
*
|
|
4625
4658
|
* @param userId - Internal ID of the user enabling MFA.
|
|
4659
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4626
4660
|
* @returns Setup result containing the secret, QR URI, and plain recovery codes.
|
|
4627
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".
|
|
4628
4666
|
*/
|
|
4629
|
-
async setup(userId) {
|
|
4630
|
-
|
|
4631
|
-
|
|
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);
|
|
4632
4672
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
4633
4673
|
const setupKey = `mfa_setup:${hmacSha256(userId, this.options.hmacKey)}`;
|
|
4634
4674
|
const existingFast = await this.redis.get(setupKey);
|
|
@@ -4673,7 +4713,7 @@ exports.MfaService = class _MfaService {
|
|
|
4673
4713
|
await this.redis.set(setupKey, payload, MFA_SETUP_TTL_SECONDS);
|
|
4674
4714
|
}
|
|
4675
4715
|
const qrCodeUri = buildTotpUri(secretBase32, user.email, this.mfaOptions.issuer);
|
|
4676
|
-
this.logger.log(`setup: MFA setup initiated userId=${userId}`);
|
|
4716
|
+
this.logger.log(`setup: MFA setup initiated userId=${userId} context=${context}`);
|
|
4677
4717
|
return {
|
|
4678
4718
|
secret: secretBase32,
|
|
4679
4719
|
qrCodeUri,
|
|
@@ -4696,12 +4736,17 @@ exports.MfaService = class _MfaService {
|
|
|
4696
4736
|
* @param code - 6-digit TOTP code from the authenticator app.
|
|
4697
4737
|
* @param ip - Client IP address (forwarded to hooks).
|
|
4698
4738
|
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
4739
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
4699
4740
|
* @throws `MFA_SETUP_REQUIRED` if no pending setup data is found in Redis.
|
|
4700
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.
|
|
4701
4744
|
*/
|
|
4702
|
-
async verifyAndEnable(userId, code, ip, userAgent) {
|
|
4703
|
-
|
|
4704
|
-
|
|
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);
|
|
4705
4750
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
4706
4751
|
const setupKey = `mfa_setup:${hmacSha256(userId, this.options.hmacKey)}`;
|
|
4707
4752
|
const raw = await this.redis.get(setupKey);
|
|
@@ -4719,16 +4764,22 @@ exports.MfaService = class _MfaService {
|
|
|
4719
4764
|
this.logger.warn(`verifyAndEnable: setup key consumed by concurrent request userId=${userId}`);
|
|
4720
4765
|
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
4721
4766
|
}
|
|
4722
|
-
|
|
4767
|
+
const enableData = {
|
|
4723
4768
|
mfaEnabled: true,
|
|
4724
4769
|
mfaSecret: data.encryptedSecret,
|
|
4725
4770
|
mfaRecoveryCodes: data.hashedCodes
|
|
4726
|
-
}
|
|
4771
|
+
};
|
|
4772
|
+
if (context === "platform" && this.platformUserRepo) {
|
|
4773
|
+
await this.platformUserRepo.updateMfa(userId, enableData);
|
|
4774
|
+
} else {
|
|
4775
|
+
await this.userRepo.updateMfa(userId, enableData);
|
|
4776
|
+
}
|
|
4727
4777
|
await this.redis.invalidateUserSessions(userId);
|
|
4728
|
-
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId}`);
|
|
4778
|
+
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId} context=${context}`);
|
|
4729
4779
|
await this.emailProvider.sendMfaEnabledNotification(user.email);
|
|
4730
4780
|
if (this.hooks.afterMfaEnabled) {
|
|
4731
|
-
|
|
4781
|
+
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
4782
|
+
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
4732
4783
|
userId,
|
|
4733
4784
|
ip,
|
|
4734
4785
|
userAgent,
|
|
@@ -4907,6 +4958,95 @@ exports.MfaService = class _MfaService {
|
|
|
4907
4958
|
}
|
|
4908
4959
|
}
|
|
4909
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
|
+
// ---------------------------------------------------------------------------
|
|
4910
5050
|
// Private helpers
|
|
4911
5051
|
// ---------------------------------------------------------------------------
|
|
4912
5052
|
/**
|
|
@@ -4945,7 +5085,7 @@ exports.MfaService = class _MfaService {
|
|
|
4945
5085
|
return admin;
|
|
4946
5086
|
}
|
|
4947
5087
|
};
|
|
4948
|
-
exports.MfaService =
|
|
5088
|
+
exports.MfaService = _ts_decorate23([
|
|
4949
5089
|
common.Injectable(),
|
|
4950
5090
|
_ts_param12(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
4951
5091
|
_ts_param12(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -4953,8 +5093,8 @@ exports.MfaService = _ts_decorate22([
|
|
|
4953
5093
|
_ts_param12(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
4954
5094
|
_ts_param12(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
4955
5095
|
_ts_param12(9, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
4956
|
-
|
|
4957
|
-
|
|
5096
|
+
_ts_metadata23("design:type", Function),
|
|
5097
|
+
_ts_metadata23("design:paramtypes", [
|
|
4958
5098
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
4959
5099
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
4960
5100
|
Object,
|
|
@@ -4969,17 +5109,17 @@ exports.MfaService = _ts_decorate22([
|
|
|
4969
5109
|
], exports.MfaService);
|
|
4970
5110
|
|
|
4971
5111
|
// src/server/controllers/mfa.controller.ts
|
|
4972
|
-
function
|
|
5112
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
4973
5113
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4974
5114
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4975
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;
|
|
4976
5116
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4977
5117
|
}
|
|
4978
|
-
__name(
|
|
4979
|
-
function
|
|
5118
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
5119
|
+
function _ts_metadata24(k, v) {
|
|
4980
5120
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4981
5121
|
}
|
|
4982
|
-
__name(
|
|
5122
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
4983
5123
|
function _ts_param13(paramIndex, decorator) {
|
|
4984
5124
|
return function(target, key) {
|
|
4985
5125
|
decorator(target, key, paramIndex);
|
|
@@ -5078,19 +5218,44 @@ var MfaController = class {
|
|
|
5078
5218
|
const context = user.type === "platform" ? "platform" : "dashboard";
|
|
5079
5219
|
await this.mfaService.disable(user.sub, dto.code, ip, userAgent, context);
|
|
5080
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
|
+
}
|
|
5081
5246
|
};
|
|
5082
|
-
|
|
5247
|
+
_ts_decorate24([
|
|
5083
5248
|
common.UseGuards(exports.JwtAuthGuard),
|
|
5084
5249
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
5085
5250
|
common.Post("setup"),
|
|
5086
5251
|
_ts_param13(0, CurrentUser()),
|
|
5087
|
-
|
|
5088
|
-
|
|
5252
|
+
_ts_metadata24("design:type", Function),
|
|
5253
|
+
_ts_metadata24("design:paramtypes", [
|
|
5089
5254
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
5090
5255
|
]),
|
|
5091
|
-
|
|
5256
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5092
5257
|
], MfaController.prototype, "setup", null);
|
|
5093
|
-
|
|
5258
|
+
_ts_decorate24([
|
|
5094
5259
|
common.UseGuards(exports.JwtAuthGuard),
|
|
5095
5260
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
5096
5261
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
@@ -5098,15 +5263,15 @@ _ts_decorate23([
|
|
|
5098
5263
|
_ts_param13(0, CurrentUser()),
|
|
5099
5264
|
_ts_param13(1, common.Body()),
|
|
5100
5265
|
_ts_param13(2, common.Req()),
|
|
5101
|
-
|
|
5102
|
-
|
|
5266
|
+
_ts_metadata24("design:type", Function),
|
|
5267
|
+
_ts_metadata24("design:paramtypes", [
|
|
5103
5268
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
5104
5269
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
5105
5270
|
typeof Request === "undefined" ? Object : Request
|
|
5106
5271
|
]),
|
|
5107
|
-
|
|
5272
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5108
5273
|
], MfaController.prototype, "verifyEnable", null);
|
|
5109
|
-
|
|
5274
|
+
_ts_decorate24([
|
|
5110
5275
|
Public(),
|
|
5111
5276
|
SkipMfa(),
|
|
5112
5277
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
@@ -5117,15 +5282,15 @@ _ts_decorate23([
|
|
|
5117
5282
|
_ts_param13(2, common.Res({
|
|
5118
5283
|
passthrough: true
|
|
5119
5284
|
})),
|
|
5120
|
-
|
|
5121
|
-
|
|
5285
|
+
_ts_metadata24("design:type", Function),
|
|
5286
|
+
_ts_metadata24("design:paramtypes", [
|
|
5122
5287
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
5123
5288
|
typeof Request === "undefined" ? Object : Request,
|
|
5124
5289
|
typeof Response === "undefined" ? Object : Response
|
|
5125
5290
|
]),
|
|
5126
|
-
|
|
5291
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5127
5292
|
], MfaController.prototype, "challenge", null);
|
|
5128
|
-
|
|
5293
|
+
_ts_decorate24([
|
|
5129
5294
|
common.UseGuards(exports.JwtAuthGuard),
|
|
5130
5295
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
5131
5296
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
@@ -5133,38 +5298,54 @@ _ts_decorate23([
|
|
|
5133
5298
|
_ts_param13(0, CurrentUser()),
|
|
5134
5299
|
_ts_param13(1, common.Body()),
|
|
5135
5300
|
_ts_param13(2, common.Req()),
|
|
5136
|
-
|
|
5137
|
-
|
|
5301
|
+
_ts_metadata24("design:type", Function),
|
|
5302
|
+
_ts_metadata24("design:paramtypes", [
|
|
5138
5303
|
Object,
|
|
5139
5304
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
5140
5305
|
typeof Request === "undefined" ? Object : Request
|
|
5141
5306
|
]),
|
|
5142
|
-
|
|
5307
|
+
_ts_metadata24("design:returntype", Promise)
|
|
5143
5308
|
], MfaController.prototype, "disable", null);
|
|
5144
|
-
|
|
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([
|
|
5145
5326
|
common.Controller("mfa"),
|
|
5146
5327
|
common.UsePipes(new common.ValidationPipe({
|
|
5147
5328
|
whitelist: true,
|
|
5148
5329
|
forbidNonWhitelisted: true,
|
|
5149
5330
|
forbidUnknownValues: true
|
|
5150
5331
|
})),
|
|
5151
|
-
|
|
5152
|
-
|
|
5332
|
+
_ts_metadata24("design:type", Function),
|
|
5333
|
+
_ts_metadata24("design:paramtypes", [
|
|
5153
5334
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
5154
5335
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
5155
5336
|
])
|
|
5156
5337
|
], MfaController);
|
|
5157
|
-
function
|
|
5338
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
5158
5339
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5159
5340
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5160
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;
|
|
5161
5342
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5162
5343
|
}
|
|
5163
|
-
__name(
|
|
5164
|
-
function
|
|
5344
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
5345
|
+
function _ts_metadata25(k, v) {
|
|
5165
5346
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5166
5347
|
}
|
|
5167
|
-
__name(
|
|
5348
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
5168
5349
|
var ForgotPasswordDto = class {
|
|
5169
5350
|
static {
|
|
5170
5351
|
__name(this, "ForgotPasswordDto");
|
|
@@ -5180,29 +5361,29 @@ var ForgotPasswordDto = class {
|
|
|
5180
5361
|
*/
|
|
5181
5362
|
tenantId;
|
|
5182
5363
|
};
|
|
5183
|
-
|
|
5364
|
+
_ts_decorate25([
|
|
5184
5365
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5185
5366
|
classValidator.IsEmail(),
|
|
5186
5367
|
classValidator.MaxLength(255),
|
|
5187
|
-
|
|
5368
|
+
_ts_metadata25("design:type", String)
|
|
5188
5369
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
5189
|
-
|
|
5370
|
+
_ts_decorate25([
|
|
5190
5371
|
classValidator.IsString(),
|
|
5191
5372
|
classValidator.IsNotEmpty(),
|
|
5192
5373
|
classValidator.MaxLength(128),
|
|
5193
|
-
|
|
5374
|
+
_ts_metadata25("design:type", String)
|
|
5194
5375
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
5195
|
-
function
|
|
5376
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
5196
5377
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5197
5378
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5198
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;
|
|
5199
5380
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5200
5381
|
}
|
|
5201
|
-
__name(
|
|
5202
|
-
function
|
|
5382
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
5383
|
+
function _ts_metadata26(k, v) {
|
|
5203
5384
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5204
5385
|
}
|
|
5205
|
-
__name(
|
|
5386
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
5206
5387
|
var ResendOtpDto = class {
|
|
5207
5388
|
static {
|
|
5208
5389
|
__name(this, "ResendOtpDto");
|
|
@@ -5217,29 +5398,29 @@ var ResendOtpDto = class {
|
|
|
5217
5398
|
*/
|
|
5218
5399
|
tenantId;
|
|
5219
5400
|
};
|
|
5220
|
-
|
|
5401
|
+
_ts_decorate26([
|
|
5221
5402
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5222
5403
|
classValidator.IsEmail(),
|
|
5223
5404
|
classValidator.MaxLength(255),
|
|
5224
|
-
|
|
5405
|
+
_ts_metadata26("design:type", String)
|
|
5225
5406
|
], ResendOtpDto.prototype, "email", void 0);
|
|
5226
|
-
|
|
5407
|
+
_ts_decorate26([
|
|
5227
5408
|
classValidator.IsString(),
|
|
5228
5409
|
classValidator.IsNotEmpty(),
|
|
5229
5410
|
classValidator.MaxLength(128),
|
|
5230
|
-
|
|
5411
|
+
_ts_metadata26("design:type", String)
|
|
5231
5412
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
5232
|
-
function
|
|
5413
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
5233
5414
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5234
5415
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5235
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;
|
|
5236
5417
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5237
5418
|
}
|
|
5238
|
-
__name(
|
|
5239
|
-
function
|
|
5419
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
5420
|
+
function _ts_metadata27(k, v) {
|
|
5240
5421
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5241
5422
|
}
|
|
5242
|
-
__name(
|
|
5423
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
5243
5424
|
var ResetPasswordDto = class {
|
|
5244
5425
|
static {
|
|
5245
5426
|
__name(this, "ResetPasswordDto");
|
|
@@ -5279,54 +5460,54 @@ var ResetPasswordDto = class {
|
|
|
5279
5460
|
*/
|
|
5280
5461
|
tenantId;
|
|
5281
5462
|
};
|
|
5282
|
-
|
|
5463
|
+
_ts_decorate27([
|
|
5283
5464
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5284
5465
|
classValidator.IsEmail(),
|
|
5285
5466
|
classValidator.MaxLength(255),
|
|
5286
|
-
|
|
5467
|
+
_ts_metadata27("design:type", String)
|
|
5287
5468
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
5288
|
-
|
|
5469
|
+
_ts_decorate27([
|
|
5289
5470
|
classValidator.IsString(),
|
|
5290
5471
|
classValidator.MinLength(8),
|
|
5291
5472
|
classValidator.MaxLength(128),
|
|
5292
|
-
|
|
5473
|
+
_ts_metadata27("design:type", String)
|
|
5293
5474
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
5294
|
-
|
|
5475
|
+
_ts_decorate27([
|
|
5295
5476
|
classValidator.IsOptional(),
|
|
5296
5477
|
classValidator.IsString(),
|
|
5297
5478
|
classValidator.IsNotEmpty(),
|
|
5298
5479
|
classValidator.MaxLength(2048),
|
|
5299
|
-
|
|
5480
|
+
_ts_metadata27("design:type", String)
|
|
5300
5481
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
5301
|
-
|
|
5482
|
+
_ts_decorate27([
|
|
5302
5483
|
classValidator.IsOptional(),
|
|
5303
5484
|
classValidator.IsString(),
|
|
5304
5485
|
classValidator.Length(4, 8),
|
|
5305
|
-
|
|
5486
|
+
_ts_metadata27("design:type", String)
|
|
5306
5487
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
5307
|
-
|
|
5488
|
+
_ts_decorate27([
|
|
5308
5489
|
classValidator.IsOptional(),
|
|
5309
5490
|
classValidator.IsString(),
|
|
5310
5491
|
classValidator.Length(64, 64),
|
|
5311
|
-
|
|
5492
|
+
_ts_metadata27("design:type", String)
|
|
5312
5493
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
5313
|
-
|
|
5494
|
+
_ts_decorate27([
|
|
5314
5495
|
classValidator.IsString(),
|
|
5315
5496
|
classValidator.IsNotEmpty(),
|
|
5316
5497
|
classValidator.MaxLength(128),
|
|
5317
|
-
|
|
5498
|
+
_ts_metadata27("design:type", String)
|
|
5318
5499
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
5319
|
-
function
|
|
5500
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
5320
5501
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5321
5502
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5322
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;
|
|
5323
5504
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5324
5505
|
}
|
|
5325
|
-
__name(
|
|
5326
|
-
function
|
|
5506
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
5507
|
+
function _ts_metadata28(k, v) {
|
|
5327
5508
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5328
5509
|
}
|
|
5329
|
-
__name(
|
|
5510
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
5330
5511
|
var VerifyOtpDto = class {
|
|
5331
5512
|
static {
|
|
5332
5513
|
__name(this, "VerifyOtpDto");
|
|
@@ -5348,34 +5529,34 @@ var VerifyOtpDto = class {
|
|
|
5348
5529
|
*/
|
|
5349
5530
|
tenantId;
|
|
5350
5531
|
};
|
|
5351
|
-
|
|
5532
|
+
_ts_decorate28([
|
|
5352
5533
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5353
5534
|
classValidator.IsEmail(),
|
|
5354
5535
|
classValidator.MaxLength(255),
|
|
5355
|
-
|
|
5536
|
+
_ts_metadata28("design:type", String)
|
|
5356
5537
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
5357
|
-
|
|
5538
|
+
_ts_decorate28([
|
|
5358
5539
|
classValidator.IsString(),
|
|
5359
5540
|
classValidator.Length(4, 8),
|
|
5360
|
-
|
|
5541
|
+
_ts_metadata28("design:type", String)
|
|
5361
5542
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
5362
|
-
|
|
5543
|
+
_ts_decorate28([
|
|
5363
5544
|
classValidator.IsString(),
|
|
5364
5545
|
classValidator.IsNotEmpty(),
|
|
5365
5546
|
classValidator.MaxLength(128),
|
|
5366
|
-
|
|
5547
|
+
_ts_metadata28("design:type", String)
|
|
5367
5548
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
5368
|
-
function
|
|
5549
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
5369
5550
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5370
5551
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5371
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;
|
|
5372
5553
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5373
5554
|
}
|
|
5374
|
-
__name(
|
|
5375
|
-
function
|
|
5555
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
5556
|
+
function _ts_metadata29(k, v) {
|
|
5376
5557
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5377
5558
|
}
|
|
5378
|
-
__name(
|
|
5559
|
+
__name(_ts_metadata29, "_ts_metadata");
|
|
5379
5560
|
function _ts_param14(paramIndex, decorator) {
|
|
5380
5561
|
return function(target, key) {
|
|
5381
5562
|
decorator(target, key, paramIndex);
|
|
@@ -5732,7 +5913,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
5732
5913
|
return parsed;
|
|
5733
5914
|
}
|
|
5734
5915
|
};
|
|
5735
|
-
exports.PasswordResetService =
|
|
5916
|
+
exports.PasswordResetService = _ts_decorate29([
|
|
5736
5917
|
common.Injectable(),
|
|
5737
5918
|
_ts_param14(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
5738
5919
|
_ts_param14(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -5740,8 +5921,8 @@ exports.PasswordResetService = _ts_decorate28([
|
|
|
5740
5921
|
_ts_param14(2, common.Optional()),
|
|
5741
5922
|
_ts_param14(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
5742
5923
|
_ts_param14(3, common.Optional()),
|
|
5743
|
-
|
|
5744
|
-
|
|
5924
|
+
_ts_metadata29("design:type", Function),
|
|
5925
|
+
_ts_metadata29("design:paramtypes", [
|
|
5745
5926
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
5746
5927
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
5747
5928
|
Object,
|
|
@@ -5758,17 +5939,17 @@ function toSafeUser3(user) {
|
|
|
5758
5939
|
__name(toSafeUser3, "toSafeUser");
|
|
5759
5940
|
|
|
5760
5941
|
// src/server/controllers/password-reset.controller.ts
|
|
5761
|
-
function
|
|
5942
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
5762
5943
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5763
5944
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5764
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;
|
|
5765
5946
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5766
5947
|
}
|
|
5767
|
-
__name(
|
|
5768
|
-
function
|
|
5948
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
5949
|
+
function _ts_metadata30(k, v) {
|
|
5769
5950
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5770
5951
|
}
|
|
5771
|
-
__name(
|
|
5952
|
+
__name(_ts_metadata30, "_ts_metadata");
|
|
5772
5953
|
function _ts_param15(paramIndex, decorator) {
|
|
5773
5954
|
return function(target, key) {
|
|
5774
5955
|
decorator(target, key, paramIndex);
|
|
@@ -5852,73 +6033,73 @@ var PasswordResetController = class {
|
|
|
5852
6033
|
await this.passwordResetService.resendOtp(dto);
|
|
5853
6034
|
}
|
|
5854
6035
|
};
|
|
5855
|
-
|
|
6036
|
+
_ts_decorate30([
|
|
5856
6037
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
5857
6038
|
common.HttpCode(common.HttpStatus.OK),
|
|
5858
6039
|
common.Post("forgot-password"),
|
|
5859
6040
|
_ts_param15(0, common.Body()),
|
|
5860
|
-
|
|
5861
|
-
|
|
6041
|
+
_ts_metadata30("design:type", Function),
|
|
6042
|
+
_ts_metadata30("design:paramtypes", [
|
|
5862
6043
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto
|
|
5863
6044
|
]),
|
|
5864
|
-
|
|
6045
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5865
6046
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
5866
|
-
|
|
6047
|
+
_ts_decorate30([
|
|
5867
6048
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
5868
6049
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
5869
6050
|
common.Post("reset-password"),
|
|
5870
6051
|
_ts_param15(0, common.Body()),
|
|
5871
|
-
|
|
5872
|
-
|
|
6052
|
+
_ts_metadata30("design:type", Function),
|
|
6053
|
+
_ts_metadata30("design:paramtypes", [
|
|
5873
6054
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto
|
|
5874
6055
|
]),
|
|
5875
|
-
|
|
6056
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5876
6057
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
5877
|
-
|
|
6058
|
+
_ts_decorate30([
|
|
5878
6059
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
5879
6060
|
common.HttpCode(common.HttpStatus.OK),
|
|
5880
6061
|
common.Post("verify-otp"),
|
|
5881
6062
|
_ts_param15(0, common.Body()),
|
|
5882
|
-
|
|
5883
|
-
|
|
6063
|
+
_ts_metadata30("design:type", Function),
|
|
6064
|
+
_ts_metadata30("design:paramtypes", [
|
|
5884
6065
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto
|
|
5885
6066
|
]),
|
|
5886
|
-
|
|
6067
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5887
6068
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
5888
|
-
|
|
6069
|
+
_ts_decorate30([
|
|
5889
6070
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
5890
6071
|
common.HttpCode(common.HttpStatus.OK),
|
|
5891
6072
|
common.Post("resend-otp"),
|
|
5892
6073
|
_ts_param15(0, common.Body()),
|
|
5893
|
-
|
|
5894
|
-
|
|
6074
|
+
_ts_metadata30("design:type", Function),
|
|
6075
|
+
_ts_metadata30("design:paramtypes", [
|
|
5895
6076
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto
|
|
5896
6077
|
]),
|
|
5897
|
-
|
|
6078
|
+
_ts_metadata30("design:returntype", Promise)
|
|
5898
6079
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
5899
|
-
PasswordResetController =
|
|
6080
|
+
PasswordResetController = _ts_decorate30([
|
|
5900
6081
|
Public(),
|
|
5901
6082
|
common.Controller("password"),
|
|
5902
6083
|
common.UsePipes(new common.ValidationPipe({
|
|
5903
6084
|
whitelist: true,
|
|
5904
6085
|
forbidNonWhitelisted: true
|
|
5905
6086
|
})),
|
|
5906
|
-
|
|
5907
|
-
|
|
6087
|
+
_ts_metadata30("design:type", Function),
|
|
6088
|
+
_ts_metadata30("design:paramtypes", [
|
|
5908
6089
|
typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService
|
|
5909
6090
|
])
|
|
5910
6091
|
], PasswordResetController);
|
|
5911
|
-
function
|
|
6092
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
5912
6093
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5913
6094
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5914
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;
|
|
5915
6096
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5916
6097
|
}
|
|
5917
|
-
__name(
|
|
5918
|
-
function
|
|
6098
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
6099
|
+
function _ts_metadata31(k, v) {
|
|
5919
6100
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5920
6101
|
}
|
|
5921
|
-
__name(
|
|
6102
|
+
__name(_ts_metadata31, "_ts_metadata");
|
|
5922
6103
|
var PlatformLoginDto = class {
|
|
5923
6104
|
static {
|
|
5924
6105
|
__name(this, "PlatformLoginDto");
|
|
@@ -5940,14 +6121,14 @@ var PlatformLoginDto = class {
|
|
|
5940
6121
|
*/
|
|
5941
6122
|
password;
|
|
5942
6123
|
};
|
|
5943
|
-
|
|
6124
|
+
_ts_decorate31([
|
|
5944
6125
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
5945
6126
|
classValidator.IsEmail(),
|
|
5946
6127
|
classValidator.IsNotEmpty(),
|
|
5947
6128
|
classValidator.MaxLength(255),
|
|
5948
|
-
|
|
6129
|
+
_ts_metadata31("design:type", String)
|
|
5949
6130
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
5950
|
-
|
|
6131
|
+
_ts_decorate31([
|
|
5951
6132
|
classValidator.IsString(),
|
|
5952
6133
|
classValidator.IsNotEmpty(),
|
|
5953
6134
|
classValidator.Matches(/\S/, {
|
|
@@ -5955,19 +6136,19 @@ _ts_decorate30([
|
|
|
5955
6136
|
}),
|
|
5956
6137
|
classValidator.MinLength(12),
|
|
5957
6138
|
classValidator.MaxLength(128),
|
|
5958
|
-
|
|
6139
|
+
_ts_metadata31("design:type", String)
|
|
5959
6140
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
5960
|
-
function
|
|
6141
|
+
function _ts_decorate32(decorators, target, key, desc) {
|
|
5961
6142
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5962
6143
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5963
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;
|
|
5964
6145
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5965
6146
|
}
|
|
5966
|
-
__name(
|
|
5967
|
-
function
|
|
6147
|
+
__name(_ts_decorate32, "_ts_decorate");
|
|
6148
|
+
function _ts_metadata32(k, v) {
|
|
5968
6149
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5969
6150
|
}
|
|
5970
|
-
__name(
|
|
6151
|
+
__name(_ts_metadata32, "_ts_metadata");
|
|
5971
6152
|
function _ts_param16(paramIndex, decorator) {
|
|
5972
6153
|
return function(target, key) {
|
|
5973
6154
|
decorator(target, key, paramIndex);
|
|
@@ -6024,11 +6205,11 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
|
6024
6205
|
return true;
|
|
6025
6206
|
}
|
|
6026
6207
|
};
|
|
6027
|
-
exports.JwtPlatformGuard =
|
|
6208
|
+
exports.JwtPlatformGuard = _ts_decorate32([
|
|
6028
6209
|
common.Injectable(),
|
|
6029
6210
|
_ts_param16(4, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
6030
|
-
|
|
6031
|
-
|
|
6211
|
+
_ts_metadata32("design:type", Function),
|
|
6212
|
+
_ts_metadata32("design:paramtypes", [
|
|
6032
6213
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
6033
6214
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
6034
6215
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -6036,17 +6217,17 @@ exports.JwtPlatformGuard = _ts_decorate31([
|
|
|
6036
6217
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6037
6218
|
])
|
|
6038
6219
|
], exports.JwtPlatformGuard);
|
|
6039
|
-
function
|
|
6220
|
+
function _ts_decorate33(decorators, target, key, desc) {
|
|
6040
6221
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6041
6222
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6042
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;
|
|
6043
6224
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6044
6225
|
}
|
|
6045
|
-
__name(
|
|
6046
|
-
function
|
|
6226
|
+
__name(_ts_decorate33, "_ts_decorate");
|
|
6227
|
+
function _ts_metadata33(k, v) {
|
|
6047
6228
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6048
6229
|
}
|
|
6049
|
-
__name(
|
|
6230
|
+
__name(_ts_metadata33, "_ts_metadata");
|
|
6050
6231
|
function _ts_param17(paramIndex, decorator) {
|
|
6051
6232
|
return function(target, key) {
|
|
6052
6233
|
decorator(target, key, paramIndex);
|
|
@@ -6205,12 +6386,12 @@ var PlatformAuthService = class _PlatformAuthService {
|
|
|
6205
6386
|
await this.redis.invalidateUserSessions(userId);
|
|
6206
6387
|
}
|
|
6207
6388
|
};
|
|
6208
|
-
PlatformAuthService =
|
|
6389
|
+
PlatformAuthService = _ts_decorate33([
|
|
6209
6390
|
common.Injectable(),
|
|
6210
6391
|
_ts_param17(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
6211
6392
|
_ts_param17(5, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
6212
|
-
|
|
6213
|
-
|
|
6393
|
+
_ts_metadata33("design:type", Function),
|
|
6394
|
+
_ts_metadata33("design:paramtypes", [
|
|
6214
6395
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
6215
6396
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
6216
6397
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -6221,17 +6402,17 @@ PlatformAuthService = _ts_decorate32([
|
|
|
6221
6402
|
], PlatformAuthService);
|
|
6222
6403
|
|
|
6223
6404
|
// src/server/controllers/platform-auth.controller.ts
|
|
6224
|
-
function
|
|
6405
|
+
function _ts_decorate34(decorators, target, key, desc) {
|
|
6225
6406
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6226
6407
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6227
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;
|
|
6228
6409
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6229
6410
|
}
|
|
6230
|
-
__name(
|
|
6231
|
-
function
|
|
6411
|
+
__name(_ts_decorate34, "_ts_decorate");
|
|
6412
|
+
function _ts_metadata34(k, v) {
|
|
6232
6413
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6233
6414
|
}
|
|
6234
|
-
__name(
|
|
6415
|
+
__name(_ts_metadata34, "_ts_metadata");
|
|
6235
6416
|
function _ts_param18(paramIndex, decorator) {
|
|
6236
6417
|
return function(target, key) {
|
|
6237
6418
|
decorator(target, key, paramIndex);
|
|
@@ -6392,111 +6573,277 @@ var PlatformAuthController = class {
|
|
|
6392
6573
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
6393
6574
|
}
|
|
6394
6575
|
};
|
|
6395
|
-
|
|
6576
|
+
_ts_decorate34([
|
|
6396
6577
|
Public(),
|
|
6397
6578
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
6398
6579
|
common.HttpCode(common.HttpStatus.OK),
|
|
6399
6580
|
common.Post("login"),
|
|
6400
6581
|
_ts_param18(0, common.Body()),
|
|
6401
6582
|
_ts_param18(1, common.Req()),
|
|
6402
|
-
|
|
6403
|
-
|
|
6583
|
+
_ts_metadata34("design:type", Function),
|
|
6584
|
+
_ts_metadata34("design:paramtypes", [
|
|
6404
6585
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
6405
6586
|
typeof Request === "undefined" ? Object : Request
|
|
6406
6587
|
]),
|
|
6407
|
-
|
|
6588
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6408
6589
|
], PlatformAuthController.prototype, "login", null);
|
|
6409
|
-
|
|
6590
|
+
_ts_decorate34([
|
|
6410
6591
|
Public(),
|
|
6411
6592
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
6412
6593
|
common.HttpCode(common.HttpStatus.OK),
|
|
6413
6594
|
common.Post("mfa/challenge"),
|
|
6414
6595
|
_ts_param18(0, common.Body()),
|
|
6415
6596
|
_ts_param18(1, common.Req()),
|
|
6416
|
-
|
|
6417
|
-
|
|
6597
|
+
_ts_metadata34("design:type", Function),
|
|
6598
|
+
_ts_metadata34("design:paramtypes", [
|
|
6418
6599
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
6419
6600
|
typeof Request === "undefined" ? Object : Request
|
|
6420
6601
|
]),
|
|
6421
|
-
|
|
6602
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6422
6603
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
6423
|
-
|
|
6604
|
+
_ts_decorate34([
|
|
6424
6605
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
6425
6606
|
common.Get("me"),
|
|
6426
6607
|
_ts_param18(0, CurrentUser()),
|
|
6427
|
-
|
|
6428
|
-
|
|
6608
|
+
_ts_metadata34("design:type", Function),
|
|
6609
|
+
_ts_metadata34("design:paramtypes", [
|
|
6429
6610
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6430
6611
|
]),
|
|
6431
|
-
|
|
6612
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6432
6613
|
], PlatformAuthController.prototype, "me", null);
|
|
6433
|
-
|
|
6614
|
+
_ts_decorate34([
|
|
6434
6615
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
6435
6616
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6436
6617
|
common.Post("logout"),
|
|
6437
6618
|
_ts_param18(0, CurrentUser()),
|
|
6438
6619
|
_ts_param18(1, common.Req()),
|
|
6439
|
-
|
|
6440
|
-
|
|
6620
|
+
_ts_metadata34("design:type", Function),
|
|
6621
|
+
_ts_metadata34("design:paramtypes", [
|
|
6441
6622
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
6442
6623
|
typeof Request === "undefined" ? Object : Request
|
|
6443
6624
|
]),
|
|
6444
|
-
|
|
6625
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6445
6626
|
], PlatformAuthController.prototype, "logout", null);
|
|
6446
|
-
|
|
6627
|
+
_ts_decorate34([
|
|
6447
6628
|
Public(),
|
|
6448
6629
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6449
6630
|
common.HttpCode(common.HttpStatus.OK),
|
|
6450
6631
|
common.Post("refresh"),
|
|
6451
6632
|
_ts_param18(0, common.Req()),
|
|
6452
|
-
|
|
6453
|
-
|
|
6633
|
+
_ts_metadata34("design:type", Function),
|
|
6634
|
+
_ts_metadata34("design:paramtypes", [
|
|
6454
6635
|
typeof Request === "undefined" ? Object : Request
|
|
6455
6636
|
]),
|
|
6456
|
-
|
|
6637
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6457
6638
|
], PlatformAuthController.prototype, "refresh", null);
|
|
6458
|
-
|
|
6639
|
+
_ts_decorate34([
|
|
6459
6640
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
6460
6641
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
6461
6642
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6462
6643
|
common.Delete("sessions"),
|
|
6463
6644
|
_ts_param18(0, CurrentUser()),
|
|
6464
|
-
|
|
6465
|
-
|
|
6645
|
+
_ts_metadata34("design:type", Function),
|
|
6646
|
+
_ts_metadata34("design:paramtypes", [
|
|
6466
6647
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
6467
6648
|
]),
|
|
6468
|
-
|
|
6649
|
+
_ts_metadata34("design:returntype", Promise)
|
|
6469
6650
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
6470
|
-
PlatformAuthController =
|
|
6651
|
+
PlatformAuthController = _ts_decorate34([
|
|
6471
6652
|
common.Controller("platform"),
|
|
6472
6653
|
common.UsePipes(new common.ValidationPipe({
|
|
6473
6654
|
whitelist: true,
|
|
6474
6655
|
forbidNonWhitelisted: true
|
|
6475
6656
|
})),
|
|
6476
|
-
|
|
6477
|
-
|
|
6657
|
+
_ts_metadata34("design:type", Function),
|
|
6658
|
+
_ts_metadata34("design:paramtypes", [
|
|
6478
6659
|
typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
|
|
6479
6660
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
6480
6661
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
6481
6662
|
])
|
|
6482
6663
|
], PlatformAuthController);
|
|
6483
|
-
function
|
|
6664
|
+
function _ts_decorate35(decorators, target, key, desc) {
|
|
6484
6665
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6485
6666
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6486
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;
|
|
6487
6668
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6488
6669
|
}
|
|
6489
|
-
__name(
|
|
6490
|
-
function
|
|
6670
|
+
__name(_ts_decorate35, "_ts_decorate");
|
|
6671
|
+
function _ts_metadata35(k, v) {
|
|
6491
6672
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6492
6673
|
}
|
|
6493
|
-
__name(
|
|
6674
|
+
__name(_ts_metadata35, "_ts_metadata");
|
|
6494
6675
|
function _ts_param19(paramIndex, decorator) {
|
|
6495
6676
|
return function(target, key) {
|
|
6496
6677
|
decorator(target, key, paramIndex);
|
|
6497
6678
|
};
|
|
6498
6679
|
}
|
|
6499
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");
|
|
6500
6847
|
var STATUS_ERROR_MAP = {
|
|
6501
6848
|
banned: AUTH_ERROR_CODES.ACCOUNT_BANNED,
|
|
6502
6849
|
inactive: AUTH_ERROR_CODES.ACCOUNT_INACTIVE,
|
|
@@ -6544,12 +6891,12 @@ exports.UserStatusGuard = class UserStatusGuard {
|
|
|
6544
6891
|
return true;
|
|
6545
6892
|
}
|
|
6546
6893
|
};
|
|
6547
|
-
exports.UserStatusGuard =
|
|
6894
|
+
exports.UserStatusGuard = _ts_decorate36([
|
|
6548
6895
|
common.Injectable(),
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
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", [
|
|
6553
6900
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
6554
6901
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6555
6902
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -6557,23 +6904,23 @@ exports.UserStatusGuard = _ts_decorate34([
|
|
|
6557
6904
|
], exports.UserStatusGuard);
|
|
6558
6905
|
|
|
6559
6906
|
// src/server/controllers/session.controller.ts
|
|
6560
|
-
function
|
|
6907
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
6561
6908
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6562
6909
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6563
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;
|
|
6564
6911
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6565
6912
|
}
|
|
6566
|
-
__name(
|
|
6567
|
-
function
|
|
6913
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
6914
|
+
function _ts_metadata37(k, v) {
|
|
6568
6915
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6569
6916
|
}
|
|
6570
|
-
__name(
|
|
6571
|
-
function
|
|
6917
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
6918
|
+
function _ts_param21(paramIndex, decorator) {
|
|
6572
6919
|
return function(target, key) {
|
|
6573
6920
|
decorator(target, key, paramIndex);
|
|
6574
6921
|
};
|
|
6575
6922
|
}
|
|
6576
|
-
__name(
|
|
6923
|
+
__name(_ts_param21, "_ts_param");
|
|
6577
6924
|
var SessionController = class {
|
|
6578
6925
|
static {
|
|
6579
6926
|
__name(this, "SessionController");
|
|
@@ -6650,68 +6997,68 @@ var SessionController = class {
|
|
|
6650
6997
|
await this.sessionService.revokeSession(user.sub, id);
|
|
6651
6998
|
}
|
|
6652
6999
|
};
|
|
6653
|
-
|
|
7000
|
+
_ts_decorate37([
|
|
6654
7001
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
6655
7002
|
common.Get(),
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
7003
|
+
_ts_param21(0, CurrentUser()),
|
|
7004
|
+
_ts_param21(1, common.Req()),
|
|
7005
|
+
_ts_metadata37("design:type", Function),
|
|
7006
|
+
_ts_metadata37("design:paramtypes", [
|
|
6660
7007
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6661
7008
|
typeof Request === "undefined" ? Object : Request
|
|
6662
7009
|
]),
|
|
6663
|
-
|
|
7010
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6664
7011
|
], SessionController.prototype, "listSessions", null);
|
|
6665
|
-
|
|
7012
|
+
_ts_decorate37([
|
|
6666
7013
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
6667
7014
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6668
7015
|
common.Delete("all"),
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
7016
|
+
_ts_param21(0, CurrentUser()),
|
|
7017
|
+
_ts_param21(1, common.Req()),
|
|
7018
|
+
_ts_metadata37("design:type", Function),
|
|
7019
|
+
_ts_metadata37("design:paramtypes", [
|
|
6673
7020
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6674
7021
|
typeof Request === "undefined" ? Object : Request
|
|
6675
7022
|
]),
|
|
6676
|
-
|
|
7023
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6677
7024
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
6678
|
-
|
|
7025
|
+
_ts_decorate37([
|
|
6679
7026
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
6680
7027
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6681
7028
|
common.Delete(":id"),
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
7029
|
+
_ts_param21(0, CurrentUser()),
|
|
7030
|
+
_ts_param21(1, common.Param("id")),
|
|
7031
|
+
_ts_metadata37("design:type", Function),
|
|
7032
|
+
_ts_metadata37("design:paramtypes", [
|
|
6686
7033
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
6687
7034
|
String
|
|
6688
7035
|
]),
|
|
6689
|
-
|
|
7036
|
+
_ts_metadata37("design:returntype", Promise)
|
|
6690
7037
|
], SessionController.prototype, "revokeSession", null);
|
|
6691
|
-
SessionController =
|
|
7038
|
+
SessionController = _ts_decorate37([
|
|
6692
7039
|
common.Controller("sessions"),
|
|
6693
7040
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
6694
7041
|
common.UsePipes(new common.ValidationPipe({
|
|
6695
7042
|
whitelist: true,
|
|
6696
7043
|
forbidNonWhitelisted: true
|
|
6697
7044
|
})),
|
|
6698
|
-
|
|
6699
|
-
|
|
7045
|
+
_ts_metadata37("design:type", Function),
|
|
7046
|
+
_ts_metadata37("design:paramtypes", [
|
|
6700
7047
|
typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
|
|
6701
7048
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
6702
7049
|
])
|
|
6703
7050
|
], SessionController);
|
|
6704
|
-
function
|
|
7051
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
6705
7052
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6706
7053
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6707
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;
|
|
6708
7055
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6709
7056
|
}
|
|
6710
|
-
__name(
|
|
6711
|
-
function
|
|
7057
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
7058
|
+
function _ts_metadata38(k, v) {
|
|
6712
7059
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6713
7060
|
}
|
|
6714
|
-
__name(
|
|
7061
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
6715
7062
|
exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
6716
7063
|
static {
|
|
6717
7064
|
__name(this, "MfaRequiredGuard");
|
|
@@ -6738,10 +7085,10 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
|
6738
7085
|
return true;
|
|
6739
7086
|
}
|
|
6740
7087
|
};
|
|
6741
|
-
exports.MfaRequiredGuard =
|
|
7088
|
+
exports.MfaRequiredGuard = _ts_decorate38([
|
|
6742
7089
|
common.Injectable(),
|
|
6743
|
-
|
|
6744
|
-
|
|
7090
|
+
_ts_metadata38("design:type", Function),
|
|
7091
|
+
_ts_metadata38("design:paramtypes", [
|
|
6745
7092
|
typeof core.Reflector === "undefined" ? Object : core.Reflector
|
|
6746
7093
|
])
|
|
6747
7094
|
], exports.MfaRequiredGuard);
|
|
@@ -6749,23 +7096,23 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
6749
7096
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
6750
7097
|
|
|
6751
7098
|
// src/server/guards/platform-roles.guard.ts
|
|
6752
|
-
function
|
|
7099
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
6753
7100
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6754
7101
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6755
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;
|
|
6756
7103
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6757
7104
|
}
|
|
6758
|
-
__name(
|
|
6759
|
-
function
|
|
7105
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
7106
|
+
function _ts_metadata39(k, v) {
|
|
6760
7107
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6761
7108
|
}
|
|
6762
|
-
__name(
|
|
6763
|
-
function
|
|
7109
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
7110
|
+
function _ts_param22(paramIndex, decorator) {
|
|
6764
7111
|
return function(target, key) {
|
|
6765
7112
|
decorator(target, key, paramIndex);
|
|
6766
7113
|
};
|
|
6767
7114
|
}
|
|
6768
|
-
__name(
|
|
7115
|
+
__name(_ts_param22, "_ts_param");
|
|
6769
7116
|
exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
6770
7117
|
static {
|
|
6771
7118
|
__name(this, "PlatformRolesGuard");
|
|
@@ -6799,11 +7146,11 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
|
6799
7146
|
return true;
|
|
6800
7147
|
}
|
|
6801
7148
|
};
|
|
6802
|
-
exports.PlatformRolesGuard =
|
|
7149
|
+
exports.PlatformRolesGuard = _ts_decorate39([
|
|
6803
7150
|
common.Injectable(),
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
7151
|
+
_ts_param22(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
7152
|
+
_ts_metadata39("design:type", Function),
|
|
7153
|
+
_ts_metadata39("design:paramtypes", [
|
|
6807
7154
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
6808
7155
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6809
7156
|
])
|
|
@@ -6812,23 +7159,23 @@ var ROLES_KEY = "roles";
|
|
|
6812
7159
|
var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
|
|
6813
7160
|
|
|
6814
7161
|
// src/server/guards/roles.guard.ts
|
|
6815
|
-
function
|
|
7162
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
6816
7163
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6817
7164
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6818
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;
|
|
6819
7166
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6820
7167
|
}
|
|
6821
|
-
__name(
|
|
6822
|
-
function
|
|
7168
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
7169
|
+
function _ts_metadata40(k, v) {
|
|
6823
7170
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6824
7171
|
}
|
|
6825
|
-
__name(
|
|
6826
|
-
function
|
|
7172
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
7173
|
+
function _ts_param23(paramIndex, decorator) {
|
|
6827
7174
|
return function(target, key) {
|
|
6828
7175
|
decorator(target, key, paramIndex);
|
|
6829
7176
|
};
|
|
6830
7177
|
}
|
|
6831
|
-
__name(
|
|
7178
|
+
__name(_ts_param23, "_ts_param");
|
|
6832
7179
|
exports.RolesGuard = class RolesGuard {
|
|
6833
7180
|
static {
|
|
6834
7181
|
__name(this, "RolesGuard");
|
|
@@ -6858,22 +7205,22 @@ exports.RolesGuard = class RolesGuard {
|
|
|
6858
7205
|
return true;
|
|
6859
7206
|
}
|
|
6860
7207
|
};
|
|
6861
|
-
exports.RolesGuard =
|
|
7208
|
+
exports.RolesGuard = _ts_decorate40([
|
|
6862
7209
|
common.Injectable(),
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
7210
|
+
_ts_param23(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
7211
|
+
_ts_metadata40("design:type", Function),
|
|
7212
|
+
_ts_metadata40("design:paramtypes", [
|
|
6866
7213
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
6867
7214
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
6868
7215
|
])
|
|
6869
7216
|
], exports.RolesGuard);
|
|
6870
|
-
function
|
|
7217
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
6871
7218
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6872
7219
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6873
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;
|
|
6874
7221
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6875
7222
|
}
|
|
6876
|
-
__name(
|
|
7223
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
6877
7224
|
exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
6878
7225
|
static {
|
|
6879
7226
|
__name(this, "NoOpAuthHooks");
|
|
@@ -6913,29 +7260,29 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
|
6913
7260
|
};
|
|
6914
7261
|
}
|
|
6915
7262
|
};
|
|
6916
|
-
exports.NoOpAuthHooks =
|
|
7263
|
+
exports.NoOpAuthHooks = _ts_decorate41([
|
|
6917
7264
|
common.Injectable()
|
|
6918
7265
|
], exports.NoOpAuthHooks);
|
|
6919
7266
|
|
|
6920
7267
|
// src/server/oauth/oauth.constants.ts
|
|
6921
7268
|
var OAUTH_PLUGINS = /* @__PURE__ */ Symbol("OAUTH_PLUGINS");
|
|
6922
|
-
function
|
|
7269
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
6923
7270
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6924
7271
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6925
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;
|
|
6926
7273
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6927
7274
|
}
|
|
6928
|
-
__name(
|
|
6929
|
-
function
|
|
7275
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
7276
|
+
function _ts_metadata41(k, v) {
|
|
6930
7277
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6931
7278
|
}
|
|
6932
|
-
__name(
|
|
6933
|
-
function
|
|
7279
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
7280
|
+
function _ts_param24(paramIndex, decorator) {
|
|
6934
7281
|
return function(target, key) {
|
|
6935
7282
|
decorator(target, key, paramIndex);
|
|
6936
7283
|
};
|
|
6937
7284
|
}
|
|
6938
|
-
__name(
|
|
7285
|
+
__name(_ts_param24, "_ts_param");
|
|
6939
7286
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
6940
7287
|
function isStoredOAuthState(value) {
|
|
6941
7288
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -7145,15 +7492,15 @@ exports.OAuthService = class _OAuthService {
|
|
|
7145
7492
|
return plugin;
|
|
7146
7493
|
}
|
|
7147
7494
|
};
|
|
7148
|
-
exports.OAuthService =
|
|
7495
|
+
exports.OAuthService = _ts_decorate42([
|
|
7149
7496
|
common.Injectable(),
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
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", [
|
|
7157
7504
|
Array,
|
|
7158
7505
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
7159
7506
|
Object,
|
|
@@ -7163,17 +7510,17 @@ exports.OAuthService = _ts_decorate40([
|
|
|
7163
7510
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
7164
7511
|
])
|
|
7165
7512
|
], exports.OAuthService);
|
|
7166
|
-
function
|
|
7513
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
7167
7514
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7168
7515
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7169
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;
|
|
7170
7517
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7171
7518
|
}
|
|
7172
|
-
__name(
|
|
7173
|
-
function
|
|
7519
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
7520
|
+
function _ts_metadata42(k, v) {
|
|
7174
7521
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7175
7522
|
}
|
|
7176
|
-
__name(
|
|
7523
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
7177
7524
|
var OAuthCallbackQueryDto = class {
|
|
7178
7525
|
static {
|
|
7179
7526
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -7227,59 +7574,59 @@ var OAuthCallbackQueryDto = class {
|
|
|
7227
7574
|
*/
|
|
7228
7575
|
hd;
|
|
7229
7576
|
};
|
|
7230
|
-
|
|
7577
|
+
_ts_decorate43([
|
|
7231
7578
|
classValidator.IsString(),
|
|
7232
7579
|
classValidator.IsNotEmpty(),
|
|
7233
7580
|
classValidator.MaxLength(2048),
|
|
7234
|
-
|
|
7581
|
+
_ts_metadata42("design:type", String)
|
|
7235
7582
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
7236
|
-
|
|
7583
|
+
_ts_decorate43([
|
|
7237
7584
|
classValidator.IsString(),
|
|
7238
7585
|
classValidator.IsNotEmpty(),
|
|
7239
7586
|
classValidator.MaxLength(128),
|
|
7240
|
-
|
|
7587
|
+
_ts_metadata42("design:type", String)
|
|
7241
7588
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
7242
|
-
|
|
7589
|
+
_ts_decorate43([
|
|
7243
7590
|
classValidator.IsOptional(),
|
|
7244
7591
|
classValidator.IsString(),
|
|
7245
7592
|
classValidator.MaxLength(512),
|
|
7246
|
-
|
|
7593
|
+
_ts_metadata42("design:type", String)
|
|
7247
7594
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
7248
|
-
|
|
7595
|
+
_ts_decorate43([
|
|
7249
7596
|
classValidator.IsOptional(),
|
|
7250
7597
|
classValidator.IsString(),
|
|
7251
7598
|
classValidator.MaxLength(2048),
|
|
7252
|
-
|
|
7599
|
+
_ts_metadata42("design:type", String)
|
|
7253
7600
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
7254
|
-
|
|
7601
|
+
_ts_decorate43([
|
|
7255
7602
|
classValidator.IsOptional(),
|
|
7256
7603
|
classValidator.IsString(),
|
|
7257
7604
|
classValidator.MaxLength(16),
|
|
7258
|
-
|
|
7605
|
+
_ts_metadata42("design:type", String)
|
|
7259
7606
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
7260
|
-
|
|
7607
|
+
_ts_decorate43([
|
|
7261
7608
|
classValidator.IsOptional(),
|
|
7262
7609
|
classValidator.IsString(),
|
|
7263
7610
|
classValidator.MaxLength(64),
|
|
7264
|
-
|
|
7611
|
+
_ts_metadata42("design:type", String)
|
|
7265
7612
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
7266
|
-
|
|
7613
|
+
_ts_decorate43([
|
|
7267
7614
|
classValidator.IsOptional(),
|
|
7268
7615
|
classValidator.IsString(),
|
|
7269
7616
|
classValidator.MaxLength(253),
|
|
7270
|
-
|
|
7617
|
+
_ts_metadata42("design:type", String)
|
|
7271
7618
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
7272
|
-
function
|
|
7619
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
7273
7620
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7274
7621
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7275
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;
|
|
7276
7623
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7277
7624
|
}
|
|
7278
|
-
__name(
|
|
7279
|
-
function
|
|
7625
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
7626
|
+
function _ts_metadata43(k, v) {
|
|
7280
7627
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7281
7628
|
}
|
|
7282
|
-
__name(
|
|
7629
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
7283
7630
|
var OAuthInitiateQueryDto = class {
|
|
7284
7631
|
static {
|
|
7285
7632
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -7296,31 +7643,31 @@ var OAuthInitiateQueryDto = class {
|
|
|
7296
7643
|
*/
|
|
7297
7644
|
tenantId;
|
|
7298
7645
|
};
|
|
7299
|
-
|
|
7646
|
+
_ts_decorate44([
|
|
7300
7647
|
classValidator.IsString(),
|
|
7301
7648
|
classValidator.IsNotEmpty(),
|
|
7302
7649
|
classValidator.MaxLength(128),
|
|
7303
|
-
|
|
7650
|
+
_ts_metadata43("design:type", String)
|
|
7304
7651
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
7305
7652
|
|
|
7306
7653
|
// src/server/oauth/oauth.controller.ts
|
|
7307
|
-
function
|
|
7654
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
7308
7655
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7309
7656
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7310
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;
|
|
7311
7658
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7312
7659
|
}
|
|
7313
|
-
__name(
|
|
7314
|
-
function
|
|
7660
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
7661
|
+
function _ts_metadata44(k, v) {
|
|
7315
7662
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7316
7663
|
}
|
|
7317
|
-
__name(
|
|
7318
|
-
function
|
|
7664
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
7665
|
+
function _ts_param25(paramIndex, decorator) {
|
|
7319
7666
|
return function(target, key) {
|
|
7320
7667
|
decorator(target, key, paramIndex);
|
|
7321
7668
|
};
|
|
7322
7669
|
}
|
|
7323
|
-
__name(
|
|
7670
|
+
__name(_ts_param25, "_ts_param");
|
|
7324
7671
|
var OAuthController = class {
|
|
7325
7672
|
static {
|
|
7326
7673
|
__name(this, "OAuthController");
|
|
@@ -7391,42 +7738,42 @@ var OAuthController = class {
|
|
|
7391
7738
|
return body;
|
|
7392
7739
|
}
|
|
7393
7740
|
};
|
|
7394
|
-
|
|
7741
|
+
_ts_decorate45([
|
|
7395
7742
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
7396
7743
|
common.Get(":provider"),
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7744
|
+
_ts_param25(0, common.Param("provider")),
|
|
7745
|
+
_ts_param25(1, common.Query()),
|
|
7746
|
+
_ts_param25(2, common.Res({
|
|
7400
7747
|
passthrough: true
|
|
7401
7748
|
})),
|
|
7402
|
-
|
|
7403
|
-
|
|
7749
|
+
_ts_metadata44("design:type", Function),
|
|
7750
|
+
_ts_metadata44("design:paramtypes", [
|
|
7404
7751
|
String,
|
|
7405
7752
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
7406
7753
|
typeof Response === "undefined" ? Object : Response
|
|
7407
7754
|
]),
|
|
7408
|
-
|
|
7755
|
+
_ts_metadata44("design:returntype", Promise)
|
|
7409
7756
|
], OAuthController.prototype, "initiate", null);
|
|
7410
|
-
|
|
7757
|
+
_ts_decorate45([
|
|
7411
7758
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
7412
7759
|
common.HttpCode(common.HttpStatus.OK),
|
|
7413
7760
|
common.Get(":provider/callback"),
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
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({
|
|
7418
7765
|
passthrough: true
|
|
7419
7766
|
})),
|
|
7420
|
-
|
|
7421
|
-
|
|
7767
|
+
_ts_metadata44("design:type", Function),
|
|
7768
|
+
_ts_metadata44("design:paramtypes", [
|
|
7422
7769
|
String,
|
|
7423
7770
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
7424
7771
|
typeof Request === "undefined" ? Object : Request,
|
|
7425
7772
|
typeof Response === "undefined" ? Object : Response
|
|
7426
7773
|
]),
|
|
7427
|
-
|
|
7774
|
+
_ts_metadata44("design:returntype", Promise)
|
|
7428
7775
|
], OAuthController.prototype, "callback", null);
|
|
7429
|
-
OAuthController =
|
|
7776
|
+
OAuthController = _ts_decorate45([
|
|
7430
7777
|
Public(),
|
|
7431
7778
|
SkipMfa(),
|
|
7432
7779
|
common.Controller("oauth"),
|
|
@@ -7435,9 +7782,9 @@ OAuthController = _ts_decorate43([
|
|
|
7435
7782
|
forbidNonWhitelisted: true,
|
|
7436
7783
|
forbidUnknownValues: true
|
|
7437
7784
|
})),
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7785
|
+
_ts_param25(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
7786
|
+
_ts_metadata44("design:type", Function),
|
|
7787
|
+
_ts_metadata44("design:paramtypes", [
|
|
7441
7788
|
typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
|
|
7442
7789
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
7443
7790
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -7573,13 +7920,13 @@ var GoogleOAuthPlugin = class {
|
|
|
7573
7920
|
};
|
|
7574
7921
|
|
|
7575
7922
|
// src/server/oauth/oauth.module.ts
|
|
7576
|
-
function
|
|
7923
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
7577
7924
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7578
7925
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7579
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;
|
|
7580
7927
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7581
7928
|
}
|
|
7582
|
-
__name(
|
|
7929
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
7583
7930
|
function buildOAuthPlugins(options) {
|
|
7584
7931
|
const plugins = [];
|
|
7585
7932
|
if (options.oauth?.google) {
|
|
@@ -7649,16 +7996,16 @@ var OAuthModule = class _OAuthModule {
|
|
|
7649
7996
|
};
|
|
7650
7997
|
}
|
|
7651
7998
|
};
|
|
7652
|
-
OAuthModule =
|
|
7999
|
+
OAuthModule = _ts_decorate46([
|
|
7653
8000
|
common.Module({})
|
|
7654
8001
|
], OAuthModule);
|
|
7655
|
-
function
|
|
8002
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
7656
8003
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7657
8004
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7658
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;
|
|
7659
8006
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7660
8007
|
}
|
|
7661
|
-
__name(
|
|
8008
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
7662
8009
|
exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
7663
8010
|
static {
|
|
7664
8011
|
__name(this, "NoOpEmailProvider");
|
|
@@ -7693,18 +8040,18 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
7693
8040
|
this.logger.log(`sendInvitation \u2192 ${email} (no-op)`);
|
|
7694
8041
|
}
|
|
7695
8042
|
};
|
|
7696
|
-
exports.NoOpEmailProvider =
|
|
8043
|
+
exports.NoOpEmailProvider = _ts_decorate47([
|
|
7697
8044
|
common.Injectable()
|
|
7698
8045
|
], exports.NoOpEmailProvider);
|
|
7699
8046
|
|
|
7700
8047
|
// src/server/bymax-auth.module.ts
|
|
7701
|
-
function
|
|
8048
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
7702
8049
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7703
8050
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7704
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;
|
|
7705
8052
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7706
8053
|
}
|
|
7707
|
-
__name(
|
|
8054
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
7708
8055
|
function hasProviderToken(providers, token) {
|
|
7709
8056
|
return providers.some((p) => {
|
|
7710
8057
|
if (typeof p === "function") return false;
|
|
@@ -7798,7 +8145,8 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
7798
8145
|
SessionController
|
|
7799
8146
|
] : [],
|
|
7800
8147
|
...includePlatform ? [
|
|
7801
|
-
PlatformAuthController
|
|
8148
|
+
PlatformAuthController,
|
|
8149
|
+
PlatformMfaController
|
|
7802
8150
|
] : [],
|
|
7803
8151
|
...includeOAuth ? [
|
|
7804
8152
|
OAuthController
|
|
@@ -7950,16 +8298,16 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
7950
8298
|
};
|
|
7951
8299
|
}
|
|
7952
8300
|
};
|
|
7953
|
-
exports.BymaxAuthModule =
|
|
8301
|
+
exports.BymaxAuthModule = _ts_decorate48([
|
|
7954
8302
|
common.Module({})
|
|
7955
8303
|
], exports.BymaxAuthModule);
|
|
7956
|
-
function
|
|
8304
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
7957
8305
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7958
8306
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7959
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;
|
|
7960
8308
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7961
8309
|
}
|
|
7962
|
-
__name(
|
|
8310
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
7963
8311
|
exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
|
|
7964
8312
|
static {
|
|
7965
8313
|
__name(this, "OptionalAuthGuard");
|
|
@@ -7974,26 +8322,26 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
|
|
|
7974
8322
|
return super.canActivate(context);
|
|
7975
8323
|
}
|
|
7976
8324
|
};
|
|
7977
|
-
exports.OptionalAuthGuard =
|
|
8325
|
+
exports.OptionalAuthGuard = _ts_decorate49([
|
|
7978
8326
|
common.Injectable()
|
|
7979
8327
|
], exports.OptionalAuthGuard);
|
|
7980
|
-
function
|
|
8328
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
7981
8329
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7982
8330
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7983
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;
|
|
7984
8332
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7985
8333
|
}
|
|
7986
|
-
__name(
|
|
7987
|
-
function
|
|
8334
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
8335
|
+
function _ts_metadata45(k, v) {
|
|
7988
8336
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7989
8337
|
}
|
|
7990
|
-
__name(
|
|
7991
|
-
function
|
|
8338
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
8339
|
+
function _ts_param26(paramIndex, decorator) {
|
|
7992
8340
|
return function(target, key) {
|
|
7993
8341
|
decorator(target, key, paramIndex);
|
|
7994
8342
|
};
|
|
7995
8343
|
}
|
|
7996
|
-
__name(
|
|
8344
|
+
__name(_ts_param26, "_ts_param");
|
|
7997
8345
|
exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
7998
8346
|
static {
|
|
7999
8347
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -8023,11 +8371,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
|
8023
8371
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE, common.HttpStatus.FORBIDDEN);
|
|
8024
8372
|
}
|
|
8025
8373
|
};
|
|
8026
|
-
exports.SelfOrAdminGuard =
|
|
8374
|
+
exports.SelfOrAdminGuard = _ts_decorate50([
|
|
8027
8375
|
common.Injectable(),
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8376
|
+
_ts_param26(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
8377
|
+
_ts_metadata45("design:type", Function),
|
|
8378
|
+
_ts_metadata45("design:paramtypes", [
|
|
8031
8379
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
8032
8380
|
])
|
|
8033
8381
|
], exports.SelfOrAdminGuard);
|
|
@@ -8040,23 +8388,23 @@ function isHexLooking(value) {
|
|
|
8040
8388
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
8041
8389
|
}
|
|
8042
8390
|
__name(isHexLooking, "isHexLooking");
|
|
8043
|
-
function
|
|
8391
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
8044
8392
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8045
8393
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8046
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;
|
|
8047
8395
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8048
8396
|
}
|
|
8049
|
-
__name(
|
|
8050
|
-
function
|
|
8397
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
8398
|
+
function _ts_metadata46(k, v) {
|
|
8051
8399
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8052
8400
|
}
|
|
8053
|
-
__name(
|
|
8054
|
-
function
|
|
8401
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
8402
|
+
function _ts_param27(paramIndex, decorator) {
|
|
8055
8403
|
return function(target, key) {
|
|
8056
8404
|
decorator(target, key, paramIndex);
|
|
8057
8405
|
};
|
|
8058
8406
|
}
|
|
8059
|
-
__name(
|
|
8407
|
+
__name(_ts_param27, "_ts_param");
|
|
8060
8408
|
exports.WsJwtGuard = class WsJwtGuard {
|
|
8061
8409
|
static {
|
|
8062
8410
|
__name(this, "WsJwtGuard");
|
|
@@ -8105,11 +8453,11 @@ exports.WsJwtGuard = class WsJwtGuard {
|
|
|
8105
8453
|
return true;
|
|
8106
8454
|
}
|
|
8107
8455
|
};
|
|
8108
|
-
exports.WsJwtGuard =
|
|
8456
|
+
exports.WsJwtGuard = _ts_decorate51([
|
|
8109
8457
|
common.Injectable(),
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8458
|
+
_ts_param27(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
8459
|
+
_ts_metadata46("design:type", Function),
|
|
8460
|
+
_ts_metadata46("design:paramtypes", [
|
|
8113
8461
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
8114
8462
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
8115
8463
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -8134,6 +8482,7 @@ exports.IS_PUBLIC_KEY = IS_PUBLIC_KEY;
|
|
|
8134
8482
|
exports.LoginDto = LoginDto;
|
|
8135
8483
|
exports.MfaChallengeDto = MfaChallengeDto;
|
|
8136
8484
|
exports.MfaDisableDto = MfaDisableDto;
|
|
8485
|
+
exports.MfaRegenerateRecoveryCodesDto = MfaRegenerateRecoveryCodesDto;
|
|
8137
8486
|
exports.MfaVerifyDto = MfaVerifyDto;
|
|
8138
8487
|
exports.PLATFORM_ROLES_KEY = PLATFORM_ROLES_KEY;
|
|
8139
8488
|
exports.PlatformLoginDto = PlatformLoginDto;
|