@bymax-one/nest-auth 1.4.21 → 1.4.22
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 +30 -1
- package/dist/server/index.cjs +1541 -1155
- package/dist/server/index.d.cts +354 -97
- package/dist/server/index.d.ts +354 -97
- package/dist/server/index.mjs +1541 -1155
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -10066,6 +10066,9 @@ MfaFlowLockoutService = _ts_decorate37([
|
|
|
10066
10066
|
])
|
|
10067
10067
|
], MfaFlowLockoutService);
|
|
10068
10068
|
|
|
10069
|
+
// src/server/utils/mfa-log-context.ts
|
|
10070
|
+
var MFA_LOG_CONTEXT = "MfaService";
|
|
10071
|
+
|
|
10069
10072
|
// src/server/utils/mfa-plane-tenant.ts
|
|
10070
10073
|
var PLANE_TENANT_MESSAGE = "tenantId must be a non-empty value on the dashboard plane and absent on the platform plane";
|
|
10071
10074
|
function assertDashboardTenant(tenantId) {
|
|
@@ -10220,7 +10223,7 @@ var RELEASE_LOCK_LUA = `if redis.call('GET', KEYS[1]) == ARGV[1] then
|
|
|
10220
10223
|
return redis.call('DEL', KEYS[1])
|
|
10221
10224
|
end
|
|
10222
10225
|
return 0`;
|
|
10223
|
-
var MfaRecordService = class
|
|
10226
|
+
var MfaRecordService = class {
|
|
10224
10227
|
static {
|
|
10225
10228
|
__name(this, "MfaRecordService");
|
|
10226
10229
|
}
|
|
@@ -10228,7 +10231,7 @@ var MfaRecordService = class _MfaRecordService {
|
|
|
10228
10231
|
userRepo;
|
|
10229
10232
|
platformUserRepo;
|
|
10230
10233
|
redis;
|
|
10231
|
-
logger = new common.Logger(
|
|
10234
|
+
logger = new common.Logger(MFA_LOG_CONTEXT);
|
|
10232
10235
|
constructor(options, userRepo, platformUserRepo, redis) {
|
|
10233
10236
|
this.options = options;
|
|
10234
10237
|
this.userRepo = userRepo;
|
|
@@ -10473,107 +10476,7 @@ MfaRecordService = _ts_decorate38([
|
|
|
10473
10476
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
10474
10477
|
])
|
|
10475
10478
|
], MfaRecordService);
|
|
10476
|
-
|
|
10477
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10478
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10479
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
10480
|
-
} else {
|
|
10481
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10482
|
-
if (d = decorators[i]) {
|
|
10483
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10484
|
-
}
|
|
10485
|
-
}
|
|
10486
|
-
}
|
|
10487
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10488
|
-
}
|
|
10489
|
-
__name(_ts_decorate39, "_ts_decorate");
|
|
10490
|
-
function _ts_metadata38(metadataKey, metadataValue) {
|
|
10491
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10492
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
10493
|
-
}
|
|
10494
|
-
}
|
|
10495
|
-
__name(_ts_metadata38, "_ts_metadata");
|
|
10496
|
-
function _ts_param23(paramIndex, decorator) {
|
|
10497
|
-
return function(target, key) {
|
|
10498
|
-
decorator(target, key, paramIndex);
|
|
10499
|
-
};
|
|
10500
|
-
}
|
|
10501
|
-
__name(_ts_param23, "_ts_param");
|
|
10502
|
-
exports.ReauthenticationService = class _ReauthenticationService {
|
|
10503
|
-
static {
|
|
10504
|
-
__name(this, "ReauthenticationService");
|
|
10505
|
-
}
|
|
10506
|
-
options;
|
|
10507
|
-
redis;
|
|
10508
|
-
passwordService;
|
|
10509
|
-
lockout;
|
|
10510
|
-
logger = new common.Logger(_ReauthenticationService.name);
|
|
10511
|
-
constructor(options, redis, passwordService, lockout) {
|
|
10512
|
-
this.options = options;
|
|
10513
|
-
this.redis = redis;
|
|
10514
|
-
this.passwordService = passwordService;
|
|
10515
|
-
this.lockout = lockout;
|
|
10516
|
-
}
|
|
10517
|
-
/**
|
|
10518
|
-
* Requires the caller to re-prove the account password before a factor is changed.
|
|
10519
|
-
*
|
|
10520
|
-
* Counted like a login, and for the same reason. `login` refuses an account after N wrong
|
|
10521
|
-
* passwords, and this door asks for the same secret, so it carries the same lockout: without
|
|
10522
|
-
* one, a caller holding a stolen access token but not the password could guess it here
|
|
10523
|
-
* indefinitely, bounded only by the per-route IP limit, which a distributed caller sidesteps.
|
|
10524
|
-
* Winning the guess buys the whole account: enrol a factor, change the password, move the
|
|
10525
|
-
* address.
|
|
10526
|
-
*
|
|
10527
|
-
* The identifier is namespaced by flow and by plane. Sharing one counter with `login` would
|
|
10528
|
-
* let an authenticated caller lock the owner out of their own sign-in, and sharing it across
|
|
10529
|
-
* planes would let a dashboard user and a platform admin holding the same id exhaust each
|
|
10530
|
-
* other's budget — the same two reasons the challenge and disable counters are split.
|
|
10531
|
-
*
|
|
10532
|
-
* @param context - The authentication plane, part of the counter's key.
|
|
10533
|
-
* @param userId - The account being changed, part of the counter's key.
|
|
10534
|
-
* @param passwordHash - The account's stored hash, or `null` for an OAuth-only account.
|
|
10535
|
-
* @param password - The password the caller submitted, if any.
|
|
10536
|
-
* @throws {@link AuthException} `ACCOUNT_LOCKED` once the failure budget for this flow is
|
|
10537
|
-
* spent, or `INVALID_CREDENTIALS` when the account has a password and the submitted one is
|
|
10538
|
-
* absent or wrong. The latter is deliberately the same code a failed login returns: an
|
|
10539
|
-
* attacker holding a stolen token learns nothing from it that a failed login does not tell them.
|
|
10540
|
-
*/
|
|
10541
|
-
async assertReauthenticated(context, userId, passwordHash, password, tenantId) {
|
|
10542
|
-
if (passwordHash === null) {
|
|
10543
|
-
const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey, tenantId));
|
|
10544
|
-
if (recent === null) {
|
|
10545
|
-
this.logger.warn(`reauthenticate: no recent authentication userId=${logSafe(userId)} context=${context}`);
|
|
10546
|
-
throw new AuthException(AUTH_ERROR_CODES.REAUTHENTICATION_REQUIRED);
|
|
10547
|
-
}
|
|
10548
|
-
return;
|
|
10549
|
-
}
|
|
10550
|
-
if (await this.lockout.isLockedOut("reauth", context, userId, tenantId)) {
|
|
10551
|
-
this.logger.warn(`reauthenticate: account locked userId=${logSafe(userId)} context=${context}`);
|
|
10552
|
-
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
10553
|
-
}
|
|
10554
|
-
const supplied = password ?? "";
|
|
10555
|
-
const matches = await this.passwordService.compare(supplied, passwordHash);
|
|
10556
|
-
if (!matches) {
|
|
10557
|
-
await this.lockout.recordFailure("reauth", context, userId, tenantId);
|
|
10558
|
-
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
10559
|
-
}
|
|
10560
|
-
await this.lockout.reset("reauth", context, userId, tenantId);
|
|
10561
|
-
}
|
|
10562
|
-
};
|
|
10563
|
-
exports.ReauthenticationService = _ts_decorate39([
|
|
10564
|
-
common.Injectable(),
|
|
10565
|
-
_ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10566
|
-
_ts_param23(1, common.Inject(AuthRedisService)),
|
|
10567
|
-
_ts_param23(2, common.Inject(PasswordService)),
|
|
10568
|
-
_ts_param23(3, common.Inject(MfaFlowLockoutService)),
|
|
10569
|
-
_ts_metadata38("design:type", Function),
|
|
10570
|
-
_ts_metadata38("design:paramtypes", [
|
|
10571
|
-
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
10572
|
-
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
10573
|
-
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
10574
|
-
typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService
|
|
10575
|
-
])
|
|
10576
|
-
], exports.ReauthenticationService);
|
|
10479
|
+
var DEFAULT_RECOVERY_CODE_COUNT = 8;
|
|
10577
10480
|
function digestRecoveryCode(code, hmacKey) {
|
|
10578
10481
|
return hmacSha256(code, hmacKey);
|
|
10579
10482
|
}
|
|
@@ -10640,43 +10543,6 @@ function committedSafeUser(context, user, mfaEnabled) {
|
|
|
10640
10543
|
}
|
|
10641
10544
|
__name(committedSafeUser, "committedSafeUser");
|
|
10642
10545
|
|
|
10643
|
-
// src/server/utils/mfa-setup-data.ts
|
|
10644
|
-
function isMfaSetupData(value) {
|
|
10645
|
-
if (value === null) return false;
|
|
10646
|
-
if (typeof value !== "object") return false;
|
|
10647
|
-
const v = value;
|
|
10648
|
-
return typeof v["encryptedSecret"] === "string" && typeof v["encryptedPlainCodes"] === "string" && Array.isArray(v["hashedCodes"]) && v["hashedCodes"].every((code) => typeof code === "string");
|
|
10649
|
-
}
|
|
10650
|
-
__name(isMfaSetupData, "isMfaSetupData");
|
|
10651
|
-
function parseSetupData(raw, userId, logger) {
|
|
10652
|
-
let parsed;
|
|
10653
|
-
try {
|
|
10654
|
-
parsed = JSON.parse(raw);
|
|
10655
|
-
} catch {
|
|
10656
|
-
logger.warn(`parseSetupData: pending-setup payload is not valid JSON userId=${logSafe(userId)}`);
|
|
10657
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10658
|
-
}
|
|
10659
|
-
if (!isMfaSetupData(parsed)) {
|
|
10660
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10661
|
-
}
|
|
10662
|
-
return parsed;
|
|
10663
|
-
}
|
|
10664
|
-
__name(parseSetupData, "parseSetupData");
|
|
10665
|
-
function parsePlainRecoveryCodes(raw, userId, logger) {
|
|
10666
|
-
let parsed;
|
|
10667
|
-
try {
|
|
10668
|
-
parsed = JSON.parse(raw);
|
|
10669
|
-
} catch {
|
|
10670
|
-
logger.warn(`parsePlainRecoveryCodes: decrypted payload is not valid JSON userId=${logSafe(userId)}`);
|
|
10671
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10672
|
-
}
|
|
10673
|
-
if (!Array.isArray(parsed) || parsed.some((code) => typeof code !== "string")) {
|
|
10674
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10675
|
-
}
|
|
10676
|
-
return parsed;
|
|
10677
|
-
}
|
|
10678
|
-
__name(parsePlainRecoveryCodes, "parsePlainRecoveryCodes");
|
|
10679
|
-
|
|
10680
10546
|
// src/server/utils/run-detached.ts
|
|
10681
10547
|
function runDetached(logger, run, failure) {
|
|
10682
10548
|
try {
|
|
@@ -10689,8 +10555,8 @@ function runDetached(logger, run, failure) {
|
|
|
10689
10555
|
}
|
|
10690
10556
|
__name(runDetached, "runDetached");
|
|
10691
10557
|
|
|
10692
|
-
// src/server/services/mfa.service.ts
|
|
10693
|
-
function
|
|
10558
|
+
// src/server/services/mfa-challenge.service.ts
|
|
10559
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
10694
10560
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10695
10561
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10696
10562
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -10703,112 +10569,948 @@ function _ts_decorate40(decorators, target, key, desc) {
|
|
|
10703
10569
|
}
|
|
10704
10570
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10705
10571
|
}
|
|
10706
|
-
__name(
|
|
10707
|
-
function
|
|
10572
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
10573
|
+
function _ts_metadata38(metadataKey, metadataValue) {
|
|
10708
10574
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10709
10575
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
10710
10576
|
}
|
|
10711
10577
|
}
|
|
10712
|
-
__name(
|
|
10713
|
-
function
|
|
10578
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
10579
|
+
function _ts_param23(paramIndex, decorator) {
|
|
10714
10580
|
return function(target, key) {
|
|
10715
10581
|
decorator(target, key, paramIndex);
|
|
10716
10582
|
};
|
|
10717
10583
|
}
|
|
10718
|
-
__name(
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10584
|
+
__name(_ts_param23, "_ts_param");
|
|
10585
|
+
function spliceSpentCode(current, existingCodes, recoveryIndex, opened, mfa) {
|
|
10586
|
+
if (!current.mfaEnabled) return null;
|
|
10587
|
+
if (!holdsSecret(current.mfaSecret, opened.secret, mfa)) return null;
|
|
10588
|
+
const currentCodes = current.mfaRecoveryCodes ?? [];
|
|
10589
|
+
const spentDigest = existingCodes[recoveryIndex] ?? "";
|
|
10590
|
+
const liveIndex = currentCodes.indexOf(spentDigest);
|
|
10591
|
+
if (liveIndex < 0) return null;
|
|
10592
|
+
const updatedCodes = [
|
|
10593
|
+
...currentCodes
|
|
10594
|
+
];
|
|
10595
|
+
updatedCodes.splice(liveIndex, 1);
|
|
10596
|
+
return {
|
|
10597
|
+
mfaEnabled: true,
|
|
10598
|
+
mfaSecret: opened.stale ? encryptMfaSecret(opened.secret, mfa) : current.mfaSecret,
|
|
10599
|
+
mfaRecoveryCodes: updatedCodes
|
|
10600
|
+
};
|
|
10722
10601
|
}
|
|
10723
|
-
__name(
|
|
10724
|
-
var
|
|
10725
|
-
var DEFAULT_RECOVERY_CODE_COUNT = 8;
|
|
10726
|
-
exports.MfaService = class _MfaService {
|
|
10602
|
+
__name(spliceSpentCode, "spliceSpentCode");
|
|
10603
|
+
var MfaChallengeService = class {
|
|
10727
10604
|
static {
|
|
10728
|
-
__name(this, "
|
|
10605
|
+
__name(this, "MfaChallengeService");
|
|
10729
10606
|
}
|
|
10730
10607
|
options;
|
|
10731
10608
|
userRepo;
|
|
10732
10609
|
platformUserRepo;
|
|
10733
|
-
redis;
|
|
10734
10610
|
tokenManager;
|
|
10735
|
-
records;
|
|
10736
10611
|
flowLockout;
|
|
10737
|
-
|
|
10612
|
+
records;
|
|
10738
10613
|
sessionService;
|
|
10739
|
-
emailProvider;
|
|
10740
10614
|
hooks;
|
|
10741
|
-
logger = new common.Logger(
|
|
10742
|
-
constructor(options, userRepo, platformUserRepo,
|
|
10615
|
+
logger = new common.Logger(MFA_LOG_CONTEXT);
|
|
10616
|
+
constructor(options, userRepo, platformUserRepo, tokenManager, flowLockout, records, sessionService, hooks) {
|
|
10743
10617
|
this.options = options;
|
|
10744
10618
|
this.userRepo = userRepo;
|
|
10745
10619
|
this.platformUserRepo = platformUserRepo;
|
|
10746
|
-
this.redis = redis;
|
|
10747
10620
|
this.tokenManager = tokenManager;
|
|
10748
|
-
this.records = records;
|
|
10749
10621
|
this.flowLockout = flowLockout;
|
|
10750
|
-
this.
|
|
10622
|
+
this.records = records;
|
|
10751
10623
|
this.sessionService = sessionService;
|
|
10752
|
-
this.emailProvider = emailProvider;
|
|
10753
10624
|
this.hooks = hooks;
|
|
10754
10625
|
}
|
|
10755
|
-
// ---------------------------------------------------------------------------
|
|
10756
|
-
// Private accessor — options.mfa is guaranteed non-null when service is active
|
|
10757
|
-
// ---------------------------------------------------------------------------
|
|
10758
10626
|
/**
|
|
10759
|
-
*
|
|
10627
|
+
* Validates a TOTP or recovery code and exchanges the MFA temp token for full
|
|
10628
|
+
* access tokens.
|
|
10760
10629
|
*
|
|
10761
|
-
* `
|
|
10762
|
-
*
|
|
10763
|
-
*
|
|
10630
|
+
* Handles both `'dashboard'` and `'platform'` contexts. Applies brute-force
|
|
10631
|
+
* protection per-user. TOTP codes include anti-replay protection via a short-lived
|
|
10632
|
+
* Redis key keyed on an HMAC of the code and user ID.
|
|
10633
|
+
*
|
|
10634
|
+
* The order is part of the contract: the temp token is verified but NOT consumed until the code
|
|
10635
|
+
* passes, so a mistyped digit is retryable (`MFA_INVALID_CODE`) rather than a dead end
|
|
10636
|
+
* (`MFA_TEMP_TOKEN_INVALID`); the lockout counter caps how many wrong codes one token can try;
|
|
10637
|
+
* and the consume must win before a session is issued.
|
|
10638
|
+
*
|
|
10639
|
+
* @param mfaTempToken - Short-lived MFA challenge JWT issued at login.
|
|
10640
|
+
* @param code - 6-digit TOTP code or `dddd-dddd-dddd` recovery code.
|
|
10641
|
+
* @param ip - Client IP address for session audit.
|
|
10642
|
+
* @param userAgent - User-Agent header for session description.
|
|
10643
|
+
* @param mfa - The resolved MFA configuration (cipher keys and TOTP window).
|
|
10644
|
+
* @returns `AuthResult` for dashboard context, `PlatformAuthResult` for platform context.
|
|
10645
|
+
* @throws `MFA_TEMP_TOKEN_INVALID` if the token is invalid or already consumed.
|
|
10646
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
10647
|
+
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
10764
10648
|
*/
|
|
10765
|
-
|
|
10766
|
-
|
|
10649
|
+
async challenge(mfaTempToken, code, ip, userAgent, mfa) {
|
|
10650
|
+
const { userId, context, tenantId, jti: tempTokenJti } = await this.tokenManager.verifyMfaTempToken(mfaTempToken);
|
|
10651
|
+
const scope = {
|
|
10652
|
+
userId,
|
|
10653
|
+
context,
|
|
10654
|
+
tenantId
|
|
10655
|
+
};
|
|
10656
|
+
await this.assertNotLocked(scope);
|
|
10657
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10658
|
+
if (!user.mfaEnabled || !user.mfaSecret) {
|
|
10659
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10660
|
+
}
|
|
10661
|
+
const opened = decryptWithRotation(user.mfaSecret, mfa);
|
|
10662
|
+
const { valid, recoveryIndex } = await this.checkCode(user, scope, opened.secret, code, mfa);
|
|
10663
|
+
if (!valid) await this.refuseWrongCode(scope);
|
|
10664
|
+
await this.flowLockout.reset("challenge", context, userId, tenantId);
|
|
10665
|
+
if (!await this.tokenManager.consumeMfaTempToken(tempTokenJti)) {
|
|
10666
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
|
|
10667
|
+
}
|
|
10668
|
+
await this.settleRecovery(user, scope, opened, recoveryIndex, mfa);
|
|
10669
|
+
this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
|
|
10670
|
+
return context === "dashboard" ? this.issueDashboardSession(user, userId, ip, userAgent) : this.issuePlatformSession(user, userId, ip, userAgent);
|
|
10767
10671
|
}
|
|
10768
|
-
// ---------------------------------------------------------------------------
|
|
10769
|
-
// Private crypto helpers
|
|
10770
|
-
// ---------------------------------------------------------------------------
|
|
10771
|
-
// ---------------------------------------------------------------------------
|
|
10772
|
-
// setup — TOTP secret generation, idempotent key reservation, recovery codes
|
|
10773
|
-
// ---------------------------------------------------------------------------
|
|
10774
10672
|
/**
|
|
10775
|
-
*
|
|
10776
|
-
*
|
|
10777
|
-
* Generates a TOTP secret and 8 recovery codes, stores them temporarily in
|
|
10778
|
-
* Redis (10 minutes), and returns the data needed to display the QR code and
|
|
10779
|
-
* recovery codes to the user.
|
|
10673
|
+
* Refuses a challenge for an account at its failure ceiling.
|
|
10780
10674
|
*
|
|
10781
|
-
*
|
|
10782
|
-
*
|
|
10783
|
-
*
|
|
10675
|
+
* The 'challenge' counter is namespaced away from 'disable', so a pre-auth attacker holding only
|
|
10676
|
+
* a temp token cannot lock the user out of `disable()`, and away from the other identity plane,
|
|
10677
|
+
* whose id space may collide.
|
|
10784
10678
|
*
|
|
10785
|
-
* @param
|
|
10786
|
-
* @
|
|
10787
|
-
* @returns Setup result containing the secret, QR URI, and plain recovery codes.
|
|
10788
|
-
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
10789
|
-
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
10790
|
-
* repository was not configured at module registration. The error code is
|
|
10791
|
-
* reused (rather than introducing a new one) because the consumer-facing
|
|
10792
|
-
* meaning is the same: "platform MFA cannot operate".
|
|
10679
|
+
* @param scope - The plane, account and tenant the challenge belongs to.
|
|
10680
|
+
* @throws {@link AuthException} `ACCOUNT_LOCKED` at the ceiling.
|
|
10793
10681
|
*/
|
|
10794
|
-
async
|
|
10795
|
-
|
|
10796
|
-
if (
|
|
10797
|
-
|
|
10682
|
+
async assertNotLocked(scope) {
|
|
10683
|
+
const { userId, context, tenantId } = scope;
|
|
10684
|
+
if (await this.flowLockout.isLockedOut("challenge", context, userId, tenantId)) {
|
|
10685
|
+
this.logger.warn(`challenge: account locked userId=${logSafe(userId)}`);
|
|
10686
|
+
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
10798
10687
|
}
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10688
|
+
}
|
|
10689
|
+
/**
|
|
10690
|
+
* Counts a wrong code and refuses it. The temp token stays alive: the user can retry under it
|
|
10691
|
+
* until the lockout surfaces `ACCOUNT_LOCKED`.
|
|
10692
|
+
*
|
|
10693
|
+
* @param scope - The plane, account and tenant the challenge belongs to.
|
|
10694
|
+
* @throws {@link AuthException} `MFA_INVALID_CODE`, always.
|
|
10695
|
+
*/
|
|
10696
|
+
async refuseWrongCode(scope) {
|
|
10697
|
+
const { userId, context, tenantId } = scope;
|
|
10698
|
+
await this.flowLockout.recordFailure("challenge", context, userId, tenantId);
|
|
10699
|
+
this.logger.warn(`challenge: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
10700
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
10701
|
+
}
|
|
10702
|
+
/**
|
|
10703
|
+
* Validates the submitted code against the account: a six-digit TOTP code with anti-replay, or a
|
|
10704
|
+
* recovery code compared in constant time and then claimed for exactly one challenge.
|
|
10705
|
+
*
|
|
10706
|
+
* @param user - The account, holding the stored recovery-code digests.
|
|
10707
|
+
* @param scope - The plane, account and tenant the challenge belongs to.
|
|
10708
|
+
* @param secretBase32 - The decrypted TOTP secret.
|
|
10709
|
+
* @param code - The submitted code.
|
|
10710
|
+
* @param mfa - The resolved MFA configuration.
|
|
10711
|
+
* @returns Whether the code is valid, and the index of the matched recovery digest (`-1` for
|
|
10712
|
+
* TOTP and for a recovery code that matched nothing).
|
|
10713
|
+
*/
|
|
10714
|
+
async checkCode(user, scope, secretBase32, code, mfa) {
|
|
10715
|
+
const { userId, context, tenantId } = scope;
|
|
10716
|
+
if (/^\d{6}$/.test(code)) {
|
|
10717
|
+
const valid2 = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, mfa.totpWindow, tenantId);
|
|
10810
10718
|
return {
|
|
10811
|
-
|
|
10719
|
+
valid: valid2,
|
|
10720
|
+
recoveryIndex: -1
|
|
10721
|
+
};
|
|
10722
|
+
}
|
|
10723
|
+
const recoveryCodes = user.mfaRecoveryCodes ?? [];
|
|
10724
|
+
const recoveryIndex = await verifyRecoveryCode(code, recoveryCodes, this.options.hmacKey, this.options.previousHmacKeys);
|
|
10725
|
+
const valid = recoveryIndex >= 0 && await this.records.claimRecoveryCode(context, userId, code, tenantId);
|
|
10726
|
+
return {
|
|
10727
|
+
valid,
|
|
10728
|
+
recoveryIndex
|
|
10729
|
+
};
|
|
10730
|
+
}
|
|
10731
|
+
/**
|
|
10732
|
+
* Spends the recovery code a challenge used, or migrates the secret to the current key.
|
|
10733
|
+
*
|
|
10734
|
+
* A recovery challenge removes the matched digest in a serialized transition, spliced against
|
|
10735
|
+
* the record as it stands INSIDE the lock rather than the copy read earlier: splicing the stale
|
|
10736
|
+
* copy would roll a concurrent `regenerateRecoveryCodes` back wholesale and undo a completed
|
|
10737
|
+
* `disable` — see `MfaRecordService.transition`. A TOTP challenge writes nothing on its own, so
|
|
10738
|
+
* a secret that opened under a retired key is re-encrypted by a detached write: the challenge
|
|
10739
|
+
* has already succeeded and the retired key still opens the secret, so a failure costs the
|
|
10740
|
+
* migration and nothing else.
|
|
10741
|
+
*
|
|
10742
|
+
* @param user - The account as read at the start of the challenge.
|
|
10743
|
+
* @param scope - The plane, account and tenant the challenge belongs to.
|
|
10744
|
+
* @param opened - The decrypted secret, and whether it opened under a retired key.
|
|
10745
|
+
* @param recoveryIndex - Index of the spent recovery digest, or `-1` after a TOTP challenge.
|
|
10746
|
+
* @param mfa - The resolved MFA configuration.
|
|
10747
|
+
*/
|
|
10748
|
+
async settleRecovery(user, scope, opened, recoveryIndex, mfa) {
|
|
10749
|
+
const { userId, context, tenantId } = scope;
|
|
10750
|
+
if (recoveryIndex < 0) {
|
|
10751
|
+
if (opened.stale) {
|
|
10752
|
+
void this.records.reencryptSecret(userId, context, opened.secret, tenantId, mfa);
|
|
10753
|
+
}
|
|
10754
|
+
return;
|
|
10755
|
+
}
|
|
10756
|
+
const existingCodes = user.mfaRecoveryCodes ?? /* istanbul ignore next -- verifyRecoveryCode returns ≥0 only after iterating a non-null array */
|
|
10757
|
+
// Stryker disable next-line ArrayDeclaration: unreachable — this branch is only taken
|
|
10758
|
+
// when `verifyRecoveryCode` matched a code inside an array it had to iterate first.
|
|
10759
|
+
[];
|
|
10760
|
+
await this.records.transition(context, userId, tenantId, (current) => spliceSpentCode(current, existingCodes, recoveryIndex, opened, mfa));
|
|
10761
|
+
}
|
|
10762
|
+
/**
|
|
10763
|
+
* Issues the dashboard session for a challenge that passed.
|
|
10764
|
+
*
|
|
10765
|
+
* @param user - The dashboard account.
|
|
10766
|
+
* @param userId - The account id from the temp token, for the hook context.
|
|
10767
|
+
* @param ip - Client IP address for session audit.
|
|
10768
|
+
* @param userAgent - User-Agent header for session description.
|
|
10769
|
+
* @returns The dashboard auth result.
|
|
10770
|
+
*/
|
|
10771
|
+
async issueDashboardSession(user, userId, ip, userAgent) {
|
|
10772
|
+
const safeUser = toSafeUser3(user);
|
|
10773
|
+
const result = await this.tokenManager.issueTokens(safeUser, ip, userAgent, {
|
|
10774
|
+
mfaVerified: true
|
|
10775
|
+
});
|
|
10776
|
+
if (this.options.sessions.enabled) {
|
|
10777
|
+
await this.sessionService.createSession({
|
|
10778
|
+
userId: safeUser.id,
|
|
10779
|
+
tenantId: safeUser.tenantId,
|
|
10780
|
+
rawRefreshToken: result.rawRefreshToken,
|
|
10781
|
+
ip,
|
|
10782
|
+
userAgent
|
|
10783
|
+
});
|
|
10784
|
+
}
|
|
10785
|
+
runDetached(this.logger, () => this.userRepo.updateLastLogin({
|
|
10786
|
+
id: safeUser.id,
|
|
10787
|
+
tenantId: safeUser.tenantId
|
|
10788
|
+
}), "challenge: updateLastLogin failed");
|
|
10789
|
+
if (this.hooks.afterLogin) {
|
|
10790
|
+
const afterLogin = this.hooks.afterLogin.bind(this.hooks);
|
|
10791
|
+
runDetached(this.logger, () => afterLogin(safeUser, {
|
|
10792
|
+
plane: "dashboard",
|
|
10793
|
+
userId,
|
|
10794
|
+
ip,
|
|
10795
|
+
userAgent,
|
|
10796
|
+
sanitizedHeaders: {}
|
|
10797
|
+
}), "challenge: afterLogin hook threw");
|
|
10798
|
+
}
|
|
10799
|
+
return result;
|
|
10800
|
+
}
|
|
10801
|
+
/**
|
|
10802
|
+
* Issues the platform session for a challenge that passed, reusing the account already fetched
|
|
10803
|
+
* to avoid a TOCTOU double-read. The platform repository's presence was validated by
|
|
10804
|
+
* `MfaRecordService.loadAccount`, so the cast below is safe.
|
|
10805
|
+
*
|
|
10806
|
+
* @param platformUser - The platform administrator.
|
|
10807
|
+
* @param userId - The account id from the temp token, for the hook context.
|
|
10808
|
+
* @param ip - Client IP address for session audit.
|
|
10809
|
+
* @param userAgent - User-Agent header for session description.
|
|
10810
|
+
* @returns The platform auth result.
|
|
10811
|
+
*/
|
|
10812
|
+
async issuePlatformSession(platformUser, userId, ip, userAgent) {
|
|
10813
|
+
const result = await this.tokenManager.issuePlatformTokens(toSafePlatformUser(platformUser), ip, userAgent, {
|
|
10814
|
+
mfaVerified: true
|
|
10815
|
+
});
|
|
10816
|
+
runDetached(this.logger, () => this.platformUserRepo.updateLastLogin(platformUser.id), "challenge: platform updateLastLogin failed");
|
|
10817
|
+
if (this.hooks.afterLogin) {
|
|
10818
|
+
const afterLogin = this.hooks.afterLogin.bind(this.hooks);
|
|
10819
|
+
runDetached(this.logger, () => afterLogin(platformUserAsSafeUser(platformUser), {
|
|
10820
|
+
plane: "platform",
|
|
10821
|
+
userId,
|
|
10822
|
+
ip,
|
|
10823
|
+
userAgent,
|
|
10824
|
+
sanitizedHeaders: {}
|
|
10825
|
+
}), "challenge: afterLogin hook threw");
|
|
10826
|
+
}
|
|
10827
|
+
return result;
|
|
10828
|
+
}
|
|
10829
|
+
/**
|
|
10830
|
+
* The challenge for an entry point that serves the platform plane only.
|
|
10831
|
+
*
|
|
10832
|
+
* Reads the plane from the temp token first and refuses a dashboard token with
|
|
10833
|
+
* `PLATFORM_AUTH_REQUIRED` before anything is spent. {@link MfaChallengeService.challenge} consumes the
|
|
10834
|
+
* token, burns the TOTP code, stores a session, stamps the last login and fires the hooks, so
|
|
10835
|
+
* refusing after it leaves an orphan session nobody holds a token for. The first verification only
|
|
10836
|
+
* reads: it touches neither the brute-force counter nor the TOTP anti-replay key. The challenge
|
|
10837
|
+
* verifies the token again, and the plane is a signed claim, so both reads see the same one.
|
|
10838
|
+
*
|
|
10839
|
+
* @param mfaTempToken - Short-lived MFA challenge JWT issued at platform login.
|
|
10840
|
+
* @param code - 6-digit TOTP code or `dddd-dddd-dddd` recovery code.
|
|
10841
|
+
* @param ip - Client IP address for session audit.
|
|
10842
|
+
* @param userAgent - User-Agent header for session description.
|
|
10843
|
+
* @param mfa - The resolved MFA configuration (cipher keys and TOTP window).
|
|
10844
|
+
* @returns The platform auth result.
|
|
10845
|
+
* @throws `PLATFORM_AUTH_REQUIRED` if the token is for the dashboard plane.
|
|
10846
|
+
* @throws `MFA_TEMP_TOKEN_INVALID` if the token is invalid or already consumed.
|
|
10847
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
10848
|
+
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
10849
|
+
*/
|
|
10850
|
+
async challengePlatformOnly(mfaTempToken, code, ip, userAgent, mfa) {
|
|
10851
|
+
const { context } = await this.tokenManager.verifyMfaTempToken(mfaTempToken);
|
|
10852
|
+
if (context !== "platform") {
|
|
10853
|
+
throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
|
|
10854
|
+
}
|
|
10855
|
+
const result = await this.challenge(mfaTempToken, code, ip, userAgent, mfa);
|
|
10856
|
+
if (!("admin" in result)) {
|
|
10857
|
+
throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
|
|
10858
|
+
}
|
|
10859
|
+
return result;
|
|
10860
|
+
}
|
|
10861
|
+
};
|
|
10862
|
+
MfaChallengeService = _ts_decorate39([
|
|
10863
|
+
common.Injectable(),
|
|
10864
|
+
_ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10865
|
+
_ts_param23(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
10866
|
+
_ts_param23(2, common.Optional()),
|
|
10867
|
+
_ts_param23(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
10868
|
+
_ts_param23(3, common.Inject(TokenManagerService)),
|
|
10869
|
+
_ts_param23(4, common.Inject(MfaFlowLockoutService)),
|
|
10870
|
+
_ts_param23(5, common.Inject(MfaRecordService)),
|
|
10871
|
+
_ts_param23(6, common.Inject(exports.SessionService)),
|
|
10872
|
+
_ts_param23(7, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
10873
|
+
_ts_metadata38("design:type", Function),
|
|
10874
|
+
_ts_metadata38("design:paramtypes", [
|
|
10875
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
10876
|
+
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
10877
|
+
Object,
|
|
10878
|
+
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
10879
|
+
typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService,
|
|
10880
|
+
typeof MfaRecordService === "undefined" ? Object : MfaRecordService,
|
|
10881
|
+
typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
|
|
10882
|
+
typeof IAuthHooks === "undefined" ? Object : IAuthHooks
|
|
10883
|
+
])
|
|
10884
|
+
], MfaChallengeService);
|
|
10885
|
+
|
|
10886
|
+
// src/server/utils/mfa-notify.ts
|
|
10887
|
+
var PLATFORM_EMAIL_TENANT = "platform";
|
|
10888
|
+
function emailTenantOf(user) {
|
|
10889
|
+
return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
|
|
10890
|
+
}
|
|
10891
|
+
__name(emailTenantOf, "emailTenantOf");
|
|
10892
|
+
function notifyMfaChange(logger, emailProvider, origin, userId, user, send) {
|
|
10893
|
+
const tenantId = emailTenantOf(user);
|
|
10894
|
+
const email = user.email;
|
|
10895
|
+
const withheld = [
|
|
10896
|
+
email
|
|
10897
|
+
];
|
|
10898
|
+
void (async () => {
|
|
10899
|
+
try {
|
|
10900
|
+
await send(emailProvider, tenantId, email);
|
|
10901
|
+
} catch (err) {
|
|
10902
|
+
logger.error(safeLogLine(`${origin}: MFA notice delivery failed for user ${logSafe(userId)}: ` + describeChannelStatus(err), withheld));
|
|
10903
|
+
}
|
|
10904
|
+
})();
|
|
10905
|
+
}
|
|
10906
|
+
__name(notifyMfaChange, "notifyMfaChange");
|
|
10907
|
+
|
|
10908
|
+
// src/server/services/mfa-management.service.ts
|
|
10909
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
10910
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10911
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10912
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10913
|
+
} else {
|
|
10914
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10915
|
+
if (d = decorators[i]) {
|
|
10916
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10917
|
+
}
|
|
10918
|
+
}
|
|
10919
|
+
}
|
|
10920
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10921
|
+
}
|
|
10922
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
10923
|
+
function _ts_metadata39(metadataKey, metadataValue) {
|
|
10924
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10925
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10926
|
+
}
|
|
10927
|
+
}
|
|
10928
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
10929
|
+
function _ts_param24(paramIndex, decorator) {
|
|
10930
|
+
return function(target, key) {
|
|
10931
|
+
decorator(target, key, paramIndex);
|
|
10932
|
+
};
|
|
10933
|
+
}
|
|
10934
|
+
__name(_ts_param24, "_ts_param");
|
|
10935
|
+
var MfaManagementService = class {
|
|
10936
|
+
static {
|
|
10937
|
+
__name(this, "MfaManagementService");
|
|
10938
|
+
}
|
|
10939
|
+
options;
|
|
10940
|
+
platformUserRepo;
|
|
10941
|
+
redis;
|
|
10942
|
+
flowLockout;
|
|
10943
|
+
records;
|
|
10944
|
+
emailProvider;
|
|
10945
|
+
hooks;
|
|
10946
|
+
logger = new common.Logger(MFA_LOG_CONTEXT);
|
|
10947
|
+
constructor(options, platformUserRepo, redis, flowLockout, records, emailProvider, hooks) {
|
|
10948
|
+
this.options = options;
|
|
10949
|
+
this.platformUserRepo = platformUserRepo;
|
|
10950
|
+
this.redis = redis;
|
|
10951
|
+
this.flowLockout = flowLockout;
|
|
10952
|
+
this.records = records;
|
|
10953
|
+
this.emailProvider = emailProvider;
|
|
10954
|
+
this.hooks = hooks;
|
|
10955
|
+
}
|
|
10956
|
+
/**
|
|
10957
|
+
* Disables MFA on a user's account after verifying a current TOTP code.
|
|
10958
|
+
*
|
|
10959
|
+
* Only TOTP codes are accepted — recovery codes cannot disable MFA by design.
|
|
10960
|
+
* See {@link MfaDisableDto} for the rationale.
|
|
10961
|
+
*
|
|
10962
|
+
* Supports both dashboard users and platform administrators. The caller must
|
|
10963
|
+
* pass the correct `context` value derived from the authenticated JWT `type`
|
|
10964
|
+
* claim so the right repository is used.
|
|
10965
|
+
*
|
|
10966
|
+
* After disabling, all refresh sessions are atomically invalidated so that the
|
|
10967
|
+
* next rotation produces tokens with `mfaEnabled: false` and `mfaVerified: false`,
|
|
10968
|
+
* clearing any stale `mfaVerified: true` claims from previously issued access tokens.
|
|
10969
|
+
*
|
|
10970
|
+
* @param userId - Internal ID of the user disabling MFA.
|
|
10971
|
+
* @param code - 6-digit TOTP code from the authenticator app.
|
|
10972
|
+
* @param ip - Client IP address (forwarded to hooks).
|
|
10973
|
+
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
10974
|
+
* @param context - Which repository to use: `'dashboard'` or `'platform'`.
|
|
10975
|
+
* @param tenantId - The tenant on the dashboard plane; absent on the platform plane.
|
|
10976
|
+
* @param mfa - The resolved MFA configuration (cipher keys and TOTP window).
|
|
10977
|
+
* @throws `TOKEN_INVALID` if the user is not found.
|
|
10978
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active.
|
|
10979
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
10980
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
10981
|
+
*/
|
|
10982
|
+
async disable(userId, code, ip, userAgent, context, tenantId, mfa) {
|
|
10983
|
+
assertPlaneTenant(context, tenantId);
|
|
10984
|
+
const scope = {
|
|
10985
|
+
userId,
|
|
10986
|
+
context,
|
|
10987
|
+
tenantId
|
|
10988
|
+
};
|
|
10989
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10990
|
+
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10991
|
+
await this.spendTotpAttempt("disable", scope, user, code, mfa);
|
|
10992
|
+
await this.clearFactor(scope);
|
|
10993
|
+
this.logger.log(`disable: MFA disabled userId=${logSafe(userId)} context=${context}`);
|
|
10994
|
+
this.notifyDisabled("disable", scope, user);
|
|
10995
|
+
this.fireDisabledHook(scope, user, ip, userAgent);
|
|
10996
|
+
}
|
|
10997
|
+
/**
|
|
10998
|
+
* Removes a user's second factor without their TOTP code, for a support desk facing a user
|
|
10999
|
+
* who has lost their authenticator AND their recovery codes.
|
|
11000
|
+
*
|
|
11001
|
+
* Every self-service exit from MFA needs the factor itself: {@link disable} wants a valid
|
|
11002
|
+
* TOTP code, and the recovery codes want the codes. A user who has lost both is locked out
|
|
11003
|
+
* permanently, by the control that exists to protect them — ASVS v5 §6.1.1 asks for an
|
|
11004
|
+
* administrative path out for exactly that reason.
|
|
11005
|
+
*
|
|
11006
|
+
* **Authorising the caller is the consumer's job.** The library deliberately ships no route
|
|
11007
|
+
* for this, the same decision and for the same reason as {@link AuthService.unlockAccount}:
|
|
11008
|
+
* who may reset whom is a question only the host application can answer, and every route
|
|
11009
|
+
* this library ships is scoped to the caller's own account.
|
|
11010
|
+
*
|
|
11011
|
+
* Idempotent: resetting an account that has no second factor is a no-op, so a support desk
|
|
11012
|
+
* retrying does not get an error for a job already done.
|
|
11013
|
+
*
|
|
11014
|
+
* Three things happen beyond clearing the record, and none of them are optional:
|
|
11015
|
+
*
|
|
11016
|
+
* - **Sessions are invalidated and the token epoch is bumped**, so access tokens carrying
|
|
11017
|
+
* `mfaVerified: true` die with the factor rather than outliving it.
|
|
11018
|
+
* - **The user is notified**, through the same channel {@link disable} uses. An
|
|
11019
|
+
* administrative reset that the account holder cannot see is an account-takeover path:
|
|
11020
|
+
* an attacker who reaches the support desk removes the second factor silently. The
|
|
11021
|
+
* notification is what makes it an event the owner can detect and dispute.
|
|
11022
|
+
* - **It is logged** under its own prefix, so an administrative removal is distinguishable
|
|
11023
|
+
* from a user-initiated one in the library's own log.
|
|
11024
|
+
*
|
|
11025
|
+
* The `afterMfaDisabled` hook fires too, so consumer-side alerting keeps working. It is not
|
|
11026
|
+
* given a separate hook: the consumer is the one calling this method, so they already know
|
|
11027
|
+
* an administrative reset happened — the hook exists to tell them about the paths they do
|
|
11028
|
+
* not initiate.
|
|
11029
|
+
*
|
|
11030
|
+
* @param userId - Internal ID of the user whose second factor is being removed.
|
|
11031
|
+
* @param context - Which identity plane the user belongs to: `'dashboard'` or `'platform'`.
|
|
11032
|
+
* Must match the plane the account lives in, or the lookup misses.
|
|
11033
|
+
* @param tenantId - The tenant on the dashboard plane; absent on the platform plane.
|
|
11034
|
+
* @throws `TOKEN_INVALID` if no user with that ID exists in the given plane.
|
|
11035
|
+
*/
|
|
11036
|
+
async resetMfa(userId, context, tenantId) {
|
|
11037
|
+
assertPlaneTenant(context, tenantId);
|
|
11038
|
+
const scope = {
|
|
11039
|
+
userId,
|
|
11040
|
+
context,
|
|
11041
|
+
tenantId
|
|
11042
|
+
};
|
|
11043
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
11044
|
+
if (!user.mfaEnabled) {
|
|
11045
|
+
this.logger.log(`resetMfa: no second factor to remove userId=${logSafe(userId)} context=${context}`);
|
|
11046
|
+
return;
|
|
11047
|
+
}
|
|
11048
|
+
await this.clearFactor(scope);
|
|
11049
|
+
this.logger.warn(`resetMfa: MFA removed administratively userId=${logSafe(userId)} context=${context}`);
|
|
11050
|
+
this.notifyDisabled("resetMfa", scope, user);
|
|
11051
|
+
this.fireDisabledHook(scope, user, "", "");
|
|
11052
|
+
}
|
|
11053
|
+
/**
|
|
11054
|
+
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
11055
|
+
*
|
|
11056
|
+
* Mirrors {@link disable} in its security posture: only TOTP codes are accepted
|
|
11057
|
+
* (recovery codes cannot rotate themselves by design), the brute-force counter
|
|
11058
|
+
* is checked, and the regeneration is fired against the correct repository for
|
|
11059
|
+
* the supplied `context`. The TOTP secret on the user record is unchanged — only
|
|
11060
|
+
* the recovery code list is replaced.
|
|
11061
|
+
*
|
|
11062
|
+
* The order is deliberate and differs from the challenge: the account is read and the enrolment
|
|
11063
|
+
* checked BEFORE the lockout. The challenge runs its brute-force check first because it is a
|
|
11064
|
+
* PUBLIC endpoint, where an attacker who knows a userId could otherwise force a database read
|
|
11065
|
+
* per request. This and `disable` sit behind a JWT guard that binds the caller to a userId, so
|
|
11066
|
+
* the counter exists to throttle repeated TOTP guesses by the legitimate user, or by someone
|
|
11067
|
+
* holding their access token, and a read per request from an authenticated session is
|
|
11068
|
+
* acceptable for that threat model. Do not reorder it to match the challenge.
|
|
11069
|
+
*
|
|
11070
|
+
* Returns the plain-text codes once. They are NOT persisted in plain form; only a
|
|
11071
|
+
* keyed HMAC-SHA-256 of each goes into the database. The caller is responsible for showing the
|
|
11072
|
+
* codes to the user exactly once and warning them to save them safely.
|
|
11073
|
+
*
|
|
11074
|
+
* @remarks
|
|
11075
|
+
* **Sessions are intentionally NOT invalidated after this call.** Unlike
|
|
11076
|
+
* {@link disable}, which flips `mfaEnabled` back to `false`, this method does not change
|
|
11077
|
+
* the verification credential — the TOTP secret stays the same and existing
|
|
11078
|
+
* `mfaVerified: true` access tokens remain valid. Invalidating sessions here
|
|
11079
|
+
* would force a redundant re-auth on every recovery-code rotation, which is a
|
|
11080
|
+
* routine hygiene action a user might perform several times over the lifetime
|
|
11081
|
+
* of an account.
|
|
11082
|
+
*
|
|
11083
|
+
* @param userId - Internal ID of the user rotating recovery codes.
|
|
11084
|
+
* @param totpCode - 6-digit TOTP code from the authenticator app.
|
|
11085
|
+
* @param ip - Client IP address (forwarded to hooks).
|
|
11086
|
+
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
11087
|
+
* @param context - Which repository to use: `'dashboard'` or `'platform'`.
|
|
11088
|
+
* @param tenantId - The tenant on the dashboard plane; absent on the platform plane.
|
|
11089
|
+
* @param mfa - The resolved MFA configuration (cipher keys, TOTP window, code count).
|
|
11090
|
+
* @throws `TOKEN_INVALID` if the user is not found or `mfaSecret` is missing
|
|
11091
|
+
* when `mfaEnabled` is `true` (database inconsistency).
|
|
11092
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active, or if
|
|
11093
|
+
* `context === 'platform'` and the platform user repository was not
|
|
11094
|
+
* configured at module registration.
|
|
11095
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
11096
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
11097
|
+
* @returns The freshly generated plain-text recovery codes, one-time display.
|
|
11098
|
+
*/
|
|
11099
|
+
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context, tenantId, mfa) {
|
|
11100
|
+
assertPlaneTenant(context, tenantId);
|
|
11101
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
11102
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11103
|
+
}
|
|
11104
|
+
const scope = {
|
|
11105
|
+
userId,
|
|
11106
|
+
context,
|
|
11107
|
+
tenantId
|
|
11108
|
+
};
|
|
11109
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
11110
|
+
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11111
|
+
await this.spendTotpAttempt("regenerateRecoveryCodes", scope, user, totpCode, mfa);
|
|
11112
|
+
const recoveryCount = mfa.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
11113
|
+
const { plainCodes, hashedCodes } = generateRecoveryCodes(recoveryCount, this.options.hmacKey);
|
|
11114
|
+
const replaced = await this.records.transition(context, userId, tenantId, (current) => {
|
|
11115
|
+
if (!current.mfaEnabled) return null;
|
|
11116
|
+
return {
|
|
11117
|
+
mfaEnabled: true,
|
|
11118
|
+
mfaSecret: current.mfaSecret,
|
|
11119
|
+
mfaRecoveryCodes: hashedCodes
|
|
11120
|
+
};
|
|
11121
|
+
});
|
|
11122
|
+
if (!replaced) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11123
|
+
this.logger.log(`regenerateRecoveryCodes: recovery codes regenerated userId=${logSafe(userId)} context=${context}`);
|
|
11124
|
+
this.fireRegeneratedHook(scope, user, ip, userAgent);
|
|
11125
|
+
return {
|
|
11126
|
+
recoveryCodes: plainCodes
|
|
11127
|
+
};
|
|
11128
|
+
}
|
|
11129
|
+
/**
|
|
11130
|
+
* Checks the lockout, then verifies a TOTP code for an authenticated MFA change, counting a
|
|
11131
|
+
* wrong code and clearing the counter on a right one.
|
|
11132
|
+
*
|
|
11133
|
+
* The 'disable' counter is namespaced away from 'challenge', so a pre-auth attacker holding only
|
|
11134
|
+
* a temp token cannot exhaust the threshold and block the authenticated user's own changes.
|
|
11135
|
+
*
|
|
11136
|
+
* @param origin - The calling flow, for the log lines.
|
|
11137
|
+
* @param scope - The plane, account and tenant the change applies to.
|
|
11138
|
+
* @param user - The account, holding the encrypted secret.
|
|
11139
|
+
* @param code - The submitted TOTP code.
|
|
11140
|
+
* @param mfa - The resolved MFA configuration.
|
|
11141
|
+
* @throws {@link AuthException} `ACCOUNT_LOCKED` at the ceiling, `TOKEN_INVALID` when the secret
|
|
11142
|
+
* is absent on an enabled account (a database inconsistency), `MFA_INVALID_CODE` on a wrong
|
|
11143
|
+
* code.
|
|
11144
|
+
*/
|
|
11145
|
+
async spendTotpAttempt(origin, scope, user, code, mfa) {
|
|
11146
|
+
const { userId, context, tenantId } = scope;
|
|
11147
|
+
if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
|
|
11148
|
+
this.logger.warn(`${origin}: account locked userId=${logSafe(userId)} context=${context}`);
|
|
11149
|
+
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
11150
|
+
}
|
|
11151
|
+
if (!user.mfaSecret) {
|
|
11152
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11153
|
+
}
|
|
11154
|
+
const valid = await this.records.verifyTotpWithAntiReplay(context, userId, decryptMfaSecret(user.mfaSecret, mfa), code, mfa.totpWindow, tenantId);
|
|
11155
|
+
if (!valid) {
|
|
11156
|
+
await this.flowLockout.recordFailure("disable", context, userId, tenantId);
|
|
11157
|
+
this.logger.warn(`${origin}: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
11158
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
11159
|
+
}
|
|
11160
|
+
await this.flowLockout.reset("disable", context, userId, tenantId);
|
|
11161
|
+
}
|
|
11162
|
+
/**
|
|
11163
|
+
* Clears the MFA record and revokes everything issued under it.
|
|
11164
|
+
*
|
|
11165
|
+
* Serialized against every other MFA transition, so a challenge that read the record a moment
|
|
11166
|
+
* earlier cannot splice `mfaEnabled: true` and the old secret back on top of this. Sessions are
|
|
11167
|
+
* invalidated and the token epoch advances so outstanding access tokens die with the factor: an
|
|
11168
|
+
* auth-state change revokes everything issued under the previous state, in both directions, the
|
|
11169
|
+
* same rule the password-reset flow applies. Scoped to the caller's own identity plane.
|
|
11170
|
+
*
|
|
11171
|
+
* @param scope - The plane, account and tenant to clear.
|
|
11172
|
+
*/
|
|
11173
|
+
async clearFactor(scope) {
|
|
11174
|
+
const { userId, context, tenantId } = scope;
|
|
11175
|
+
await this.records.transition(context, userId, tenantId, () => ({
|
|
11176
|
+
mfaEnabled: false,
|
|
11177
|
+
mfaSecret: null,
|
|
11178
|
+
mfaRecoveryCodes: null
|
|
11179
|
+
}));
|
|
11180
|
+
await this.redis.invalidateUserSessions(userId, tenantId, context);
|
|
11181
|
+
await this.redis.bumpUserTokenEpoch(userId, tenantId, context);
|
|
11182
|
+
}
|
|
11183
|
+
/**
|
|
11184
|
+
* Tells the account holder their second factor was turned off.
|
|
11185
|
+
*
|
|
11186
|
+
* @param origin - The calling flow, for the log line.
|
|
11187
|
+
* @param scope - The plane, account and tenant that changed.
|
|
11188
|
+
* @param user - The account, read for its address.
|
|
11189
|
+
*/
|
|
11190
|
+
notifyDisabled(origin, scope, user) {
|
|
11191
|
+
notifyMfaChange(this.logger, this.emailProvider, origin, scope.userId, user, (provider, tenant, email) => provider.sendMfaDisabledNotification(tenant, email));
|
|
11192
|
+
}
|
|
11193
|
+
/**
|
|
11194
|
+
* Fires the `afterMfaDisabled` hook, fire-and-forget: its failure must not undo a completed
|
|
11195
|
+
* removal.
|
|
11196
|
+
*
|
|
11197
|
+
* @param scope - The plane, account and tenant that changed.
|
|
11198
|
+
* @param user - The account as read before the change.
|
|
11199
|
+
* @param ip - Client IP address, or empty for an administrative call.
|
|
11200
|
+
* @param userAgent - User-Agent header, or empty for an administrative call.
|
|
11201
|
+
*/
|
|
11202
|
+
fireDisabledHook(scope, user, ip, userAgent) {
|
|
11203
|
+
const safeUser = committedSafeUser(scope.context, user, false);
|
|
11204
|
+
if (this.hooks.afterMfaDisabled) {
|
|
11205
|
+
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
11206
|
+
plane: scope.context,
|
|
11207
|
+
userId: scope.userId,
|
|
11208
|
+
ip,
|
|
11209
|
+
userAgent,
|
|
11210
|
+
sanitizedHeaders: {}
|
|
11211
|
+
})).catch(() => void 0);
|
|
11212
|
+
}
|
|
11213
|
+
}
|
|
11214
|
+
/**
|
|
11215
|
+
* Fires the `afterMfaRecoveryCodesRegenerated` hook, fire-and-forget: its failure must not undo
|
|
11216
|
+
* a completed regeneration.
|
|
11217
|
+
*
|
|
11218
|
+
* @param scope - The plane, account and tenant that changed.
|
|
11219
|
+
* @param user - The account as read before the change.
|
|
11220
|
+
* @param ip - Client IP address.
|
|
11221
|
+
* @param userAgent - User-Agent header.
|
|
11222
|
+
*/
|
|
11223
|
+
fireRegeneratedHook(scope, user, ip, userAgent) {
|
|
11224
|
+
if (this.hooks.afterMfaRecoveryCodesRegenerated) {
|
|
11225
|
+
const safeUser = scope.context === "platform" ? platformUserAsSafeUser(user) : toSafeUser3(user);
|
|
11226
|
+
void Promise.resolve(this.hooks.afterMfaRecoveryCodesRegenerated(safeUser, {
|
|
11227
|
+
plane: scope.context,
|
|
11228
|
+
userId: scope.userId,
|
|
11229
|
+
ip,
|
|
11230
|
+
userAgent,
|
|
11231
|
+
sanitizedHeaders: {}
|
|
11232
|
+
})).catch(() => void 0);
|
|
11233
|
+
}
|
|
11234
|
+
}
|
|
11235
|
+
};
|
|
11236
|
+
MfaManagementService = _ts_decorate40([
|
|
11237
|
+
common.Injectable(),
|
|
11238
|
+
_ts_param24(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11239
|
+
_ts_param24(1, common.Optional()),
|
|
11240
|
+
_ts_param24(1, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
11241
|
+
_ts_param24(2, common.Inject(AuthRedisService)),
|
|
11242
|
+
_ts_param24(3, common.Inject(MfaFlowLockoutService)),
|
|
11243
|
+
_ts_param24(4, common.Inject(MfaRecordService)),
|
|
11244
|
+
_ts_param24(5, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
11245
|
+
_ts_param24(6, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
11246
|
+
_ts_metadata39("design:type", Function),
|
|
11247
|
+
_ts_metadata39("design:paramtypes", [
|
|
11248
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
11249
|
+
Object,
|
|
11250
|
+
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
11251
|
+
typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService,
|
|
11252
|
+
typeof MfaRecordService === "undefined" ? Object : MfaRecordService,
|
|
11253
|
+
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
11254
|
+
typeof IAuthHooks === "undefined" ? Object : IAuthHooks
|
|
11255
|
+
])
|
|
11256
|
+
], MfaManagementService);
|
|
11257
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
11258
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11259
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11260
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11261
|
+
} else {
|
|
11262
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11263
|
+
if (d = decorators[i]) {
|
|
11264
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11265
|
+
}
|
|
11266
|
+
}
|
|
11267
|
+
}
|
|
11268
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11269
|
+
}
|
|
11270
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
11271
|
+
function _ts_metadata40(metadataKey, metadataValue) {
|
|
11272
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11273
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11274
|
+
}
|
|
11275
|
+
}
|
|
11276
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
11277
|
+
function _ts_param25(paramIndex, decorator) {
|
|
11278
|
+
return function(target, key) {
|
|
11279
|
+
decorator(target, key, paramIndex);
|
|
11280
|
+
};
|
|
11281
|
+
}
|
|
11282
|
+
__name(_ts_param25, "_ts_param");
|
|
11283
|
+
exports.ReauthenticationService = class ReauthenticationService {
|
|
11284
|
+
static {
|
|
11285
|
+
__name(this, "ReauthenticationService");
|
|
11286
|
+
}
|
|
11287
|
+
options;
|
|
11288
|
+
redis;
|
|
11289
|
+
passwordService;
|
|
11290
|
+
lockout;
|
|
11291
|
+
logger = new common.Logger(MFA_LOG_CONTEXT);
|
|
11292
|
+
constructor(options, redis, passwordService, lockout) {
|
|
11293
|
+
this.options = options;
|
|
11294
|
+
this.redis = redis;
|
|
11295
|
+
this.passwordService = passwordService;
|
|
11296
|
+
this.lockout = lockout;
|
|
11297
|
+
}
|
|
11298
|
+
/**
|
|
11299
|
+
* Requires the caller to re-prove the account password before a factor is changed.
|
|
11300
|
+
*
|
|
11301
|
+
* Counted like a login, and for the same reason. `login` refuses an account after N wrong
|
|
11302
|
+
* passwords, and this door asks for the same secret, so it carries the same lockout: without
|
|
11303
|
+
* one, a caller holding a stolen access token but not the password could guess it here
|
|
11304
|
+
* indefinitely, bounded only by the per-route IP limit, which a distributed caller sidesteps.
|
|
11305
|
+
* Winning the guess buys the whole account: enrol a factor, change the password, move the
|
|
11306
|
+
* address.
|
|
11307
|
+
*
|
|
11308
|
+
* The identifier is namespaced by flow and by plane. Sharing one counter with `login` would
|
|
11309
|
+
* let an authenticated caller lock the owner out of their own sign-in, and sharing it across
|
|
11310
|
+
* planes would let a dashboard user and a platform admin holding the same id exhaust each
|
|
11311
|
+
* other's budget — the same two reasons the challenge and disable counters are split.
|
|
11312
|
+
*
|
|
11313
|
+
* @param context - The authentication plane, part of the counter's key.
|
|
11314
|
+
* @param userId - The account being changed, part of the counter's key.
|
|
11315
|
+
* @param passwordHash - The account's stored hash, or `null` for an OAuth-only account.
|
|
11316
|
+
* @param password - The password the caller submitted, if any.
|
|
11317
|
+
* @throws {@link AuthException} `ACCOUNT_LOCKED` once the failure budget for this flow is
|
|
11318
|
+
* spent, or `INVALID_CREDENTIALS` when the account has a password and the submitted one is
|
|
11319
|
+
* absent or wrong. The latter is deliberately the same code a failed login returns: an
|
|
11320
|
+
* attacker holding a stolen token learns nothing from it that a failed login does not tell them.
|
|
11321
|
+
*/
|
|
11322
|
+
async assertReauthenticated(context, userId, passwordHash, password, tenantId) {
|
|
11323
|
+
if (passwordHash === null) {
|
|
11324
|
+
const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey, tenantId));
|
|
11325
|
+
if (recent === null) {
|
|
11326
|
+
this.logger.warn(`reauthenticate: no recent authentication userId=${logSafe(userId)} context=${context}`);
|
|
11327
|
+
throw new AuthException(AUTH_ERROR_CODES.REAUTHENTICATION_REQUIRED);
|
|
11328
|
+
}
|
|
11329
|
+
return;
|
|
11330
|
+
}
|
|
11331
|
+
if (await this.lockout.isLockedOut("reauth", context, userId, tenantId)) {
|
|
11332
|
+
this.logger.warn(`reauthenticate: account locked userId=${logSafe(userId)} context=${context}`);
|
|
11333
|
+
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
11334
|
+
}
|
|
11335
|
+
const supplied = password ?? "";
|
|
11336
|
+
const matches = await this.passwordService.compare(supplied, passwordHash);
|
|
11337
|
+
if (!matches) {
|
|
11338
|
+
await this.lockout.recordFailure("reauth", context, userId, tenantId);
|
|
11339
|
+
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
11340
|
+
}
|
|
11341
|
+
await this.lockout.reset("reauth", context, userId, tenantId);
|
|
11342
|
+
}
|
|
11343
|
+
};
|
|
11344
|
+
exports.ReauthenticationService = _ts_decorate41([
|
|
11345
|
+
common.Injectable(),
|
|
11346
|
+
_ts_param25(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11347
|
+
_ts_param25(1, common.Inject(AuthRedisService)),
|
|
11348
|
+
_ts_param25(2, common.Inject(PasswordService)),
|
|
11349
|
+
_ts_param25(3, common.Inject(MfaFlowLockoutService)),
|
|
11350
|
+
_ts_metadata40("design:type", Function),
|
|
11351
|
+
_ts_metadata40("design:paramtypes", [
|
|
11352
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
11353
|
+
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
11354
|
+
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
11355
|
+
typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService
|
|
11356
|
+
])
|
|
11357
|
+
], exports.ReauthenticationService);
|
|
11358
|
+
|
|
11359
|
+
// src/server/utils/mfa-setup-data.ts
|
|
11360
|
+
function isMfaSetupData(value) {
|
|
11361
|
+
if (value === null) return false;
|
|
11362
|
+
if (typeof value !== "object") return false;
|
|
11363
|
+
const v = value;
|
|
11364
|
+
return typeof v["encryptedSecret"] === "string" && typeof v["encryptedPlainCodes"] === "string" && Array.isArray(v["hashedCodes"]) && v["hashedCodes"].every((code) => typeof code === "string");
|
|
11365
|
+
}
|
|
11366
|
+
__name(isMfaSetupData, "isMfaSetupData");
|
|
11367
|
+
function parseSetupData(raw, userId, logger) {
|
|
11368
|
+
let parsed;
|
|
11369
|
+
try {
|
|
11370
|
+
parsed = JSON.parse(raw);
|
|
11371
|
+
} catch {
|
|
11372
|
+
logger.warn(`parseSetupData: pending-setup payload is not valid JSON userId=${logSafe(userId)}`);
|
|
11373
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
11374
|
+
}
|
|
11375
|
+
if (!isMfaSetupData(parsed)) {
|
|
11376
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
11377
|
+
}
|
|
11378
|
+
return parsed;
|
|
11379
|
+
}
|
|
11380
|
+
__name(parseSetupData, "parseSetupData");
|
|
11381
|
+
function parsePlainRecoveryCodes(raw, userId, logger) {
|
|
11382
|
+
let parsed;
|
|
11383
|
+
try {
|
|
11384
|
+
parsed = JSON.parse(raw);
|
|
11385
|
+
} catch {
|
|
11386
|
+
logger.warn(`parsePlainRecoveryCodes: decrypted payload is not valid JSON userId=${logSafe(userId)}`);
|
|
11387
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
11388
|
+
}
|
|
11389
|
+
if (!Array.isArray(parsed) || parsed.some((code) => typeof code !== "string")) {
|
|
11390
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
11391
|
+
}
|
|
11392
|
+
return parsed;
|
|
11393
|
+
}
|
|
11394
|
+
__name(parsePlainRecoveryCodes, "parsePlainRecoveryCodes");
|
|
11395
|
+
|
|
11396
|
+
// src/server/services/mfa.service.ts
|
|
11397
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
11398
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11399
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11400
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
11401
|
+
} else {
|
|
11402
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
11403
|
+
if (d = decorators[i]) {
|
|
11404
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11405
|
+
}
|
|
11406
|
+
}
|
|
11407
|
+
}
|
|
11408
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11409
|
+
}
|
|
11410
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
11411
|
+
function _ts_metadata41(metadataKey, metadataValue) {
|
|
11412
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11413
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
11414
|
+
}
|
|
11415
|
+
}
|
|
11416
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
11417
|
+
function _ts_param26(paramIndex, decorator) {
|
|
11418
|
+
return function(target, key) {
|
|
11419
|
+
decorator(target, key, paramIndex);
|
|
11420
|
+
};
|
|
11421
|
+
}
|
|
11422
|
+
__name(_ts_param26, "_ts_param");
|
|
11423
|
+
var MFA_SETUP_TTL_SECONDS = 600;
|
|
11424
|
+
exports.MfaService = class _MfaService {
|
|
11425
|
+
static {
|
|
11426
|
+
__name(this, "MfaService");
|
|
11427
|
+
}
|
|
11428
|
+
options;
|
|
11429
|
+
userRepo;
|
|
11430
|
+
platformUserRepo;
|
|
11431
|
+
redis;
|
|
11432
|
+
tokenManager;
|
|
11433
|
+
records;
|
|
11434
|
+
challengeFlow;
|
|
11435
|
+
management;
|
|
11436
|
+
flowLockout;
|
|
11437
|
+
reauthentication;
|
|
11438
|
+
sessionService;
|
|
11439
|
+
emailProvider;
|
|
11440
|
+
hooks;
|
|
11441
|
+
logger = new common.Logger(_MfaService.name);
|
|
11442
|
+
constructor(options, userRepo, platformUserRepo, redis, tokenManager, records, challengeFlow, management, flowLockout, reauthentication, sessionService, emailProvider, hooks) {
|
|
11443
|
+
this.options = options;
|
|
11444
|
+
this.userRepo = userRepo;
|
|
11445
|
+
this.platformUserRepo = platformUserRepo;
|
|
11446
|
+
this.redis = redis;
|
|
11447
|
+
this.tokenManager = tokenManager;
|
|
11448
|
+
this.records = records;
|
|
11449
|
+
this.challengeFlow = challengeFlow;
|
|
11450
|
+
this.management = management;
|
|
11451
|
+
this.flowLockout = flowLockout;
|
|
11452
|
+
this.reauthentication = reauthentication;
|
|
11453
|
+
this.sessionService = sessionService;
|
|
11454
|
+
this.emailProvider = emailProvider;
|
|
11455
|
+
this.hooks = hooks;
|
|
11456
|
+
}
|
|
11457
|
+
// ---------------------------------------------------------------------------
|
|
11458
|
+
// Private accessor — options.mfa is guaranteed non-null when service is active
|
|
11459
|
+
// ---------------------------------------------------------------------------
|
|
11460
|
+
/**
|
|
11461
|
+
* Returns the resolved MFA configuration. `options.mfa` is always present when `MfaService` is registered.
|
|
11462
|
+
*
|
|
11463
|
+
* `options.mfa` is always present when `MfaService` is registered — the module
|
|
11464
|
+
* only registers the service when `mfa` is configured. The single suppression
|
|
11465
|
+
* here eliminates repetitive `!` assertions throughout the class.
|
|
11466
|
+
*/
|
|
11467
|
+
get mfaOptions() {
|
|
11468
|
+
return this.options.mfa;
|
|
11469
|
+
}
|
|
11470
|
+
// ---------------------------------------------------------------------------
|
|
11471
|
+
// Private crypto helpers
|
|
11472
|
+
// ---------------------------------------------------------------------------
|
|
11473
|
+
// ---------------------------------------------------------------------------
|
|
11474
|
+
// setup — TOTP secret generation, idempotent key reservation, recovery codes
|
|
11475
|
+
// ---------------------------------------------------------------------------
|
|
11476
|
+
/**
|
|
11477
|
+
* Initiates the MFA setup flow for a dashboard user or platform administrator.
|
|
11478
|
+
*
|
|
11479
|
+
* Generates a TOTP secret and 8 recovery codes, stores them temporarily in
|
|
11480
|
+
* Redis (10 minutes), and returns the data needed to display the QR code and
|
|
11481
|
+
* recovery codes to the user.
|
|
11482
|
+
*
|
|
11483
|
+
* Idempotent: concurrent or repeated calls within the TTL window all receive the
|
|
11484
|
+
* same secret and codes. An atomic SET-NX is used so that two simultaneous setup
|
|
11485
|
+
* requests cannot generate different secrets.
|
|
11486
|
+
*
|
|
11487
|
+
* @param userId - Internal ID of the user enabling MFA.
|
|
11488
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
11489
|
+
* @returns Setup result containing the secret, QR URI, and plain recovery codes.
|
|
11490
|
+
* @throws `MFA_ALREADY_ENABLED` if MFA is already active on the account.
|
|
11491
|
+
* @throws `MFA_NOT_ENABLED` if `context === 'platform'` and the platform user
|
|
11492
|
+
* repository was not configured at module registration. The error code is
|
|
11493
|
+
* reused (rather than introducing a new one) because the consumer-facing
|
|
11494
|
+
* meaning is the same: "platform MFA cannot operate".
|
|
11495
|
+
*/
|
|
11496
|
+
async setup(userId, context = "dashboard", password, tenantId) {
|
|
11497
|
+
assertPlaneTenant(context, tenantId);
|
|
11498
|
+
if (context === "platform" && !this.platformUserRepo) {
|
|
11499
|
+
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11500
|
+
}
|
|
11501
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
11502
|
+
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
11503
|
+
await this.reauthentication.assertReauthenticated(context, userId, user.passwordHash, password, tenantId);
|
|
11504
|
+
const setupKey = `mfa_setup:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
11505
|
+
const existingFast = await this.redis.get(setupKey);
|
|
11506
|
+
if (existingFast !== null) {
|
|
11507
|
+
const data = parseSetupData(existingFast, userId, this.logger);
|
|
11508
|
+
const existingSecret = decryptMfaSecret(data.encryptedSecret, this.mfaOptions);
|
|
11509
|
+
const decryptedCodesJson = decryptMfaSecret(data.encryptedPlainCodes, this.mfaOptions);
|
|
11510
|
+
const existingCodes = parsePlainRecoveryCodes(decryptedCodesJson, userId, this.logger);
|
|
11511
|
+
const qrCodeUri2 = buildTotpUri(existingSecret, user.email, this.mfaOptions.issuer);
|
|
11512
|
+
return {
|
|
11513
|
+
secret: existingSecret,
|
|
10812
11514
|
qrCodeUri: qrCodeUri2,
|
|
10813
11515
|
recoveryCodes: existingCodes
|
|
10814
11516
|
};
|
|
@@ -10903,7 +11605,7 @@ exports.MfaService = class _MfaService {
|
|
|
10903
11605
|
await this.redis.invalidateUserSessions(userId, tenantId, context);
|
|
10904
11606
|
await this.redis.bumpUserTokenEpoch(userId, tenantId, context);
|
|
10905
11607
|
this.logger.log(`verifyAndEnable: MFA enabled userId=${logSafe(userId)} context=${context}`);
|
|
10906
|
-
this.
|
|
11608
|
+
notifyMfaChange(this.logger, this.emailProvider, "verifyAndEnable", userId, user, (provider, tenant, email) => provider.sendMfaEnabledNotification(tenant, email));
|
|
10907
11609
|
if (this.hooks.afterMfaEnabled) {
|
|
10908
11610
|
const safeUser = committedSafeUser(context, user, true);
|
|
10909
11611
|
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
@@ -10924,9 +11626,8 @@ exports.MfaService = class _MfaService {
|
|
|
10924
11626
|
* Validates a TOTP or recovery code and exchanges the MFA temp token for full
|
|
10925
11627
|
* access tokens.
|
|
10926
11628
|
*
|
|
10927
|
-
* Handles both `'dashboard'` and `'platform'` contexts
|
|
10928
|
-
*
|
|
10929
|
-
* Redis key keyed on an HMAC of the code and user ID.
|
|
11629
|
+
* Handles both `'dashboard'` and `'platform'` contexts; the flow lives in
|
|
11630
|
+
* {@link MfaChallengeService.challenge}.
|
|
10930
11631
|
*
|
|
10931
11632
|
* @param mfaTempToken - Short-lived MFA challenge JWT issued at login.
|
|
10932
11633
|
* @param code - 6-digit TOTP code or `dddd-dddd-dddd` recovery code.
|
|
@@ -10938,120 +11639,12 @@ exports.MfaService = class _MfaService {
|
|
|
10938
11639
|
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
10939
11640
|
*/
|
|
10940
11641
|
async challenge(mfaTempToken, code, ip, userAgent) {
|
|
10941
|
-
|
|
10942
|
-
if (await this.flowLockout.isLockedOut("challenge", context, userId, tenantId)) {
|
|
10943
|
-
this.logger.warn(`challenge: account locked userId=${logSafe(userId)}`);
|
|
10944
|
-
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
10945
|
-
}
|
|
10946
|
-
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10947
|
-
if (!user.mfaEnabled || !user.mfaSecret) {
|
|
10948
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10949
|
-
}
|
|
10950
|
-
const { secret: secretBase32, stale: encryptedUnderRetiredKey } = decryptWithRotation(user.mfaSecret, this.mfaOptions);
|
|
10951
|
-
const isTotpCode = /^\d{6}$/.test(code);
|
|
10952
|
-
const totpWindow = this.mfaOptions.totpWindow;
|
|
10953
|
-
let codeValid = false;
|
|
10954
|
-
let usedRecoveryIndex = -1;
|
|
10955
|
-
if (isTotpCode) {
|
|
10956
|
-
codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
10957
|
-
} else {
|
|
10958
|
-
const recoveryCodes = user.mfaRecoveryCodes ?? [];
|
|
10959
|
-
usedRecoveryIndex = await verifyRecoveryCode(code, recoveryCodes, this.options.hmacKey, this.options.previousHmacKeys);
|
|
10960
|
-
codeValid = usedRecoveryIndex >= 0 && await this.records.claimRecoveryCode(context, userId, code, tenantId);
|
|
10961
|
-
}
|
|
10962
|
-
if (!codeValid) {
|
|
10963
|
-
await this.flowLockout.recordFailure("challenge", context, userId, tenantId);
|
|
10964
|
-
this.logger.warn(`challenge: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
10965
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
10966
|
-
}
|
|
10967
|
-
await this.flowLockout.reset("challenge", context, userId, tenantId);
|
|
10968
|
-
if (!await this.tokenManager.consumeMfaTempToken(tempTokenJti)) {
|
|
10969
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
|
|
10970
|
-
}
|
|
10971
|
-
if (usedRecoveryIndex >= 0) {
|
|
10972
|
-
const existingCodes = user.mfaRecoveryCodes ?? /* istanbul ignore next -- verifyRecoveryCode returns ≥0 only after iterating a non-null array */
|
|
10973
|
-
// Stryker disable next-line ArrayDeclaration: unreachable — this branch is only taken
|
|
10974
|
-
// when `verifyRecoveryCode` matched a code inside an array it had to iterate first.
|
|
10975
|
-
[];
|
|
10976
|
-
await this.records.transition(context, userId, tenantId, (current) => {
|
|
10977
|
-
if (!current.mfaEnabled) return null;
|
|
10978
|
-
if (!holdsSecret(current.mfaSecret, secretBase32, this.mfaOptions)) return null;
|
|
10979
|
-
const currentCodes = current.mfaRecoveryCodes ?? [];
|
|
10980
|
-
const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
|
|
10981
|
-
const liveIndex = currentCodes.indexOf(spentDigest);
|
|
10982
|
-
if (liveIndex < 0) return null;
|
|
10983
|
-
const updatedCodes = [
|
|
10984
|
-
...currentCodes
|
|
10985
|
-
];
|
|
10986
|
-
updatedCodes.splice(liveIndex, 1);
|
|
10987
|
-
return {
|
|
10988
|
-
mfaEnabled: true,
|
|
10989
|
-
// Re-encrypted here when the secret opened under a retired key: the write is
|
|
10990
|
-
// already happening, so the rotation drains for free.
|
|
10991
|
-
mfaSecret: encryptedUnderRetiredKey ? encryptMfaSecret(secretBase32, this.mfaOptions) : current.mfaSecret,
|
|
10992
|
-
mfaRecoveryCodes: updatedCodes
|
|
10993
|
-
};
|
|
10994
|
-
});
|
|
10995
|
-
} else if (encryptedUnderRetiredKey) {
|
|
10996
|
-
void this.records.reencryptSecret(userId, context, secretBase32, tenantId, this.mfaOptions);
|
|
10997
|
-
}
|
|
10998
|
-
this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
|
|
10999
|
-
if (context === "dashboard") {
|
|
11000
|
-
const safeUser = toSafeUser3(user);
|
|
11001
|
-
const result2 = await this.tokenManager.issueTokens(safeUser, ip, userAgent, {
|
|
11002
|
-
mfaVerified: true
|
|
11003
|
-
});
|
|
11004
|
-
if (this.options.sessions.enabled) {
|
|
11005
|
-
await this.sessionService.createSession({
|
|
11006
|
-
userId: safeUser.id,
|
|
11007
|
-
tenantId: safeUser.tenantId,
|
|
11008
|
-
rawRefreshToken: result2.rawRefreshToken,
|
|
11009
|
-
ip,
|
|
11010
|
-
userAgent
|
|
11011
|
-
});
|
|
11012
|
-
}
|
|
11013
|
-
runDetached(this.logger, () => this.userRepo.updateLastLogin({
|
|
11014
|
-
id: safeUser.id,
|
|
11015
|
-
tenantId: safeUser.tenantId
|
|
11016
|
-
}), "challenge: updateLastLogin failed");
|
|
11017
|
-
if (this.hooks.afterLogin) {
|
|
11018
|
-
const afterLogin = this.hooks.afterLogin.bind(this.hooks);
|
|
11019
|
-
runDetached(this.logger, () => afterLogin(safeUser, {
|
|
11020
|
-
plane: "dashboard",
|
|
11021
|
-
userId,
|
|
11022
|
-
ip,
|
|
11023
|
-
userAgent,
|
|
11024
|
-
sanitizedHeaders: {}
|
|
11025
|
-
}), "challenge: afterLogin hook threw");
|
|
11026
|
-
}
|
|
11027
|
-
return result2;
|
|
11028
|
-
}
|
|
11029
|
-
const platformUser = user;
|
|
11030
|
-
const result = await this.tokenManager.issuePlatformTokens(toSafePlatformUser(platformUser), ip, userAgent, {
|
|
11031
|
-
mfaVerified: true
|
|
11032
|
-
});
|
|
11033
|
-
runDetached(this.logger, () => this.platformUserRepo.updateLastLogin(platformUser.id), "challenge: platform updateLastLogin failed");
|
|
11034
|
-
if (this.hooks.afterLogin) {
|
|
11035
|
-
const afterLogin = this.hooks.afterLogin.bind(this.hooks);
|
|
11036
|
-
runDetached(this.logger, () => afterLogin(platformUserAsSafeUser(platformUser), {
|
|
11037
|
-
plane: "platform",
|
|
11038
|
-
userId,
|
|
11039
|
-
ip,
|
|
11040
|
-
userAgent,
|
|
11041
|
-
sanitizedHeaders: {}
|
|
11042
|
-
}), "challenge: afterLogin hook threw");
|
|
11043
|
-
}
|
|
11044
|
-
return result;
|
|
11642
|
+
return this.challengeFlow.challenge(mfaTempToken, code, ip, userAgent, this.mfaOptions);
|
|
11045
11643
|
}
|
|
11046
11644
|
/**
|
|
11047
|
-
* The challenge for an entry point that serves the platform plane only
|
|
11048
|
-
*
|
|
11049
|
-
*
|
|
11050
|
-
* `PLATFORM_AUTH_REQUIRED` before anything is spent. {@link MfaService.challenge} consumes the
|
|
11051
|
-
* token, burns the TOTP code, stores a session, stamps the last login and fires the hooks, so
|
|
11052
|
-
* refusing after it leaves an orphan session nobody holds a token for. The first verification only
|
|
11053
|
-
* reads: it touches neither the brute-force counter nor the TOTP anti-replay key. The challenge
|
|
11054
|
-
* verifies the token again, and the plane is a signed claim, so both reads see the same one.
|
|
11645
|
+
* The challenge for an entry point that serves the platform plane only: a dashboard token is
|
|
11646
|
+
* refused with `PLATFORM_AUTH_REQUIRED` before anything is spent. See
|
|
11647
|
+
* {@link MfaChallengeService.challengePlatformOnly}.
|
|
11055
11648
|
*
|
|
11056
11649
|
* @param mfaTempToken - Short-lived MFA challenge JWT issued at platform login.
|
|
11057
11650
|
* @param code - 6-digit TOTP code or `dddd-dddd-dddd` recovery code.
|
|
@@ -11064,184 +11657,58 @@ exports.MfaService = class _MfaService {
|
|
|
11064
11657
|
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
11065
11658
|
*/
|
|
11066
11659
|
async challengePlatformOnly(mfaTempToken, code, ip, userAgent) {
|
|
11067
|
-
|
|
11068
|
-
if (context !== "platform") {
|
|
11069
|
-
throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
|
|
11070
|
-
}
|
|
11071
|
-
const result = await this.challenge(mfaTempToken, code, ip, userAgent);
|
|
11072
|
-
if (!("admin" in result)) {
|
|
11073
|
-
throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
|
|
11074
|
-
}
|
|
11075
|
-
return result;
|
|
11660
|
+
return this.challengeFlow.challengePlatformOnly(mfaTempToken, code, ip, userAgent, this.mfaOptions);
|
|
11076
11661
|
}
|
|
11077
11662
|
// ---------------------------------------------------------------------------
|
|
11078
|
-
// disable —
|
|
11663
|
+
// disable, resetMfa, regenerateRecoveryCodes — changes to an existing enrolment
|
|
11079
11664
|
// ---------------------------------------------------------------------------
|
|
11080
11665
|
/**
|
|
11081
11666
|
* Disables MFA on a user's account after verifying a current TOTP code.
|
|
11082
11667
|
*
|
|
11083
|
-
* Only TOTP codes are accepted — recovery codes cannot disable MFA by design.
|
|
11084
|
-
*
|
|
11085
|
-
*
|
|
11086
|
-
*
|
|
11087
|
-
*
|
|
11088
|
-
*
|
|
11089
|
-
*
|
|
11090
|
-
*
|
|
11091
|
-
*
|
|
11092
|
-
*
|
|
11093
|
-
*
|
|
11094
|
-
* @
|
|
11095
|
-
* @
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
*
|
|
11102
|
-
*
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
11107
|
-
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11108
|
-
if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
|
|
11109
|
-
this.logger.warn(`disable: account locked userId=${logSafe(userId)} context=${context}`);
|
|
11110
|
-
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
11111
|
-
}
|
|
11112
|
-
if (!user.mfaSecret) {
|
|
11113
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11114
|
-
}
|
|
11115
|
-
const secretBase32 = decryptMfaSecret(user.mfaSecret, this.mfaOptions);
|
|
11116
|
-
const totpWindow = this.mfaOptions.totpWindow;
|
|
11117
|
-
const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
11118
|
-
if (!codeValid) {
|
|
11119
|
-
await this.flowLockout.recordFailure("disable", context, userId, tenantId);
|
|
11120
|
-
this.logger.warn(`disable: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
11121
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
11122
|
-
}
|
|
11123
|
-
await this.flowLockout.reset("disable", context, userId, tenantId);
|
|
11124
|
-
await this.records.transition(context, userId, tenantId, () => ({
|
|
11125
|
-
mfaEnabled: false,
|
|
11126
|
-
mfaSecret: null,
|
|
11127
|
-
mfaRecoveryCodes: null
|
|
11128
|
-
}));
|
|
11129
|
-
await this.redis.invalidateUserSessions(userId, tenantId, context);
|
|
11130
|
-
await this.redis.bumpUserTokenEpoch(userId, tenantId, context);
|
|
11131
|
-
this.logger.log(`disable: MFA disabled userId=${logSafe(userId)} context=${context}`);
|
|
11132
|
-
this.notify("disable", userId, user, (provider, tenant, email) => provider.sendMfaDisabledNotification(tenant, email));
|
|
11133
|
-
const safeUser = committedSafeUser(context, user, false);
|
|
11134
|
-
if (this.hooks.afterMfaDisabled) {
|
|
11135
|
-
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
11136
|
-
plane: context,
|
|
11137
|
-
userId,
|
|
11138
|
-
ip,
|
|
11139
|
-
userAgent,
|
|
11140
|
-
sanitizedHeaders: {}
|
|
11141
|
-
})).catch(() => void 0);
|
|
11142
|
-
}
|
|
11143
|
-
}
|
|
11144
|
-
// ---------------------------------------------------------------------------
|
|
11145
|
-
// resetMfa() — administrative removal of a second factor
|
|
11146
|
-
// ---------------------------------------------------------------------------
|
|
11147
|
-
/**
|
|
11148
|
-
* Removes a user's second factor without their TOTP code, for a support desk facing a user
|
|
11149
|
-
* who has lost their authenticator AND their recovery codes.
|
|
11150
|
-
*
|
|
11151
|
-
* Every self-service exit from MFA needs the factor itself: {@link disable} wants a valid
|
|
11152
|
-
* TOTP code, and the recovery codes want the codes. A user who has lost both is locked out
|
|
11153
|
-
* permanently, by the control that exists to protect them — ASVS v5 §6.1.1 asks for an
|
|
11154
|
-
* administrative path out for exactly that reason.
|
|
11155
|
-
*
|
|
11156
|
-
* **Authorising the caller is the consumer's job.** The library deliberately ships no route
|
|
11157
|
-
* for this, the same decision and for the same reason as {@link AuthService.unlockAccount}:
|
|
11158
|
-
* who may reset whom is a question only the host application can answer, and all 39 routes
|
|
11159
|
-
* this library does ship are scoped to the caller's own account.
|
|
11160
|
-
*
|
|
11161
|
-
* Idempotent: resetting an account that has no second factor is a no-op, so a support desk
|
|
11162
|
-
* retrying does not get an error for a job already done.
|
|
11163
|
-
*
|
|
11164
|
-
* Three things happen beyond clearing the record, and none of them are optional:
|
|
11165
|
-
*
|
|
11166
|
-
* - **Sessions are invalidated and the token epoch is bumped**, so access tokens carrying
|
|
11167
|
-
* `mfaVerified: true` die with the factor rather than outliving it.
|
|
11168
|
-
* - **The user is notified**, through the same channel {@link disable} uses. An
|
|
11169
|
-
* administrative reset that the account holder cannot see is an account-takeover path:
|
|
11170
|
-
* an attacker who reaches the support desk removes the second factor silently. The
|
|
11171
|
-
* notification is what makes it an event the owner can detect and dispute.
|
|
11172
|
-
* - **It is logged** under its own prefix, so an administrative removal is distinguishable
|
|
11173
|
-
* from a user-initiated one in the library's own log.
|
|
11174
|
-
*
|
|
11175
|
-
* The `afterMfaDisabled` hook fires too, so consumer-side alerting keeps working. It is not
|
|
11176
|
-
* given a separate hook: the consumer is the one calling this method, so they already know
|
|
11177
|
-
* an administrative reset happened — the hook exists to tell them about the paths they do
|
|
11178
|
-
* not initiate.
|
|
11668
|
+
* Only TOTP codes are accepted — recovery codes cannot disable MFA by design. The flow lives in
|
|
11669
|
+
* {@link MfaManagementService.disable}.
|
|
11670
|
+
*
|
|
11671
|
+
* @param userId - Internal ID of the user disabling MFA.
|
|
11672
|
+
* @param code - 6-digit TOTP code from the authenticator app.
|
|
11673
|
+
* @param ip - Client IP address (forwarded to hooks).
|
|
11674
|
+
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
11675
|
+
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
11676
|
+
* @param tenantId - The tenant on the dashboard plane; absent on the platform plane.
|
|
11677
|
+
* @throws `TOKEN_INVALID` if the user is not found.
|
|
11678
|
+
* @throws `MFA_NOT_ENABLED` if MFA is not currently active.
|
|
11679
|
+
* @throws `ACCOUNT_LOCKED` if the brute-force threshold has been reached.
|
|
11680
|
+
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
11681
|
+
*/
|
|
11682
|
+
async disable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
|
|
11683
|
+
return this.management.disable(userId, code, ip, userAgent, context, tenantId, this.mfaOptions);
|
|
11684
|
+
}
|
|
11685
|
+
/**
|
|
11686
|
+
* Removes a user's second factor without their TOTP code, for a support desk facing a user who
|
|
11687
|
+
* has lost their authenticator AND their recovery codes.
|
|
11688
|
+
*
|
|
11689
|
+
* Authorising the caller is the consumer's job: the library ships no route for this. The flow
|
|
11690
|
+
* lives in {@link MfaManagementService.resetMfa}. Idempotent.
|
|
11179
11691
|
*
|
|
11180
11692
|
* @param userId - Internal ID of the user whose second factor is being removed.
|
|
11181
11693
|
* @param context - Which identity plane the user belongs to: `'dashboard'` (default) or
|
|
11182
11694
|
* `'platform'`. Must match the plane the account lives in, or the lookup misses.
|
|
11695
|
+
* @param tenantId - The tenant on the dashboard plane; absent on the platform plane.
|
|
11183
11696
|
* @throws `TOKEN_INVALID` if no user with that ID exists in the given plane.
|
|
11184
11697
|
*/
|
|
11185
11698
|
async resetMfa(userId, context = "dashboard", tenantId) {
|
|
11186
|
-
|
|
11187
|
-
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
11188
|
-
if (!user.mfaEnabled) {
|
|
11189
|
-
this.logger.log(`resetMfa: no second factor to remove userId=${logSafe(userId)} context=${context}`);
|
|
11190
|
-
return;
|
|
11191
|
-
}
|
|
11192
|
-
await this.records.transition(context, userId, tenantId, () => ({
|
|
11193
|
-
mfaEnabled: false,
|
|
11194
|
-
mfaSecret: null,
|
|
11195
|
-
mfaRecoveryCodes: null
|
|
11196
|
-
}));
|
|
11197
|
-
await this.redis.invalidateUserSessions(userId, tenantId, context);
|
|
11198
|
-
await this.redis.bumpUserTokenEpoch(userId, tenantId, context);
|
|
11199
|
-
this.logger.warn(`resetMfa: MFA removed administratively userId=${logSafe(userId)} context=${context}`);
|
|
11200
|
-
this.notify("resetMfa", userId, user, (provider, tenant, email) => provider.sendMfaDisabledNotification(tenant, email));
|
|
11201
|
-
const safeUser = committedSafeUser(context, user, false);
|
|
11202
|
-
if (this.hooks.afterMfaDisabled) {
|
|
11203
|
-
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
11204
|
-
plane: context,
|
|
11205
|
-
userId,
|
|
11206
|
-
// No request context: this call does not come from one. Empty rather than invented,
|
|
11207
|
-
// so a consumer logging the hook cannot mistake a placeholder for a real address.
|
|
11208
|
-
ip: "",
|
|
11209
|
-
userAgent: "",
|
|
11210
|
-
sanitizedHeaders: {}
|
|
11211
|
-
})).catch(() => void 0);
|
|
11212
|
-
}
|
|
11699
|
+
return this.management.resetMfa(userId, context, tenantId);
|
|
11213
11700
|
}
|
|
11214
|
-
// ---------------------------------------------------------------------------
|
|
11215
|
-
// regenerateRecoveryCodes — rotate the recovery code set for an MFA-enabled user
|
|
11216
|
-
// ---------------------------------------------------------------------------
|
|
11217
11701
|
/**
|
|
11218
|
-
* Regenerates the user's MFA recovery codes after verifying a current TOTP code.
|
|
11219
|
-
*
|
|
11220
|
-
*
|
|
11221
|
-
* (recovery codes cannot rotate themselves by design), the brute-force counter
|
|
11222
|
-
* is checked, and the regeneration is fired against the correct repository for
|
|
11223
|
-
* the supplied `context`. The TOTP secret on the user record is unchanged — only
|
|
11224
|
-
* the recovery code list is replaced.
|
|
11225
|
-
*
|
|
11226
|
-
* Returns the plain-text codes once. They are NOT persisted in plain form; only a
|
|
11227
|
-
* keyed HMAC-SHA-256 of each goes into the database. The caller is responsible for showing the
|
|
11228
|
-
* codes to the user exactly once and warning them to save them safely.
|
|
11229
|
-
*
|
|
11230
|
-
* @remarks
|
|
11231
|
-
* **Sessions are intentionally NOT invalidated after this call.** Unlike
|
|
11232
|
-
* {@link verifyAndEnable} (which flips `mfaEnabled` from `false` to `true`) and
|
|
11233
|
-
* {@link disable} (which flips it back to `false`), this method does not change
|
|
11234
|
-
* the verification credential — the TOTP secret stays the same and existing
|
|
11235
|
-
* `mfaVerified: true` access tokens remain valid. Invalidating sessions here
|
|
11236
|
-
* would force a redundant re-auth on every recovery-code rotation, which is a
|
|
11237
|
-
* routine hygiene action a user might perform several times over the lifetime
|
|
11238
|
-
* of an account.
|
|
11702
|
+
* Regenerates the user's MFA recovery codes after verifying a current TOTP code. Sessions are
|
|
11703
|
+
* intentionally NOT invalidated: the TOTP secret is unchanged. The flow lives in
|
|
11704
|
+
* {@link MfaManagementService.regenerateRecoveryCodes}.
|
|
11239
11705
|
*
|
|
11240
11706
|
* @param userId - Internal ID of the user rotating recovery codes.
|
|
11241
11707
|
* @param totpCode - 6-digit TOTP code from the authenticator app.
|
|
11242
11708
|
* @param ip - Client IP address (forwarded to hooks).
|
|
11243
11709
|
* @param userAgent - User-Agent header (forwarded to hooks).
|
|
11244
11710
|
* @param context - Which repository to use: `'dashboard'` (default) or `'platform'`.
|
|
11711
|
+
* @param tenantId - The tenant on the dashboard plane; absent on the platform plane.
|
|
11245
11712
|
* @throws `TOKEN_INVALID` if the user is not found or `mfaSecret` is missing
|
|
11246
11713
|
* when `mfaEnabled` is `true` (database inconsistency).
|
|
11247
11714
|
* @throws `MFA_NOT_ENABLED` if MFA is not currently active, or if
|
|
@@ -11252,118 +11719,35 @@ exports.MfaService = class _MfaService {
|
|
|
11252
11719
|
* @returns The freshly generated plain-text recovery codes, one-time display.
|
|
11253
11720
|
*/
|
|
11254
11721
|
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard", tenantId) {
|
|
11255
|
-
|
|
11256
|
-
if (context === "platform" && !this.platformUserRepo) {
|
|
11257
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11258
|
-
}
|
|
11259
|
-
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
11260
|
-
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11261
|
-
if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
|
|
11262
|
-
this.logger.warn(`regenerateRecoveryCodes: account locked userId=${logSafe(userId)} context=${context}`);
|
|
11263
|
-
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
11264
|
-
}
|
|
11265
|
-
if (!user.mfaSecret) {
|
|
11266
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11267
|
-
}
|
|
11268
|
-
const secretBase32 = decryptMfaSecret(user.mfaSecret, this.mfaOptions);
|
|
11269
|
-
const totpWindow = this.mfaOptions.totpWindow;
|
|
11270
|
-
const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow, tenantId);
|
|
11271
|
-
if (!codeValid) {
|
|
11272
|
-
await this.flowLockout.recordFailure("disable", context, userId, tenantId);
|
|
11273
|
-
this.logger.warn(`regenerateRecoveryCodes: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
11274
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
11275
|
-
}
|
|
11276
|
-
await this.flowLockout.reset("disable", context, userId, tenantId);
|
|
11277
|
-
const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
11278
|
-
const { plainCodes, hashedCodes } = generateRecoveryCodes(recoveryCount, this.options.hmacKey);
|
|
11279
|
-
const replaced = await this.records.transition(context, userId, tenantId, (current) => {
|
|
11280
|
-
if (!current.mfaEnabled) return null;
|
|
11281
|
-
return {
|
|
11282
|
-
mfaEnabled: true,
|
|
11283
|
-
mfaSecret: current.mfaSecret,
|
|
11284
|
-
mfaRecoveryCodes: hashedCodes
|
|
11285
|
-
};
|
|
11286
|
-
});
|
|
11287
|
-
if (!replaced) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11288
|
-
this.logger.log(`regenerateRecoveryCodes: recovery codes regenerated userId=${logSafe(userId)} context=${context}`);
|
|
11289
|
-
if (this.hooks.afterMfaRecoveryCodesRegenerated) {
|
|
11290
|
-
const safeUser = context === "platform" ? platformUserAsSafeUser(user) : toSafeUser3(user);
|
|
11291
|
-
void Promise.resolve(this.hooks.afterMfaRecoveryCodesRegenerated(safeUser, {
|
|
11292
|
-
plane: context,
|
|
11293
|
-
userId,
|
|
11294
|
-
ip,
|
|
11295
|
-
userAgent,
|
|
11296
|
-
sanitizedHeaders: {}
|
|
11297
|
-
})).catch(() => void 0);
|
|
11298
|
-
}
|
|
11299
|
-
return {
|
|
11300
|
-
recoveryCodes: plainCodes
|
|
11301
|
-
};
|
|
11302
|
-
}
|
|
11303
|
-
// ---------------------------------------------------------------------------
|
|
11304
|
-
// Private helpers
|
|
11305
|
-
// ---------------------------------------------------------------------------
|
|
11306
|
-
/**
|
|
11307
|
-
* Sends an MFA state-change notice, fire-and-forget, with the recipient kept out of the log.
|
|
11308
|
-
*
|
|
11309
|
-
* **Not awaited, and that is the fix, not a shortcut.** These three sends used to be awaited
|
|
11310
|
-
* with no `catch`, so a rejected delivery travelled out of the service to `AuthExceptionFilter`
|
|
11311
|
-
* — which answered the caller with an error for an operation that had ALREADY completed. By
|
|
11312
|
-
* that point the secret is written, the sessions are invalidated and the token epoch is bumped;
|
|
11313
|
-
* the user's second factor is on, and telling them it failed is how they end up locked out of
|
|
11314
|
-
* an account they just secured. `PasswordResetService.notifyPasswordChanged` had reached the
|
|
11315
|
-
* same conclusion for the same reason.
|
|
11316
|
-
*
|
|
11317
|
-
* **And the address does not reach the log.** The filter logged that error raw, and an SMTP
|
|
11318
|
-
* rejection routinely NAMES the recipient it refused (`550 user@example.com: recipient
|
|
11319
|
-
* rejected`) — no quoted body required, which makes it the likeliest exposure of the set.
|
|
11320
|
-
* `describeChannelStatus` publishes nothing the channel wrote, and nothing parsed off it either,
|
|
11321
|
-
* so no part of that name comes through. `withheld` covers the fields this line composes rather than the error, and
|
|
11322
|
-
* `safeLogLine` checks the seam the template opens between them.
|
|
11323
|
-
*
|
|
11324
|
-
* @param origin - The calling flow, for the log line.
|
|
11325
|
-
* @param userId - Whose account changed.
|
|
11326
|
-
* @param user - The account, read for its tenant and address.
|
|
11327
|
-
* @param send - Which notice to dispatch.
|
|
11328
|
-
*/
|
|
11329
|
-
notify(origin, userId, user, send) {
|
|
11330
|
-
const provider = this.emailProvider;
|
|
11331
|
-
const tenantId = emailTenantOf(user);
|
|
11332
|
-
const email = user.email;
|
|
11333
|
-
const withheld = [
|
|
11334
|
-
email
|
|
11335
|
-
];
|
|
11336
|
-
void (async () => {
|
|
11337
|
-
try {
|
|
11338
|
-
await send(provider, tenantId, email);
|
|
11339
|
-
} catch (err) {
|
|
11340
|
-
this.logger.error(safeLogLine(`${origin}: MFA notice delivery failed for user ${logSafe(userId)}: ` + describeChannelStatus(err), withheld));
|
|
11341
|
-
}
|
|
11342
|
-
})();
|
|
11722
|
+
return this.management.regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context, tenantId, this.mfaOptions);
|
|
11343
11723
|
}
|
|
11344
11724
|
};
|
|
11345
|
-
exports.MfaService =
|
|
11725
|
+
exports.MfaService = _ts_decorate42([
|
|
11346
11726
|
common.Injectable(),
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11727
|
+
_ts_param26(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11728
|
+
_ts_param26(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
11729
|
+
_ts_param26(2, common.Optional()),
|
|
11730
|
+
_ts_param26(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
11731
|
+
_ts_param26(3, common.Inject(AuthRedisService)),
|
|
11732
|
+
_ts_param26(4, common.Inject(TokenManagerService)),
|
|
11733
|
+
_ts_param26(5, common.Inject(MfaRecordService)),
|
|
11734
|
+
_ts_param26(6, common.Inject(MfaChallengeService)),
|
|
11735
|
+
_ts_param26(7, common.Inject(MfaManagementService)),
|
|
11736
|
+
_ts_param26(8, common.Inject(MfaFlowLockoutService)),
|
|
11737
|
+
_ts_param26(9, common.Inject(exports.ReauthenticationService)),
|
|
11738
|
+
_ts_param26(10, common.Inject(exports.SessionService)),
|
|
11739
|
+
_ts_param26(11, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
11740
|
+
_ts_param26(12, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
11741
|
+
_ts_metadata41("design:type", Function),
|
|
11742
|
+
_ts_metadata41("design:paramtypes", [
|
|
11361
11743
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
11362
11744
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
11363
11745
|
Object,
|
|
11364
11746
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
11365
11747
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
11366
11748
|
typeof MfaRecordService === "undefined" ? Object : MfaRecordService,
|
|
11749
|
+
typeof MfaChallengeService === "undefined" ? Object : MfaChallengeService,
|
|
11750
|
+
typeof MfaManagementService === "undefined" ? Object : MfaManagementService,
|
|
11367
11751
|
typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService,
|
|
11368
11752
|
typeof exports.ReauthenticationService === "undefined" ? Object : exports.ReauthenticationService,
|
|
11369
11753
|
typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
|
|
@@ -11373,7 +11757,7 @@ exports.MfaService = _ts_decorate40([
|
|
|
11373
11757
|
], exports.MfaService);
|
|
11374
11758
|
|
|
11375
11759
|
// src/server/controllers/mfa.controller.ts
|
|
11376
|
-
function
|
|
11760
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
11377
11761
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11378
11762
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11379
11763
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11386,19 +11770,19 @@ function _ts_decorate41(decorators, target, key, desc) {
|
|
|
11386
11770
|
}
|
|
11387
11771
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11388
11772
|
}
|
|
11389
|
-
__name(
|
|
11390
|
-
function
|
|
11773
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
11774
|
+
function _ts_metadata42(metadataKey, metadataValue) {
|
|
11391
11775
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11392
11776
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11393
11777
|
}
|
|
11394
11778
|
}
|
|
11395
|
-
__name(
|
|
11396
|
-
function
|
|
11779
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
11780
|
+
function _ts_param27(paramIndex, decorator) {
|
|
11397
11781
|
return function(target, key) {
|
|
11398
11782
|
decorator(target, key, paramIndex);
|
|
11399
11783
|
};
|
|
11400
11784
|
}
|
|
11401
|
-
__name(
|
|
11785
|
+
__name(_ts_param27, "_ts_param");
|
|
11402
11786
|
function isPlatformResult(result) {
|
|
11403
11787
|
return "admin" in result;
|
|
11404
11788
|
}
|
|
@@ -11587,111 +11971,111 @@ var MfaController = class {
|
|
|
11587
11971
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
|
|
11588
11972
|
}
|
|
11589
11973
|
};
|
|
11590
|
-
|
|
11974
|
+
_ts_decorate43([
|
|
11591
11975
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
11592
11976
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11593
11977
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11594
11978
|
RequestEncoding("when-body"),
|
|
11595
11979
|
common.Post("setup"),
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11980
|
+
_ts_param27(0, CurrentUser()),
|
|
11981
|
+
_ts_param27(1, common.Body()),
|
|
11982
|
+
_ts_metadata42("design:type", Function),
|
|
11983
|
+
_ts_metadata42("design:paramtypes", [
|
|
11600
11984
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11601
11985
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
11602
11986
|
]),
|
|
11603
|
-
|
|
11987
|
+
_ts_metadata42("design:returntype", Promise)
|
|
11604
11988
|
], MfaController.prototype, "setup", null);
|
|
11605
|
-
|
|
11989
|
+
_ts_decorate43([
|
|
11606
11990
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
11607
11991
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11608
11992
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11609
11993
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11610
11994
|
common.Post("verify-enable"),
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11995
|
+
_ts_param27(0, CurrentUser()),
|
|
11996
|
+
_ts_param27(1, common.Body()),
|
|
11997
|
+
_ts_param27(2, common.Req()),
|
|
11998
|
+
_ts_metadata42("design:type", Function),
|
|
11999
|
+
_ts_metadata42("design:paramtypes", [
|
|
11616
12000
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11617
12001
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
11618
12002
|
typeof Request === "undefined" ? Object : Request
|
|
11619
12003
|
]),
|
|
11620
|
-
|
|
12004
|
+
_ts_metadata42("design:returntype", Promise)
|
|
11621
12005
|
], MfaController.prototype, "verifyEnable", null);
|
|
11622
|
-
|
|
12006
|
+
_ts_decorate43([
|
|
11623
12007
|
Public(),
|
|
11624
12008
|
SkipMfa(),
|
|
11625
12009
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11626
12010
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11627
12011
|
common.HttpCode(common.HttpStatus.OK),
|
|
11628
12012
|
common.Post("challenge"),
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
12013
|
+
_ts_param27(0, common.Body()),
|
|
12014
|
+
_ts_param27(1, common.Req()),
|
|
12015
|
+
_ts_param27(2, common.Res({
|
|
11632
12016
|
passthrough: true
|
|
11633
12017
|
})),
|
|
11634
|
-
|
|
11635
|
-
|
|
12018
|
+
_ts_metadata42("design:type", Function),
|
|
12019
|
+
_ts_metadata42("design:paramtypes", [
|
|
11636
12020
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
11637
12021
|
typeof Request === "undefined" ? Object : Request,
|
|
11638
12022
|
typeof Response === "undefined" ? Object : Response
|
|
11639
12023
|
]),
|
|
11640
|
-
|
|
12024
|
+
_ts_metadata42("design:returntype", Promise)
|
|
11641
12025
|
], MfaController.prototype, "challenge", null);
|
|
11642
|
-
|
|
12026
|
+
_ts_decorate43([
|
|
11643
12027
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
11644
12028
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11645
12029
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11646
12030
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11647
12031
|
common.Post("disable"),
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
12032
|
+
_ts_param27(0, CurrentUser()),
|
|
12033
|
+
_ts_param27(1, common.Body()),
|
|
12034
|
+
_ts_param27(2, common.Req()),
|
|
12035
|
+
_ts_metadata42("design:type", Function),
|
|
12036
|
+
_ts_metadata42("design:paramtypes", [
|
|
11653
12037
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11654
12038
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
11655
12039
|
typeof Request === "undefined" ? Object : Request
|
|
11656
12040
|
]),
|
|
11657
|
-
|
|
12041
|
+
_ts_metadata42("design:returntype", Promise)
|
|
11658
12042
|
], MfaController.prototype, "disable", null);
|
|
11659
|
-
|
|
12043
|
+
_ts_decorate43([
|
|
11660
12044
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
11661
12045
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11662
12046
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11663
12047
|
common.HttpCode(common.HttpStatus.OK),
|
|
11664
12048
|
common.Post("recovery-codes"),
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
12049
|
+
_ts_param27(0, CurrentUser()),
|
|
12050
|
+
_ts_param27(1, common.Body()),
|
|
12051
|
+
_ts_param27(2, common.Req()),
|
|
12052
|
+
_ts_metadata42("design:type", Function),
|
|
12053
|
+
_ts_metadata42("design:paramtypes", [
|
|
11670
12054
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11671
12055
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
11672
12056
|
typeof Request === "undefined" ? Object : Request
|
|
11673
12057
|
]),
|
|
11674
|
-
|
|
12058
|
+
_ts_metadata42("design:returntype", Promise)
|
|
11675
12059
|
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
11676
|
-
MfaController =
|
|
12060
|
+
MfaController = _ts_decorate43([
|
|
11677
12061
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11678
12062
|
common.Controller("mfa"),
|
|
11679
12063
|
common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
11680
12064
|
common.UsePipes(createAuthValidationPipe({
|
|
11681
12065
|
forbidUnknownValues: true
|
|
11682
12066
|
})),
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
12067
|
+
_ts_param27(0, common.Inject(exports.MfaService)),
|
|
12068
|
+
_ts_param27(1, common.Inject(exports.TokenDeliveryService)),
|
|
12069
|
+
_ts_param27(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
12070
|
+
_ts_metadata42("design:type", Function),
|
|
12071
|
+
_ts_metadata42("design:paramtypes", [
|
|
11688
12072
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
11689
12073
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
11690
12074
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11691
12075
|
])
|
|
11692
12076
|
], MfaController);
|
|
11693
12077
|
var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
|
|
11694
|
-
function
|
|
12078
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
11695
12079
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11696
12080
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11697
12081
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11704,13 +12088,13 @@ function _ts_decorate42(decorators, target, key, desc) {
|
|
|
11704
12088
|
}
|
|
11705
12089
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11706
12090
|
}
|
|
11707
|
-
__name(
|
|
11708
|
-
function
|
|
12091
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
12092
|
+
function _ts_metadata43(metadataKey, metadataValue) {
|
|
11709
12093
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11710
12094
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11711
12095
|
}
|
|
11712
12096
|
}
|
|
11713
|
-
__name(
|
|
12097
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
11714
12098
|
var ChangePasswordDto = class {
|
|
11715
12099
|
static {
|
|
11716
12100
|
__name(this, "ChangePasswordDto");
|
|
@@ -11763,26 +12147,26 @@ var ChangePasswordDto = class {
|
|
|
11763
12147
|
*/
|
|
11764
12148
|
refreshToken;
|
|
11765
12149
|
};
|
|
11766
|
-
|
|
12150
|
+
_ts_decorate44([
|
|
11767
12151
|
classValidator.IsString(),
|
|
11768
12152
|
classValidator.MinLength(1),
|
|
11769
12153
|
classValidator.MaxLength(128),
|
|
11770
|
-
|
|
12154
|
+
_ts_metadata43("design:type", String)
|
|
11771
12155
|
], ChangePasswordDto.prototype, "currentPassword", void 0);
|
|
11772
|
-
|
|
12156
|
+
_ts_decorate44([
|
|
11773
12157
|
classValidator.IsString(),
|
|
11774
12158
|
classValidator.MinLength(8),
|
|
11775
12159
|
classValidator.MaxLength(128),
|
|
11776
|
-
|
|
12160
|
+
_ts_metadata43("design:type", String)
|
|
11777
12161
|
], ChangePasswordDto.prototype, "newPassword", void 0);
|
|
11778
|
-
|
|
12162
|
+
_ts_decorate44([
|
|
11779
12163
|
classValidator.IsOptional(),
|
|
11780
12164
|
classValidator.IsString(),
|
|
11781
12165
|
classValidator.IsNotEmpty(),
|
|
11782
12166
|
classValidator.MaxLength(2048),
|
|
11783
|
-
|
|
12167
|
+
_ts_metadata43("design:type", String)
|
|
11784
12168
|
], ChangePasswordDto.prototype, "refreshToken", void 0);
|
|
11785
|
-
function
|
|
12169
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
11786
12170
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11787
12171
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11788
12172
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11795,13 +12179,13 @@ function _ts_decorate43(decorators, target, key, desc) {
|
|
|
11795
12179
|
}
|
|
11796
12180
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11797
12181
|
}
|
|
11798
|
-
__name(
|
|
11799
|
-
function
|
|
12182
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
12183
|
+
function _ts_metadata44(metadataKey, metadataValue) {
|
|
11800
12184
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11801
12185
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11802
12186
|
}
|
|
11803
12187
|
}
|
|
11804
|
-
__name(
|
|
12188
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
11805
12189
|
var ForgotPasswordDto = class {
|
|
11806
12190
|
static {
|
|
11807
12191
|
__name(this, "ForgotPasswordDto");
|
|
@@ -11817,13 +12201,13 @@ var ForgotPasswordDto = class {
|
|
|
11817
12201
|
*/
|
|
11818
12202
|
tenantId;
|
|
11819
12203
|
};
|
|
11820
|
-
|
|
12204
|
+
_ts_decorate45([
|
|
11821
12205
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11822
12206
|
classValidator.IsEmail(),
|
|
11823
12207
|
classValidator.MaxLength(255),
|
|
11824
|
-
|
|
12208
|
+
_ts_metadata44("design:type", String)
|
|
11825
12209
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
11826
|
-
|
|
12210
|
+
_ts_decorate45([
|
|
11827
12211
|
classValidator.IsOptional(),
|
|
11828
12212
|
classValidator.IsString(),
|
|
11829
12213
|
classValidator.IsNotEmpty(),
|
|
@@ -11831,9 +12215,9 @@ _ts_decorate43([
|
|
|
11831
12215
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
11832
12216
|
message: "tenantId must not contain control characters"
|
|
11833
12217
|
}),
|
|
11834
|
-
|
|
12218
|
+
_ts_metadata44("design:type", String)
|
|
11835
12219
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
11836
|
-
function
|
|
12220
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
11837
12221
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11838
12222
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11839
12223
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11846,13 +12230,13 @@ function _ts_decorate44(decorators, target, key, desc) {
|
|
|
11846
12230
|
}
|
|
11847
12231
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11848
12232
|
}
|
|
11849
|
-
__name(
|
|
11850
|
-
function
|
|
12233
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
12234
|
+
function _ts_metadata45(metadataKey, metadataValue) {
|
|
11851
12235
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11852
12236
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11853
12237
|
}
|
|
11854
12238
|
}
|
|
11855
|
-
__name(
|
|
12239
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
11856
12240
|
var ResendOtpDto = class {
|
|
11857
12241
|
static {
|
|
11858
12242
|
__name(this, "ResendOtpDto");
|
|
@@ -11867,13 +12251,13 @@ var ResendOtpDto = class {
|
|
|
11867
12251
|
*/
|
|
11868
12252
|
tenantId;
|
|
11869
12253
|
};
|
|
11870
|
-
|
|
12254
|
+
_ts_decorate46([
|
|
11871
12255
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11872
12256
|
classValidator.IsEmail(),
|
|
11873
12257
|
classValidator.MaxLength(255),
|
|
11874
|
-
|
|
12258
|
+
_ts_metadata45("design:type", String)
|
|
11875
12259
|
], ResendOtpDto.prototype, "email", void 0);
|
|
11876
|
-
|
|
12260
|
+
_ts_decorate46([
|
|
11877
12261
|
classValidator.IsOptional(),
|
|
11878
12262
|
classValidator.IsString(),
|
|
11879
12263
|
classValidator.IsNotEmpty(),
|
|
@@ -11881,9 +12265,9 @@ _ts_decorate44([
|
|
|
11881
12265
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
11882
12266
|
message: "tenantId must not contain control characters"
|
|
11883
12267
|
}),
|
|
11884
|
-
|
|
12268
|
+
_ts_metadata45("design:type", String)
|
|
11885
12269
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
11886
|
-
function
|
|
12270
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
11887
12271
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11888
12272
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11889
12273
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11896,13 +12280,13 @@ function _ts_decorate45(decorators, target, key, desc) {
|
|
|
11896
12280
|
}
|
|
11897
12281
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11898
12282
|
}
|
|
11899
|
-
__name(
|
|
11900
|
-
function
|
|
12283
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
12284
|
+
function _ts_metadata46(metadataKey, metadataValue) {
|
|
11901
12285
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11902
12286
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11903
12287
|
}
|
|
11904
12288
|
}
|
|
11905
|
-
__name(
|
|
12289
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
11906
12290
|
var ResetPasswordDto = class {
|
|
11907
12291
|
static {
|
|
11908
12292
|
__name(this, "ResetPasswordDto");
|
|
@@ -11949,38 +12333,38 @@ var ResetPasswordDto = class {
|
|
|
11949
12333
|
*/
|
|
11950
12334
|
tenantId;
|
|
11951
12335
|
};
|
|
11952
|
-
|
|
12336
|
+
_ts_decorate47([
|
|
11953
12337
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11954
12338
|
classValidator.IsEmail(),
|
|
11955
12339
|
classValidator.MaxLength(255),
|
|
11956
|
-
|
|
12340
|
+
_ts_metadata46("design:type", String)
|
|
11957
12341
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
11958
|
-
|
|
12342
|
+
_ts_decorate47([
|
|
11959
12343
|
classValidator.IsString(),
|
|
11960
12344
|
classValidator.MinLength(8),
|
|
11961
12345
|
classValidator.MaxLength(128),
|
|
11962
|
-
|
|
12346
|
+
_ts_metadata46("design:type", String)
|
|
11963
12347
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
11964
|
-
|
|
12348
|
+
_ts_decorate47([
|
|
11965
12349
|
classValidator.IsOptional(),
|
|
11966
12350
|
classValidator.IsString(),
|
|
11967
12351
|
classValidator.IsNotEmpty(),
|
|
11968
12352
|
classValidator.MaxLength(2048),
|
|
11969
|
-
|
|
12353
|
+
_ts_metadata46("design:type", String)
|
|
11970
12354
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
11971
|
-
|
|
12355
|
+
_ts_decorate47([
|
|
11972
12356
|
classValidator.IsOptional(),
|
|
11973
12357
|
classValidator.IsString(),
|
|
11974
12358
|
classValidator.Length(4, 8),
|
|
11975
|
-
|
|
12359
|
+
_ts_metadata46("design:type", String)
|
|
11976
12360
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
11977
|
-
|
|
12361
|
+
_ts_decorate47([
|
|
11978
12362
|
classValidator.IsOptional(),
|
|
11979
12363
|
classValidator.IsString(),
|
|
11980
12364
|
classValidator.Length(64, 64),
|
|
11981
|
-
|
|
12365
|
+
_ts_metadata46("design:type", String)
|
|
11982
12366
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
11983
|
-
|
|
12367
|
+
_ts_decorate47([
|
|
11984
12368
|
classValidator.IsOptional(),
|
|
11985
12369
|
classValidator.IsString(),
|
|
11986
12370
|
classValidator.IsNotEmpty(),
|
|
@@ -11988,9 +12372,9 @@ _ts_decorate45([
|
|
|
11988
12372
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
11989
12373
|
message: "tenantId must not contain control characters"
|
|
11990
12374
|
}),
|
|
11991
|
-
|
|
12375
|
+
_ts_metadata46("design:type", String)
|
|
11992
12376
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
11993
|
-
function
|
|
12377
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
11994
12378
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11995
12379
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11996
12380
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12003,13 +12387,13 @@ function _ts_decorate46(decorators, target, key, desc) {
|
|
|
12003
12387
|
}
|
|
12004
12388
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12005
12389
|
}
|
|
12006
|
-
__name(
|
|
12007
|
-
function
|
|
12390
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
12391
|
+
function _ts_metadata47(metadataKey, metadataValue) {
|
|
12008
12392
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12009
12393
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12010
12394
|
}
|
|
12011
12395
|
}
|
|
12012
|
-
__name(
|
|
12396
|
+
__name(_ts_metadata47, "_ts_metadata");
|
|
12013
12397
|
var VerifyOtpDto = class {
|
|
12014
12398
|
static {
|
|
12015
12399
|
__name(this, "VerifyOtpDto");
|
|
@@ -12031,18 +12415,18 @@ var VerifyOtpDto = class {
|
|
|
12031
12415
|
*/
|
|
12032
12416
|
tenantId;
|
|
12033
12417
|
};
|
|
12034
|
-
|
|
12418
|
+
_ts_decorate48([
|
|
12035
12419
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
12036
12420
|
classValidator.IsEmail(),
|
|
12037
12421
|
classValidator.MaxLength(255),
|
|
12038
|
-
|
|
12422
|
+
_ts_metadata47("design:type", String)
|
|
12039
12423
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
12040
|
-
|
|
12424
|
+
_ts_decorate48([
|
|
12041
12425
|
classValidator.IsString(),
|
|
12042
12426
|
classValidator.Length(4, 8),
|
|
12043
|
-
|
|
12427
|
+
_ts_metadata47("design:type", String)
|
|
12044
12428
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
12045
|
-
|
|
12429
|
+
_ts_decorate48([
|
|
12046
12430
|
classValidator.IsOptional(),
|
|
12047
12431
|
classValidator.IsString(),
|
|
12048
12432
|
classValidator.IsNotEmpty(),
|
|
@@ -12050,7 +12434,7 @@ _ts_decorate46([
|
|
|
12050
12434
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
12051
12435
|
message: "tenantId must not contain control characters"
|
|
12052
12436
|
}),
|
|
12053
|
-
|
|
12437
|
+
_ts_metadata47("design:type", String)
|
|
12054
12438
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
12055
12439
|
|
|
12056
12440
|
// src/server/utils/answer-reset-request.ts
|
|
@@ -12097,7 +12481,7 @@ async function answerResetRequest(deps, request) {
|
|
|
12097
12481
|
__name(answerResetRequest, "answerResetRequest");
|
|
12098
12482
|
|
|
12099
12483
|
// src/server/services/password-reset.service.ts
|
|
12100
|
-
function
|
|
12484
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
12101
12485
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12102
12486
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12103
12487
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12109,20 +12493,20 @@ function _ts_decorate47(decorators, target, key, desc) {
|
|
|
12109
12493
|
}
|
|
12110
12494
|
}
|
|
12111
12495
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12112
|
-
}
|
|
12113
|
-
__name(
|
|
12114
|
-
function
|
|
12496
|
+
}
|
|
12497
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
12498
|
+
function _ts_metadata48(metadataKey, metadataValue) {
|
|
12115
12499
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12116
12500
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12117
12501
|
}
|
|
12118
12502
|
}
|
|
12119
|
-
__name(
|
|
12120
|
-
function
|
|
12503
|
+
__name(_ts_metadata48, "_ts_metadata");
|
|
12504
|
+
function _ts_param28(paramIndex, decorator) {
|
|
12121
12505
|
return function(target, key) {
|
|
12122
12506
|
decorator(target, key, paramIndex);
|
|
12123
12507
|
};
|
|
12124
12508
|
}
|
|
12125
|
-
__name(
|
|
12509
|
+
__name(_ts_param28, "_ts_param");
|
|
12126
12510
|
var ANTI_ENUM_MIN_MS2 = 300;
|
|
12127
12511
|
var VERIFIED_TOKEN_TTL_SECONDS = 300;
|
|
12128
12512
|
var PASSWORD_RESET_PURPOSE = "password_reset";
|
|
@@ -12716,21 +13100,21 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
12716
13100
|
};
|
|
12717
13101
|
}
|
|
12718
13102
|
};
|
|
12719
|
-
exports.PasswordResetService =
|
|
13103
|
+
exports.PasswordResetService = _ts_decorate49([
|
|
12720
13104
|
common.Injectable(),
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
13105
|
+
_ts_param28(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13106
|
+
_ts_param28(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
13107
|
+
_ts_param28(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
13108
|
+
_ts_param28(2, common.Optional()),
|
|
13109
|
+
_ts_param28(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
13110
|
+
_ts_param28(3, common.Optional()),
|
|
13111
|
+
_ts_param28(4, common.Inject(exports.OtpService)),
|
|
13112
|
+
_ts_param28(5, common.Inject(PasswordService)),
|
|
13113
|
+
_ts_param28(6, common.Inject(AuthRedisService)),
|
|
13114
|
+
_ts_param28(7, common.Inject(exports.SessionService)),
|
|
13115
|
+
_ts_param28(8, common.Inject(exports.BruteForceService)),
|
|
13116
|
+
_ts_metadata48("design:type", Function),
|
|
13117
|
+
_ts_metadata48("design:paramtypes", [
|
|
12734
13118
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
12735
13119
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
12736
13120
|
Object,
|
|
@@ -12749,7 +13133,7 @@ function toSafeUser4(user) {
|
|
|
12749
13133
|
__name(toSafeUser4, "toSafeUser");
|
|
12750
13134
|
|
|
12751
13135
|
// src/server/controllers/password-reset.controller.ts
|
|
12752
|
-
function
|
|
13136
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
12753
13137
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12754
13138
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12755
13139
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12762,19 +13146,19 @@ function _ts_decorate48(decorators, target, key, desc) {
|
|
|
12762
13146
|
}
|
|
12763
13147
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12764
13148
|
}
|
|
12765
|
-
__name(
|
|
12766
|
-
function
|
|
13149
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
13150
|
+
function _ts_metadata49(metadataKey, metadataValue) {
|
|
12767
13151
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12768
13152
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12769
13153
|
}
|
|
12770
13154
|
}
|
|
12771
|
-
__name(
|
|
12772
|
-
function
|
|
13155
|
+
__name(_ts_metadata49, "_ts_metadata");
|
|
13156
|
+
function _ts_param29(paramIndex, decorator) {
|
|
12773
13157
|
return function(target, key) {
|
|
12774
13158
|
decorator(target, key, paramIndex);
|
|
12775
13159
|
};
|
|
12776
13160
|
}
|
|
12777
|
-
__name(
|
|
13161
|
+
__name(_ts_param29, "_ts_param");
|
|
12778
13162
|
var PasswordResetController = class {
|
|
12779
13163
|
static {
|
|
12780
13164
|
__name(this, "PasswordResetController");
|
|
@@ -12893,95 +13277,95 @@ var PasswordResetController = class {
|
|
|
12893
13277
|
return {};
|
|
12894
13278
|
}
|
|
12895
13279
|
};
|
|
12896
|
-
|
|
13280
|
+
_ts_decorate50([
|
|
12897
13281
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
12898
13282
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
12899
13283
|
common.HttpCode(common.HttpStatus.OK),
|
|
12900
13284
|
common.Post("forgot-password"),
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12904
|
-
|
|
13285
|
+
_ts_param29(0, common.Body()),
|
|
13286
|
+
_ts_param29(1, common.Req()),
|
|
13287
|
+
_ts_metadata49("design:type", Function),
|
|
13288
|
+
_ts_metadata49("design:paramtypes", [
|
|
12905
13289
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
|
|
12906
13290
|
typeof Request === "undefined" ? Object : Request
|
|
12907
13291
|
]),
|
|
12908
|
-
|
|
13292
|
+
_ts_metadata49("design:returntype", Promise)
|
|
12909
13293
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
12910
|
-
|
|
13294
|
+
_ts_decorate50([
|
|
12911
13295
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
12912
13296
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
12913
13297
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
12914
13298
|
common.Post("reset-password"),
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
13299
|
+
_ts_param29(0, common.Body()),
|
|
13300
|
+
_ts_param29(1, common.Req()),
|
|
13301
|
+
_ts_metadata49("design:type", Function),
|
|
13302
|
+
_ts_metadata49("design:paramtypes", [
|
|
12919
13303
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
|
|
12920
13304
|
typeof Request === "undefined" ? Object : Request
|
|
12921
13305
|
]),
|
|
12922
|
-
|
|
13306
|
+
_ts_metadata49("design:returntype", Promise)
|
|
12923
13307
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
12924
|
-
|
|
13308
|
+
_ts_decorate50([
|
|
12925
13309
|
Authenticated(),
|
|
12926
13310
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
12927
13311
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
12928
13312
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
12929
13313
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
12930
13314
|
common.Post("change"),
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
13315
|
+
_ts_param29(0, CurrentUser()),
|
|
13316
|
+
_ts_param29(1, common.Body()),
|
|
13317
|
+
_ts_param29(2, common.Req()),
|
|
13318
|
+
_ts_metadata49("design:type", Function),
|
|
13319
|
+
_ts_metadata49("design:paramtypes", [
|
|
12936
13320
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
12937
13321
|
typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
|
|
12938
13322
|
typeof Request === "undefined" ? Object : Request
|
|
12939
13323
|
]),
|
|
12940
|
-
|
|
13324
|
+
_ts_metadata49("design:returntype", Promise)
|
|
12941
13325
|
], PasswordResetController.prototype, "changePassword", null);
|
|
12942
|
-
|
|
13326
|
+
_ts_decorate50([
|
|
12943
13327
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
12944
13328
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
12945
13329
|
common.HttpCode(common.HttpStatus.OK),
|
|
12946
13330
|
common.Post("verify-otp"),
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
13331
|
+
_ts_param29(0, common.Body()),
|
|
13332
|
+
_ts_param29(1, common.Req()),
|
|
13333
|
+
_ts_metadata49("design:type", Function),
|
|
13334
|
+
_ts_metadata49("design:paramtypes", [
|
|
12951
13335
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
|
|
12952
13336
|
typeof Request === "undefined" ? Object : Request
|
|
12953
13337
|
]),
|
|
12954
|
-
|
|
13338
|
+
_ts_metadata49("design:returntype", Promise)
|
|
12955
13339
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
12956
|
-
|
|
13340
|
+
_ts_decorate50([
|
|
12957
13341
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
12958
13342
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
12959
13343
|
common.HttpCode(common.HttpStatus.OK),
|
|
12960
13344
|
common.Post("resend-otp"),
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
13345
|
+
_ts_param29(0, common.Body()),
|
|
13346
|
+
_ts_param29(1, common.Req()),
|
|
13347
|
+
_ts_metadata49("design:type", Function),
|
|
13348
|
+
_ts_metadata49("design:paramtypes", [
|
|
12965
13349
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
|
|
12966
13350
|
typeof Request === "undefined" ? Object : Request
|
|
12967
13351
|
]),
|
|
12968
|
-
|
|
13352
|
+
_ts_metadata49("design:returntype", Promise)
|
|
12969
13353
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
12970
|
-
PasswordResetController =
|
|
13354
|
+
PasswordResetController = _ts_decorate50([
|
|
12971
13355
|
Public(),
|
|
12972
13356
|
common.UseInterceptors(NoStoreInterceptor),
|
|
12973
13357
|
common.Controller("password"),
|
|
12974
13358
|
common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
12975
13359
|
common.UsePipes(createAuthValidationPipe()),
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
13360
|
+
_ts_param29(0, common.Inject(exports.PasswordResetService)),
|
|
13361
|
+
_ts_param29(1, common.Inject(exports.TokenDeliveryService)),
|
|
13362
|
+
_ts_metadata49("design:type", Function),
|
|
13363
|
+
_ts_metadata49("design:paramtypes", [
|
|
12980
13364
|
typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
|
|
12981
13365
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
12982
13366
|
])
|
|
12983
13367
|
], PasswordResetController);
|
|
12984
|
-
function
|
|
13368
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
12985
13369
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12986
13370
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12987
13371
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12994,13 +13378,13 @@ function _ts_decorate49(decorators, target, key, desc) {
|
|
|
12994
13378
|
}
|
|
12995
13379
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12996
13380
|
}
|
|
12997
|
-
__name(
|
|
12998
|
-
function
|
|
13381
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
13382
|
+
function _ts_metadata50(metadataKey, metadataValue) {
|
|
12999
13383
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13000
13384
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13001
13385
|
}
|
|
13002
13386
|
}
|
|
13003
|
-
__name(
|
|
13387
|
+
__name(_ts_metadata50, "_ts_metadata");
|
|
13004
13388
|
var PlatformLoginDto = class {
|
|
13005
13389
|
static {
|
|
13006
13390
|
__name(this, "PlatformLoginDto");
|
|
@@ -13028,14 +13412,14 @@ var PlatformLoginDto = class {
|
|
|
13028
13412
|
*/
|
|
13029
13413
|
password;
|
|
13030
13414
|
};
|
|
13031
|
-
|
|
13415
|
+
_ts_decorate51([
|
|
13032
13416
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
13033
13417
|
classValidator.IsEmail(),
|
|
13034
13418
|
classValidator.IsNotEmpty(),
|
|
13035
13419
|
classValidator.MaxLength(255),
|
|
13036
|
-
|
|
13420
|
+
_ts_metadata50("design:type", String)
|
|
13037
13421
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
13038
|
-
|
|
13422
|
+
_ts_decorate51([
|
|
13039
13423
|
classValidator.IsString(),
|
|
13040
13424
|
classValidator.IsNotEmpty(),
|
|
13041
13425
|
classValidator.Matches(/\S/, {
|
|
@@ -13043,9 +13427,9 @@ _ts_decorate49([
|
|
|
13043
13427
|
}),
|
|
13044
13428
|
classValidator.MinLength(1),
|
|
13045
13429
|
classValidator.MaxLength(128),
|
|
13046
|
-
|
|
13430
|
+
_ts_metadata50("design:type", String)
|
|
13047
13431
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
13048
|
-
function
|
|
13432
|
+
function _ts_decorate52(decorators, target, key, desc) {
|
|
13049
13433
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13050
13434
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13051
13435
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13058,19 +13442,19 @@ function _ts_decorate50(decorators, target, key, desc) {
|
|
|
13058
13442
|
}
|
|
13059
13443
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13060
13444
|
}
|
|
13061
|
-
__name(
|
|
13062
|
-
function
|
|
13445
|
+
__name(_ts_decorate52, "_ts_decorate");
|
|
13446
|
+
function _ts_metadata51(metadataKey, metadataValue) {
|
|
13063
13447
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13064
13448
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13065
13449
|
}
|
|
13066
13450
|
}
|
|
13067
|
-
__name(
|
|
13068
|
-
function
|
|
13451
|
+
__name(_ts_metadata51, "_ts_metadata");
|
|
13452
|
+
function _ts_param30(paramIndex, decorator) {
|
|
13069
13453
|
return function(target, key) {
|
|
13070
13454
|
decorator(target, key, paramIndex);
|
|
13071
13455
|
};
|
|
13072
13456
|
}
|
|
13073
|
-
__name(
|
|
13457
|
+
__name(_ts_param30, "_ts_param");
|
|
13074
13458
|
exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
13075
13459
|
static {
|
|
13076
13460
|
__name(this, "JwtPlatformGuard");
|
|
@@ -13116,15 +13500,15 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
|
13116
13500
|
return true;
|
|
13117
13501
|
}
|
|
13118
13502
|
};
|
|
13119
|
-
exports.JwtPlatformGuard =
|
|
13503
|
+
exports.JwtPlatformGuard = _ts_decorate52([
|
|
13120
13504
|
common.Injectable(),
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
|
|
13126
|
-
|
|
13127
|
-
|
|
13505
|
+
_ts_param30(0, common.Inject(jwt.JwtService)),
|
|
13506
|
+
_ts_param30(1, common.Inject(exports.TokenDeliveryService)),
|
|
13507
|
+
_ts_param30(2, common.Inject(exports.AuthRevocationService)),
|
|
13508
|
+
_ts_param30(3, common.Inject(core.Reflector)),
|
|
13509
|
+
_ts_param30(4, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13510
|
+
_ts_metadata51("design:type", Function),
|
|
13511
|
+
_ts_metadata51("design:paramtypes", [
|
|
13128
13512
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
13129
13513
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
13130
13514
|
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
@@ -13132,7 +13516,7 @@ exports.JwtPlatformGuard = _ts_decorate50([
|
|
|
13132
13516
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13133
13517
|
])
|
|
13134
13518
|
], exports.JwtPlatformGuard);
|
|
13135
|
-
function
|
|
13519
|
+
function _ts_decorate53(decorators, target, key, desc) {
|
|
13136
13520
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13137
13521
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13138
13522
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13145,19 +13529,19 @@ function _ts_decorate51(decorators, target, key, desc) {
|
|
|
13145
13529
|
}
|
|
13146
13530
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13147
13531
|
}
|
|
13148
|
-
__name(
|
|
13149
|
-
function
|
|
13532
|
+
__name(_ts_decorate53, "_ts_decorate");
|
|
13533
|
+
function _ts_metadata52(metadataKey, metadataValue) {
|
|
13150
13534
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13151
13535
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13152
13536
|
}
|
|
13153
13537
|
}
|
|
13154
|
-
__name(
|
|
13155
|
-
function
|
|
13538
|
+
__name(_ts_metadata52, "_ts_metadata");
|
|
13539
|
+
function _ts_param31(paramIndex, decorator) {
|
|
13156
13540
|
return function(target, key) {
|
|
13157
13541
|
decorator(target, key, paramIndex);
|
|
13158
13542
|
};
|
|
13159
13543
|
}
|
|
13160
|
-
__name(
|
|
13544
|
+
__name(_ts_param31, "_ts_param");
|
|
13161
13545
|
exports.PlatformAuthService = class _PlatformAuthService {
|
|
13162
13546
|
static {
|
|
13163
13547
|
__name(this, "PlatformAuthService");
|
|
@@ -13450,18 +13834,18 @@ exports.PlatformAuthService = class _PlatformAuthService {
|
|
|
13450
13834
|
await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
|
|
13451
13835
|
}
|
|
13452
13836
|
};
|
|
13453
|
-
exports.PlatformAuthService =
|
|
13837
|
+
exports.PlatformAuthService = _ts_decorate53([
|
|
13454
13838
|
common.Injectable(),
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13839
|
+
_ts_param31(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
13840
|
+
_ts_param31(1, common.Inject(PasswordService)),
|
|
13841
|
+
_ts_param31(2, common.Inject(TokenManagerService)),
|
|
13842
|
+
_ts_param31(3, common.Inject(exports.BruteForceService)),
|
|
13843
|
+
_ts_param31(4, common.Inject(AuthRedisService)),
|
|
13844
|
+
_ts_param31(5, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13845
|
+
_ts_param31(6, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
13846
|
+
_ts_param31(6, common.Optional()),
|
|
13847
|
+
_ts_metadata52("design:type", Function),
|
|
13848
|
+
_ts_metadata52("design:paramtypes", [
|
|
13465
13849
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
13466
13850
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
13467
13851
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -13473,7 +13857,7 @@ exports.PlatformAuthService = _ts_decorate51([
|
|
|
13473
13857
|
], exports.PlatformAuthService);
|
|
13474
13858
|
|
|
13475
13859
|
// src/server/controllers/platform-auth.controller.ts
|
|
13476
|
-
function
|
|
13860
|
+
function _ts_decorate54(decorators, target, key, desc) {
|
|
13477
13861
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13478
13862
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13479
13863
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13486,19 +13870,19 @@ function _ts_decorate52(decorators, target, key, desc) {
|
|
|
13486
13870
|
}
|
|
13487
13871
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13488
13872
|
}
|
|
13489
|
-
__name(
|
|
13490
|
-
function
|
|
13873
|
+
__name(_ts_decorate54, "_ts_decorate");
|
|
13874
|
+
function _ts_metadata53(metadataKey, metadataValue) {
|
|
13491
13875
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13492
13876
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13493
13877
|
}
|
|
13494
13878
|
}
|
|
13495
|
-
__name(
|
|
13496
|
-
function
|
|
13879
|
+
__name(_ts_metadata53, "_ts_metadata");
|
|
13880
|
+
function _ts_param32(paramIndex, decorator) {
|
|
13497
13881
|
return function(target, key) {
|
|
13498
13882
|
decorator(target, key, paramIndex);
|
|
13499
13883
|
};
|
|
13500
13884
|
}
|
|
13501
|
-
__name(
|
|
13885
|
+
__name(_ts_param32, "_ts_param");
|
|
13502
13886
|
function isMfaChallenge2(result) {
|
|
13503
13887
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
13504
13888
|
}
|
|
@@ -13644,103 +14028,103 @@ var PlatformAuthController = class {
|
|
|
13644
14028
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
13645
14029
|
}
|
|
13646
14030
|
};
|
|
13647
|
-
|
|
14031
|
+
_ts_decorate54([
|
|
13648
14032
|
Public(),
|
|
13649
14033
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
13650
14034
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
13651
14035
|
common.HttpCode(common.HttpStatus.OK),
|
|
13652
14036
|
common.Post("login"),
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
14037
|
+
_ts_param32(0, common.Body()),
|
|
14038
|
+
_ts_param32(1, common.Req()),
|
|
14039
|
+
_ts_metadata53("design:type", Function),
|
|
14040
|
+
_ts_metadata53("design:paramtypes", [
|
|
13657
14041
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
13658
14042
|
typeof Request === "undefined" ? Object : Request
|
|
13659
14043
|
]),
|
|
13660
|
-
|
|
14044
|
+
_ts_metadata53("design:returntype", Promise)
|
|
13661
14045
|
], PlatformAuthController.prototype, "login", null);
|
|
13662
|
-
|
|
14046
|
+
_ts_decorate54([
|
|
13663
14047
|
Public(),
|
|
13664
14048
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
13665
14049
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
13666
14050
|
common.HttpCode(common.HttpStatus.OK),
|
|
13667
14051
|
common.Post("mfa/challenge"),
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
14052
|
+
_ts_param32(0, common.Body()),
|
|
14053
|
+
_ts_param32(1, common.Req()),
|
|
14054
|
+
_ts_metadata53("design:type", Function),
|
|
14055
|
+
_ts_metadata53("design:paramtypes", [
|
|
13672
14056
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
13673
14057
|
typeof Request === "undefined" ? Object : Request
|
|
13674
14058
|
]),
|
|
13675
|
-
|
|
14059
|
+
_ts_metadata53("design:returntype", Promise)
|
|
13676
14060
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
13677
|
-
|
|
14061
|
+
_ts_decorate54([
|
|
13678
14062
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
13679
14063
|
common.Get("me"),
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
14064
|
+
_ts_param32(0, CurrentUser()),
|
|
14065
|
+
_ts_metadata53("design:type", Function),
|
|
14066
|
+
_ts_metadata53("design:paramtypes", [
|
|
13683
14067
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
13684
14068
|
]),
|
|
13685
|
-
|
|
14069
|
+
_ts_metadata53("design:returntype", Promise)
|
|
13686
14070
|
], PlatformAuthController.prototype, "me", null);
|
|
13687
|
-
|
|
14071
|
+
_ts_decorate54([
|
|
13688
14072
|
Public(),
|
|
13689
14073
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
13690
14074
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
13691
14075
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
13692
14076
|
RequestEncoding("unchecked"),
|
|
13693
14077
|
common.Post("logout"),
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
|
|
14078
|
+
_ts_param32(0, common.Req()),
|
|
14079
|
+
_ts_metadata53("design:type", Function),
|
|
14080
|
+
_ts_metadata53("design:paramtypes", [
|
|
13697
14081
|
typeof Request === "undefined" ? Object : Request
|
|
13698
14082
|
]),
|
|
13699
|
-
|
|
14083
|
+
_ts_metadata53("design:returntype", Promise)
|
|
13700
14084
|
], PlatformAuthController.prototype, "logout", null);
|
|
13701
|
-
|
|
14085
|
+
_ts_decorate54([
|
|
13702
14086
|
Public(),
|
|
13703
14087
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
13704
14088
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
13705
14089
|
common.HttpCode(common.HttpStatus.OK),
|
|
13706
14090
|
RequestEncoding("unchecked"),
|
|
13707
14091
|
common.Post("refresh"),
|
|
13708
|
-
|
|
13709
|
-
|
|
13710
|
-
|
|
14092
|
+
_ts_param32(0, common.Req()),
|
|
14093
|
+
_ts_metadata53("design:type", Function),
|
|
14094
|
+
_ts_metadata53("design:paramtypes", [
|
|
13711
14095
|
typeof Request === "undefined" ? Object : Request
|
|
13712
14096
|
]),
|
|
13713
|
-
|
|
14097
|
+
_ts_metadata53("design:returntype", Promise)
|
|
13714
14098
|
], PlatformAuthController.prototype, "refresh", null);
|
|
13715
|
-
|
|
14099
|
+
_ts_decorate54([
|
|
13716
14100
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
13717
14101
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13718
14102
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13719
14103
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
13720
14104
|
common.Delete("sessions"),
|
|
13721
|
-
|
|
13722
|
-
|
|
13723
|
-
|
|
14105
|
+
_ts_param32(0, CurrentUser()),
|
|
14106
|
+
_ts_metadata53("design:type", Function),
|
|
14107
|
+
_ts_metadata53("design:paramtypes", [
|
|
13724
14108
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
13725
14109
|
]),
|
|
13726
|
-
|
|
14110
|
+
_ts_metadata53("design:returntype", Promise)
|
|
13727
14111
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
13728
|
-
PlatformAuthController =
|
|
14112
|
+
PlatformAuthController = _ts_decorate54([
|
|
13729
14113
|
common.UseInterceptors(NoStoreInterceptor),
|
|
13730
14114
|
common.Controller("platform"),
|
|
13731
14115
|
common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
13732
14116
|
common.UsePipes(createAuthValidationPipe()),
|
|
13733
|
-
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
|
|
13737
|
-
|
|
14117
|
+
_ts_param32(0, common.Inject(exports.PlatformAuthService)),
|
|
14118
|
+
_ts_param32(1, common.Inject(exports.MfaService)),
|
|
14119
|
+
_ts_param32(2, common.Inject(exports.TokenDeliveryService)),
|
|
14120
|
+
_ts_metadata53("design:type", Function),
|
|
14121
|
+
_ts_metadata53("design:paramtypes", [
|
|
13738
14122
|
typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
|
|
13739
14123
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
13740
14124
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
13741
14125
|
])
|
|
13742
14126
|
], PlatformAuthController);
|
|
13743
|
-
function
|
|
14127
|
+
function _ts_decorate55(decorators, target, key, desc) {
|
|
13744
14128
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13745
14129
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13746
14130
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13753,19 +14137,19 @@ function _ts_decorate53(decorators, target, key, desc) {
|
|
|
13753
14137
|
}
|
|
13754
14138
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13755
14139
|
}
|
|
13756
|
-
__name(
|
|
13757
|
-
function
|
|
14140
|
+
__name(_ts_decorate55, "_ts_decorate");
|
|
14141
|
+
function _ts_metadata54(metadataKey, metadataValue) {
|
|
13758
14142
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13759
14143
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13760
14144
|
}
|
|
13761
14145
|
}
|
|
13762
|
-
__name(
|
|
13763
|
-
function
|
|
14146
|
+
__name(_ts_metadata54, "_ts_metadata");
|
|
14147
|
+
function _ts_param33(paramIndex, decorator) {
|
|
13764
14148
|
return function(target, key) {
|
|
13765
14149
|
decorator(target, key, paramIndex);
|
|
13766
14150
|
};
|
|
13767
14151
|
}
|
|
13768
|
-
__name(
|
|
14152
|
+
__name(_ts_param33, "_ts_param");
|
|
13769
14153
|
var PlatformMfaController = class {
|
|
13770
14154
|
static {
|
|
13771
14155
|
__name(this, "PlatformMfaController");
|
|
@@ -13844,86 +14228,86 @@ var PlatformMfaController = class {
|
|
|
13844
14228
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
13845
14229
|
}
|
|
13846
14230
|
};
|
|
13847
|
-
|
|
14231
|
+
_ts_decorate55([
|
|
13848
14232
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
13849
14233
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
13850
14234
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
13851
14235
|
RequestEncoding("when-body"),
|
|
13852
14236
|
common.Post("setup"),
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
14237
|
+
_ts_param33(0, CurrentUser()),
|
|
14238
|
+
_ts_param33(1, common.Body()),
|
|
14239
|
+
_ts_metadata54("design:type", Function),
|
|
14240
|
+
_ts_metadata54("design:paramtypes", [
|
|
13857
14241
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13858
14242
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
13859
14243
|
]),
|
|
13860
|
-
|
|
14244
|
+
_ts_metadata54("design:returntype", Promise)
|
|
13861
14245
|
], PlatformMfaController.prototype, "setup", null);
|
|
13862
|
-
|
|
14246
|
+
_ts_decorate55([
|
|
13863
14247
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
13864
14248
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
13865
14249
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
13866
14250
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
13867
14251
|
common.Post("verify-enable"),
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
|
|
13872
|
-
|
|
14252
|
+
_ts_param33(0, CurrentUser()),
|
|
14253
|
+
_ts_param33(1, common.Body()),
|
|
14254
|
+
_ts_param33(2, common.Req()),
|
|
14255
|
+
_ts_metadata54("design:type", Function),
|
|
14256
|
+
_ts_metadata54("design:paramtypes", [
|
|
13873
14257
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13874
14258
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
13875
14259
|
typeof Request === "undefined" ? Object : Request
|
|
13876
14260
|
]),
|
|
13877
|
-
|
|
14261
|
+
_ts_metadata54("design:returntype", Promise)
|
|
13878
14262
|
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
13879
|
-
|
|
14263
|
+
_ts_decorate55([
|
|
13880
14264
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
13881
14265
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13882
14266
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13883
14267
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
13884
14268
|
common.Post("disable"),
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
14269
|
+
_ts_param33(0, CurrentUser()),
|
|
14270
|
+
_ts_param33(1, common.Body()),
|
|
14271
|
+
_ts_param33(2, common.Req()),
|
|
14272
|
+
_ts_metadata54("design:type", Function),
|
|
14273
|
+
_ts_metadata54("design:paramtypes", [
|
|
13890
14274
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13891
14275
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
13892
14276
|
typeof Request === "undefined" ? Object : Request
|
|
13893
14277
|
]),
|
|
13894
|
-
|
|
14278
|
+
_ts_metadata54("design:returntype", Promise)
|
|
13895
14279
|
], PlatformMfaController.prototype, "disable", null);
|
|
13896
|
-
|
|
14280
|
+
_ts_decorate55([
|
|
13897
14281
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
13898
14282
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13899
14283
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13900
14284
|
common.HttpCode(common.HttpStatus.OK),
|
|
13901
14285
|
common.Post("recovery-codes"),
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
14286
|
+
_ts_param33(0, CurrentUser()),
|
|
14287
|
+
_ts_param33(1, common.Body()),
|
|
14288
|
+
_ts_param33(2, common.Req()),
|
|
14289
|
+
_ts_metadata54("design:type", Function),
|
|
14290
|
+
_ts_metadata54("design:paramtypes", [
|
|
13907
14291
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13908
14292
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
13909
14293
|
typeof Request === "undefined" ? Object : Request
|
|
13910
14294
|
]),
|
|
13911
|
-
|
|
14295
|
+
_ts_metadata54("design:returntype", Promise)
|
|
13912
14296
|
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
13913
|
-
PlatformMfaController =
|
|
14297
|
+
PlatformMfaController = _ts_decorate55([
|
|
13914
14298
|
common.UseInterceptors(NoStoreInterceptor),
|
|
13915
14299
|
common.Controller("platform/mfa"),
|
|
13916
14300
|
common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
13917
14301
|
common.UsePipes(createAuthValidationPipe({
|
|
13918
14302
|
forbidUnknownValues: true
|
|
13919
14303
|
})),
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
14304
|
+
_ts_param33(0, common.Inject(exports.MfaService)),
|
|
14305
|
+
_ts_metadata54("design:type", Function),
|
|
14306
|
+
_ts_metadata54("design:paramtypes", [
|
|
13923
14307
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService
|
|
13924
14308
|
])
|
|
13925
14309
|
], PlatformMfaController);
|
|
13926
|
-
function
|
|
14310
|
+
function _ts_decorate56(decorators, target, key, desc) {
|
|
13927
14311
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13928
14312
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13929
14313
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13936,19 +14320,19 @@ function _ts_decorate54(decorators, target, key, desc) {
|
|
|
13936
14320
|
}
|
|
13937
14321
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13938
14322
|
}
|
|
13939
|
-
__name(
|
|
13940
|
-
function
|
|
14323
|
+
__name(_ts_decorate56, "_ts_decorate");
|
|
14324
|
+
function _ts_metadata55(metadataKey, metadataValue) {
|
|
13941
14325
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13942
14326
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13943
14327
|
}
|
|
13944
14328
|
}
|
|
13945
|
-
__name(
|
|
13946
|
-
function
|
|
14329
|
+
__name(_ts_metadata55, "_ts_metadata");
|
|
14330
|
+
function _ts_param34(paramIndex, decorator) {
|
|
13947
14331
|
return function(target, key) {
|
|
13948
14332
|
decorator(target, key, paramIndex);
|
|
13949
14333
|
};
|
|
13950
14334
|
}
|
|
13951
|
-
__name(
|
|
14335
|
+
__name(_ts_param34, "_ts_param");
|
|
13952
14336
|
var SessionController = class {
|
|
13953
14337
|
static {
|
|
13954
14338
|
__name(this, "SessionController");
|
|
@@ -14048,64 +14432,64 @@ var SessionController = class {
|
|
|
14048
14432
|
});
|
|
14049
14433
|
}
|
|
14050
14434
|
};
|
|
14051
|
-
|
|
14435
|
+
_ts_decorate56([
|
|
14052
14436
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
14053
14437
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
14054
14438
|
common.Get(),
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14439
|
+
_ts_param34(0, CurrentUser()),
|
|
14440
|
+
_ts_param34(1, common.Req()),
|
|
14441
|
+
_ts_metadata55("design:type", Function),
|
|
14442
|
+
_ts_metadata55("design:paramtypes", [
|
|
14059
14443
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
14060
14444
|
typeof Request === "undefined" ? Object : Request
|
|
14061
14445
|
]),
|
|
14062
|
-
|
|
14446
|
+
_ts_metadata55("design:returntype", Promise)
|
|
14063
14447
|
], SessionController.prototype, "listSessions", null);
|
|
14064
|
-
|
|
14448
|
+
_ts_decorate56([
|
|
14065
14449
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
14066
14450
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
14067
14451
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
14068
14452
|
RequestEncoding("unchecked"),
|
|
14069
14453
|
common.Post("revoke-all"),
|
|
14070
|
-
|
|
14071
|
-
|
|
14072
|
-
|
|
14073
|
-
|
|
14454
|
+
_ts_param34(0, CurrentUser()),
|
|
14455
|
+
_ts_param34(1, common.Req()),
|
|
14456
|
+
_ts_metadata55("design:type", Function),
|
|
14457
|
+
_ts_metadata55("design:paramtypes", [
|
|
14074
14458
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
14075
14459
|
typeof Request === "undefined" ? Object : Request
|
|
14076
14460
|
]),
|
|
14077
|
-
|
|
14461
|
+
_ts_metadata55("design:returntype", Promise)
|
|
14078
14462
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
14079
|
-
|
|
14463
|
+
_ts_decorate56([
|
|
14080
14464
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
14081
14465
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
14082
14466
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
14083
14467
|
common.Delete(":id"),
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14468
|
+
_ts_param34(0, CurrentUser()),
|
|
14469
|
+
_ts_param34(1, common.Param("id")),
|
|
14470
|
+
_ts_metadata55("design:type", Function),
|
|
14471
|
+
_ts_metadata55("design:paramtypes", [
|
|
14088
14472
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
14089
14473
|
String
|
|
14090
14474
|
]),
|
|
14091
|
-
|
|
14475
|
+
_ts_metadata55("design:returntype", Promise)
|
|
14092
14476
|
], SessionController.prototype, "revokeSession", null);
|
|
14093
|
-
SessionController =
|
|
14477
|
+
SessionController = _ts_decorate56([
|
|
14094
14478
|
common.UseInterceptors(NoStoreInterceptor),
|
|
14095
14479
|
common.Controller("sessions"),
|
|
14096
14480
|
common.UseGuards(exports.RequestEncodingGuard, exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
14097
14481
|
common.UsePipes(createAuthValidationPipe()),
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14482
|
+
_ts_param34(0, common.Inject(exports.SessionService)),
|
|
14483
|
+
_ts_param34(1, common.Inject(exports.TokenDeliveryService)),
|
|
14484
|
+
_ts_metadata55("design:type", Function),
|
|
14485
|
+
_ts_metadata55("design:paramtypes", [
|
|
14102
14486
|
typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
|
|
14103
14487
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
14104
14488
|
])
|
|
14105
14489
|
], SessionController);
|
|
14106
14490
|
var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
|
|
14107
14491
|
var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => common.SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
|
|
14108
|
-
function
|
|
14492
|
+
function _ts_decorate57(decorators, target, key, desc) {
|
|
14109
14493
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14110
14494
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14111
14495
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14118,19 +14502,19 @@ function _ts_decorate55(decorators, target, key, desc) {
|
|
|
14118
14502
|
}
|
|
14119
14503
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14120
14504
|
}
|
|
14121
|
-
__name(
|
|
14122
|
-
function
|
|
14505
|
+
__name(_ts_decorate57, "_ts_decorate");
|
|
14506
|
+
function _ts_metadata56(metadataKey, metadataValue) {
|
|
14123
14507
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14124
14508
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14125
14509
|
}
|
|
14126
14510
|
}
|
|
14127
|
-
__name(
|
|
14128
|
-
function
|
|
14511
|
+
__name(_ts_metadata56, "_ts_metadata");
|
|
14512
|
+
function _ts_param35(paramIndex, decorator) {
|
|
14129
14513
|
return function(target, key) {
|
|
14130
14514
|
decorator(target, key, paramIndex);
|
|
14131
14515
|
};
|
|
14132
14516
|
}
|
|
14133
|
-
__name(
|
|
14517
|
+
__name(_ts_param35, "_ts_param");
|
|
14134
14518
|
var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
|
|
14135
14519
|
static {
|
|
14136
14520
|
__name(this, "ApiKeyLastUsedService");
|
|
@@ -14191,12 +14575,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
|
|
|
14191
14575
|
await this.flush();
|
|
14192
14576
|
}
|
|
14193
14577
|
};
|
|
14194
|
-
ApiKeyLastUsedService =
|
|
14578
|
+
ApiKeyLastUsedService = _ts_decorate57([
|
|
14195
14579
|
common.Injectable(),
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14580
|
+
_ts_param35(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
14581
|
+
_ts_param35(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
14582
|
+
_ts_metadata56("design:type", Function),
|
|
14583
|
+
_ts_metadata56("design:paramtypes", [
|
|
14200
14584
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
14201
14585
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14202
14586
|
])
|
|
@@ -14245,7 +14629,7 @@ function digestsMatch(computed, stored) {
|
|
|
14245
14629
|
__name(digestsMatch, "digestsMatch");
|
|
14246
14630
|
|
|
14247
14631
|
// src/server/services/api-key-verifier.service.ts
|
|
14248
|
-
function
|
|
14632
|
+
function _ts_decorate58(decorators, target, key, desc) {
|
|
14249
14633
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14250
14634
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14251
14635
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14258,19 +14642,19 @@ function _ts_decorate56(decorators, target, key, desc) {
|
|
|
14258
14642
|
}
|
|
14259
14643
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14260
14644
|
}
|
|
14261
|
-
__name(
|
|
14262
|
-
function
|
|
14645
|
+
__name(_ts_decorate58, "_ts_decorate");
|
|
14646
|
+
function _ts_metadata57(metadataKey, metadataValue) {
|
|
14263
14647
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14264
14648
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14265
14649
|
}
|
|
14266
14650
|
}
|
|
14267
|
-
__name(
|
|
14268
|
-
function
|
|
14651
|
+
__name(_ts_metadata57, "_ts_metadata");
|
|
14652
|
+
function _ts_param36(paramIndex, decorator) {
|
|
14269
14653
|
return function(target, key) {
|
|
14270
14654
|
decorator(target, key, paramIndex);
|
|
14271
14655
|
};
|
|
14272
14656
|
}
|
|
14273
|
-
__name(
|
|
14657
|
+
__name(_ts_param36, "_ts_param");
|
|
14274
14658
|
var ApiKeyVerifierService = class {
|
|
14275
14659
|
static {
|
|
14276
14660
|
__name(this, "ApiKeyVerifierService");
|
|
@@ -14330,14 +14714,14 @@ var ApiKeyVerifierService = class {
|
|
|
14330
14714
|
return null;
|
|
14331
14715
|
}
|
|
14332
14716
|
};
|
|
14333
|
-
ApiKeyVerifierService =
|
|
14717
|
+
ApiKeyVerifierService = _ts_decorate58([
|
|
14334
14718
|
common.Injectable(),
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14719
|
+
_ts_param36(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
14720
|
+
_ts_param36(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
14721
|
+
_ts_param36(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
14722
|
+
_ts_param36(3, common.Inject(ApiKeyLastUsedService)),
|
|
14723
|
+
_ts_metadata57("design:type", Function),
|
|
14724
|
+
_ts_metadata57("design:paramtypes", [
|
|
14341
14725
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
14342
14726
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
14343
14727
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -14346,7 +14730,7 @@ ApiKeyVerifierService = _ts_decorate56([
|
|
|
14346
14730
|
], ApiKeyVerifierService);
|
|
14347
14731
|
|
|
14348
14732
|
// src/server/guards/api-key.guard.ts
|
|
14349
|
-
function
|
|
14733
|
+
function _ts_decorate59(decorators, target, key, desc) {
|
|
14350
14734
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14351
14735
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14352
14736
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14359,19 +14743,19 @@ function _ts_decorate57(decorators, target, key, desc) {
|
|
|
14359
14743
|
}
|
|
14360
14744
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14361
14745
|
}
|
|
14362
|
-
__name(
|
|
14363
|
-
function
|
|
14746
|
+
__name(_ts_decorate59, "_ts_decorate");
|
|
14747
|
+
function _ts_metadata58(metadataKey, metadataValue) {
|
|
14364
14748
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14365
14749
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14366
14750
|
}
|
|
14367
14751
|
}
|
|
14368
|
-
__name(
|
|
14369
|
-
function
|
|
14752
|
+
__name(_ts_metadata58, "_ts_metadata");
|
|
14753
|
+
function _ts_param37(paramIndex, decorator) {
|
|
14370
14754
|
return function(target, key) {
|
|
14371
14755
|
decorator(target, key, paramIndex);
|
|
14372
14756
|
};
|
|
14373
14757
|
}
|
|
14374
|
-
__name(
|
|
14758
|
+
__name(_ts_param37, "_ts_param");
|
|
14375
14759
|
exports.ApiKeyGuard = class _ApiKeyGuard {
|
|
14376
14760
|
static {
|
|
14377
14761
|
__name(this, "ApiKeyGuard");
|
|
@@ -14511,15 +14895,15 @@ exports.ApiKeyGuard = class _ApiKeyGuard {
|
|
|
14511
14895
|
};
|
|
14512
14896
|
}
|
|
14513
14897
|
};
|
|
14514
|
-
exports.ApiKeyGuard =
|
|
14898
|
+
exports.ApiKeyGuard = _ts_decorate59([
|
|
14515
14899
|
common.Injectable(),
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14900
|
+
_ts_param37(0, common.Inject(core.Reflector)),
|
|
14901
|
+
_ts_param37(1, common.Inject(ApiKeyVerifierService)),
|
|
14902
|
+
_ts_param37(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
14903
|
+
_ts_param37(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
14904
|
+
_ts_param37(3, common.Optional()),
|
|
14905
|
+
_ts_metadata58("design:type", Function),
|
|
14906
|
+
_ts_metadata58("design:paramtypes", [
|
|
14523
14907
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
14524
14908
|
typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
|
|
14525
14909
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -14531,7 +14915,7 @@ function routePattern(request) {
|
|
|
14531
14915
|
return typeof path === "string" ? path : "";
|
|
14532
14916
|
}
|
|
14533
14917
|
__name(routePattern, "routePattern");
|
|
14534
|
-
function
|
|
14918
|
+
function _ts_decorate60(decorators, target, key, desc) {
|
|
14535
14919
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14536
14920
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14537
14921
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14544,19 +14928,19 @@ function _ts_decorate58(decorators, target, key, desc) {
|
|
|
14544
14928
|
}
|
|
14545
14929
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14546
14930
|
}
|
|
14547
|
-
__name(
|
|
14548
|
-
function
|
|
14931
|
+
__name(_ts_decorate60, "_ts_decorate");
|
|
14932
|
+
function _ts_metadata59(metadataKey, metadataValue) {
|
|
14549
14933
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14550
14934
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14551
14935
|
}
|
|
14552
14936
|
}
|
|
14553
|
-
__name(
|
|
14554
|
-
function
|
|
14937
|
+
__name(_ts_metadata59, "_ts_metadata");
|
|
14938
|
+
function _ts_param38(paramIndex, decorator) {
|
|
14555
14939
|
return function(target, key) {
|
|
14556
14940
|
decorator(target, key, paramIndex);
|
|
14557
14941
|
};
|
|
14558
14942
|
}
|
|
14559
|
-
__name(
|
|
14943
|
+
__name(_ts_param38, "_ts_param");
|
|
14560
14944
|
exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
14561
14945
|
static {
|
|
14562
14946
|
__name(this, "MfaRequiredGuard");
|
|
@@ -14583,11 +14967,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
|
14583
14967
|
return true;
|
|
14584
14968
|
}
|
|
14585
14969
|
};
|
|
14586
|
-
exports.MfaRequiredGuard =
|
|
14970
|
+
exports.MfaRequiredGuard = _ts_decorate60([
|
|
14587
14971
|
common.Injectable(),
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14972
|
+
_ts_param38(0, common.Inject(core.Reflector)),
|
|
14973
|
+
_ts_metadata59("design:type", Function),
|
|
14974
|
+
_ts_metadata59("design:paramtypes", [
|
|
14591
14975
|
typeof core.Reflector === "undefined" ? Object : core.Reflector
|
|
14592
14976
|
])
|
|
14593
14977
|
], exports.MfaRequiredGuard);
|
|
@@ -14595,7 +14979,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
14595
14979
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
14596
14980
|
|
|
14597
14981
|
// src/server/guards/platform-roles.guard.ts
|
|
14598
|
-
function
|
|
14982
|
+
function _ts_decorate61(decorators, target, key, desc) {
|
|
14599
14983
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14600
14984
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14601
14985
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14608,19 +14992,19 @@ function _ts_decorate59(decorators, target, key, desc) {
|
|
|
14608
14992
|
}
|
|
14609
14993
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14610
14994
|
}
|
|
14611
|
-
__name(
|
|
14612
|
-
function
|
|
14995
|
+
__name(_ts_decorate61, "_ts_decorate");
|
|
14996
|
+
function _ts_metadata60(metadataKey, metadataValue) {
|
|
14613
14997
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14614
14998
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14615
14999
|
}
|
|
14616
15000
|
}
|
|
14617
|
-
__name(
|
|
14618
|
-
function
|
|
15001
|
+
__name(_ts_metadata60, "_ts_metadata");
|
|
15002
|
+
function _ts_param39(paramIndex, decorator) {
|
|
14619
15003
|
return function(target, key) {
|
|
14620
15004
|
decorator(target, key, paramIndex);
|
|
14621
15005
|
};
|
|
14622
15006
|
}
|
|
14623
|
-
__name(
|
|
15007
|
+
__name(_ts_param39, "_ts_param");
|
|
14624
15008
|
exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
14625
15009
|
static {
|
|
14626
15010
|
__name(this, "PlatformRolesGuard");
|
|
@@ -14654,12 +15038,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
|
14654
15038
|
return true;
|
|
14655
15039
|
}
|
|
14656
15040
|
};
|
|
14657
|
-
exports.PlatformRolesGuard =
|
|
15041
|
+
exports.PlatformRolesGuard = _ts_decorate61([
|
|
14658
15042
|
common.Injectable(),
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
15043
|
+
_ts_param39(0, common.Inject(core.Reflector)),
|
|
15044
|
+
_ts_param39(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
15045
|
+
_ts_metadata60("design:type", Function),
|
|
15046
|
+
_ts_metadata60("design:paramtypes", [
|
|
14663
15047
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
14664
15048
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14665
15049
|
])
|
|
@@ -14668,7 +15052,7 @@ var ROLES_KEY = "roles";
|
|
|
14668
15052
|
var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
|
|
14669
15053
|
|
|
14670
15054
|
// src/server/guards/roles.guard.ts
|
|
14671
|
-
function
|
|
15055
|
+
function _ts_decorate62(decorators, target, key, desc) {
|
|
14672
15056
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14673
15057
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14674
15058
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14681,19 +15065,19 @@ function _ts_decorate60(decorators, target, key, desc) {
|
|
|
14681
15065
|
}
|
|
14682
15066
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14683
15067
|
}
|
|
14684
|
-
__name(
|
|
14685
|
-
function
|
|
15068
|
+
__name(_ts_decorate62, "_ts_decorate");
|
|
15069
|
+
function _ts_metadata61(metadataKey, metadataValue) {
|
|
14686
15070
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14687
15071
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14688
15072
|
}
|
|
14689
15073
|
}
|
|
14690
|
-
__name(
|
|
14691
|
-
function
|
|
15074
|
+
__name(_ts_metadata61, "_ts_metadata");
|
|
15075
|
+
function _ts_param40(paramIndex, decorator) {
|
|
14692
15076
|
return function(target, key) {
|
|
14693
15077
|
decorator(target, key, paramIndex);
|
|
14694
15078
|
};
|
|
14695
15079
|
}
|
|
14696
|
-
__name(
|
|
15080
|
+
__name(_ts_param40, "_ts_param");
|
|
14697
15081
|
exports.RolesGuard = class RolesGuard {
|
|
14698
15082
|
static {
|
|
14699
15083
|
__name(this, "RolesGuard");
|
|
@@ -14723,17 +15107,17 @@ exports.RolesGuard = class RolesGuard {
|
|
|
14723
15107
|
return true;
|
|
14724
15108
|
}
|
|
14725
15109
|
};
|
|
14726
|
-
exports.RolesGuard =
|
|
15110
|
+
exports.RolesGuard = _ts_decorate62([
|
|
14727
15111
|
common.Injectable(),
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
15112
|
+
_ts_param40(0, common.Inject(core.Reflector)),
|
|
15113
|
+
_ts_param40(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
15114
|
+
_ts_metadata61("design:type", Function),
|
|
15115
|
+
_ts_metadata61("design:paramtypes", [
|
|
14732
15116
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
14733
15117
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14734
15118
|
])
|
|
14735
15119
|
], exports.RolesGuard);
|
|
14736
|
-
function
|
|
15120
|
+
function _ts_decorate63(decorators, target, key, desc) {
|
|
14737
15121
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14738
15122
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14739
15123
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14746,7 +15130,7 @@ function _ts_decorate61(decorators, target, key, desc) {
|
|
|
14746
15130
|
}
|
|
14747
15131
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14748
15132
|
}
|
|
14749
|
-
__name(
|
|
15133
|
+
__name(_ts_decorate63, "_ts_decorate");
|
|
14750
15134
|
exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
14751
15135
|
static {
|
|
14752
15136
|
__name(this, "NoOpAuthHooks");
|
|
@@ -14795,7 +15179,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
|
14795
15179
|
};
|
|
14796
15180
|
}
|
|
14797
15181
|
};
|
|
14798
|
-
exports.NoOpAuthHooks =
|
|
15182
|
+
exports.NoOpAuthHooks = _ts_decorate63([
|
|
14799
15183
|
common.Injectable()
|
|
14800
15184
|
], exports.NoOpAuthHooks);
|
|
14801
15185
|
|
|
@@ -14808,7 +15192,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
|
14808
15192
|
var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
|
|
14809
15193
|
|
|
14810
15194
|
// src/server/oauth/oauth.service.ts
|
|
14811
|
-
function
|
|
15195
|
+
function _ts_decorate64(decorators, target, key, desc) {
|
|
14812
15196
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14813
15197
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14814
15198
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14821,19 +15205,19 @@ function _ts_decorate62(decorators, target, key, desc) {
|
|
|
14821
15205
|
}
|
|
14822
15206
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14823
15207
|
}
|
|
14824
|
-
__name(
|
|
14825
|
-
function
|
|
15208
|
+
__name(_ts_decorate64, "_ts_decorate");
|
|
15209
|
+
function _ts_metadata62(metadataKey, metadataValue) {
|
|
14826
15210
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14827
15211
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14828
15212
|
}
|
|
14829
15213
|
}
|
|
14830
|
-
__name(
|
|
14831
|
-
function
|
|
15214
|
+
__name(_ts_metadata62, "_ts_metadata");
|
|
15215
|
+
function _ts_param41(paramIndex, decorator) {
|
|
14832
15216
|
return function(target, key) {
|
|
14833
15217
|
decorator(target, key, paramIndex);
|
|
14834
15218
|
};
|
|
14835
15219
|
}
|
|
14836
|
-
__name(
|
|
15220
|
+
__name(_ts_param41, "_ts_param");
|
|
14837
15221
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
14838
15222
|
function isStoredOAuthState(value) {
|
|
14839
15223
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -15127,18 +15511,18 @@ exports.OAuthService = class _OAuthService {
|
|
|
15127
15511
|
return plugin;
|
|
15128
15512
|
}
|
|
15129
15513
|
};
|
|
15130
|
-
exports.OAuthService =
|
|
15514
|
+
exports.OAuthService = _ts_decorate64([
|
|
15131
15515
|
common.Injectable(),
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15516
|
+
_ts_param41(0, common.Inject(OAUTH_PLUGINS)),
|
|
15517
|
+
_ts_param41(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
15518
|
+
_ts_param41(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
15519
|
+
_ts_param41(2, common.Optional()),
|
|
15520
|
+
_ts_param41(3, common.Inject(AuthRedisService)),
|
|
15521
|
+
_ts_param41(4, common.Inject(TokenManagerService)),
|
|
15522
|
+
_ts_param41(5, common.Inject(exports.SessionService)),
|
|
15523
|
+
_ts_param41(6, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
15524
|
+
_ts_metadata62("design:type", Function),
|
|
15525
|
+
_ts_metadata62("design:paramtypes", [
|
|
15142
15526
|
Array,
|
|
15143
15527
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
15144
15528
|
Object,
|
|
@@ -15148,7 +15532,7 @@ exports.OAuthService = _ts_decorate62([
|
|
|
15148
15532
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
15149
15533
|
])
|
|
15150
15534
|
], exports.OAuthService);
|
|
15151
|
-
function
|
|
15535
|
+
function _ts_decorate65(decorators, target, key, desc) {
|
|
15152
15536
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15153
15537
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15154
15538
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15161,13 +15545,13 @@ function _ts_decorate63(decorators, target, key, desc) {
|
|
|
15161
15545
|
}
|
|
15162
15546
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15163
15547
|
}
|
|
15164
|
-
__name(
|
|
15165
|
-
function
|
|
15548
|
+
__name(_ts_decorate65, "_ts_decorate");
|
|
15549
|
+
function _ts_metadata63(metadataKey, metadataValue) {
|
|
15166
15550
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15167
15551
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15168
15552
|
}
|
|
15169
15553
|
}
|
|
15170
|
-
__name(
|
|
15554
|
+
__name(_ts_metadata63, "_ts_metadata");
|
|
15171
15555
|
var OAuthCallbackQueryDto = class {
|
|
15172
15556
|
static {
|
|
15173
15557
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -15266,69 +15650,69 @@ var OAuthCallbackQueryDto = class {
|
|
|
15266
15650
|
*/
|
|
15267
15651
|
hd;
|
|
15268
15652
|
};
|
|
15269
|
-
|
|
15653
|
+
_ts_decorate65([
|
|
15270
15654
|
classValidator.ValidateIf((query) => query.error === void 0 || query.error === null),
|
|
15271
15655
|
classValidator.IsOptional(),
|
|
15272
15656
|
classValidator.IsString(),
|
|
15273
15657
|
classValidator.IsNotEmpty(),
|
|
15274
15658
|
classValidator.MaxLength(2048),
|
|
15275
|
-
|
|
15659
|
+
_ts_metadata63("design:type", String)
|
|
15276
15660
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
15277
|
-
|
|
15661
|
+
_ts_decorate65([
|
|
15278
15662
|
classValidator.IsOptional(),
|
|
15279
15663
|
classValidator.IsString(),
|
|
15280
15664
|
classValidator.MaxLength(128),
|
|
15281
|
-
|
|
15665
|
+
_ts_metadata63("design:type", String)
|
|
15282
15666
|
], OAuthCallbackQueryDto.prototype, "error", void 0);
|
|
15283
|
-
|
|
15667
|
+
_ts_decorate65([
|
|
15284
15668
|
classValidator.IsOptional(),
|
|
15285
15669
|
classValidator.IsString(),
|
|
15286
15670
|
classValidator.MaxLength(512),
|
|
15287
|
-
|
|
15671
|
+
_ts_metadata63("design:type", String)
|
|
15288
15672
|
], OAuthCallbackQueryDto.prototype, "error_description", void 0);
|
|
15289
|
-
|
|
15673
|
+
_ts_decorate65([
|
|
15290
15674
|
classValidator.IsOptional(),
|
|
15291
15675
|
classValidator.IsString(),
|
|
15292
15676
|
classValidator.MaxLength(512),
|
|
15293
|
-
|
|
15677
|
+
_ts_metadata63("design:type", String)
|
|
15294
15678
|
], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
|
|
15295
|
-
|
|
15679
|
+
_ts_decorate65([
|
|
15296
15680
|
classValidator.IsString(),
|
|
15297
15681
|
classValidator.IsNotEmpty(),
|
|
15298
15682
|
classValidator.MaxLength(128),
|
|
15299
|
-
|
|
15683
|
+
_ts_metadata63("design:type", String)
|
|
15300
15684
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
15301
|
-
|
|
15685
|
+
_ts_decorate65([
|
|
15302
15686
|
classValidator.IsOptional(),
|
|
15303
15687
|
classValidator.IsString(),
|
|
15304
15688
|
classValidator.MaxLength(512),
|
|
15305
|
-
|
|
15689
|
+
_ts_metadata63("design:type", String)
|
|
15306
15690
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
15307
|
-
|
|
15691
|
+
_ts_decorate65([
|
|
15308
15692
|
classValidator.IsOptional(),
|
|
15309
15693
|
classValidator.IsString(),
|
|
15310
15694
|
classValidator.MaxLength(2048),
|
|
15311
|
-
|
|
15695
|
+
_ts_metadata63("design:type", String)
|
|
15312
15696
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
15313
|
-
|
|
15697
|
+
_ts_decorate65([
|
|
15314
15698
|
classValidator.IsOptional(),
|
|
15315
15699
|
classValidator.IsString(),
|
|
15316
15700
|
classValidator.MaxLength(16),
|
|
15317
|
-
|
|
15701
|
+
_ts_metadata63("design:type", String)
|
|
15318
15702
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
15319
|
-
|
|
15703
|
+
_ts_decorate65([
|
|
15320
15704
|
classValidator.IsOptional(),
|
|
15321
15705
|
classValidator.IsString(),
|
|
15322
15706
|
classValidator.MaxLength(64),
|
|
15323
|
-
|
|
15707
|
+
_ts_metadata63("design:type", String)
|
|
15324
15708
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
15325
|
-
|
|
15709
|
+
_ts_decorate65([
|
|
15326
15710
|
classValidator.IsOptional(),
|
|
15327
15711
|
classValidator.IsString(),
|
|
15328
15712
|
classValidator.MaxLength(253),
|
|
15329
|
-
|
|
15713
|
+
_ts_metadata63("design:type", String)
|
|
15330
15714
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
15331
|
-
function
|
|
15715
|
+
function _ts_decorate66(decorators, target, key, desc) {
|
|
15332
15716
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15333
15717
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15334
15718
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15341,13 +15725,13 @@ function _ts_decorate64(decorators, target, key, desc) {
|
|
|
15341
15725
|
}
|
|
15342
15726
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15343
15727
|
}
|
|
15344
|
-
__name(
|
|
15345
|
-
function
|
|
15728
|
+
__name(_ts_decorate66, "_ts_decorate");
|
|
15729
|
+
function _ts_metadata64(metadataKey, metadataValue) {
|
|
15346
15730
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15347
15731
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15348
15732
|
}
|
|
15349
15733
|
}
|
|
15350
|
-
__name(
|
|
15734
|
+
__name(_ts_metadata64, "_ts_metadata");
|
|
15351
15735
|
var OAuthInitiateQueryDto = class {
|
|
15352
15736
|
static {
|
|
15353
15737
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -15364,7 +15748,7 @@ var OAuthInitiateQueryDto = class {
|
|
|
15364
15748
|
*/
|
|
15365
15749
|
tenantId;
|
|
15366
15750
|
};
|
|
15367
|
-
|
|
15751
|
+
_ts_decorate66([
|
|
15368
15752
|
classValidator.IsOptional(),
|
|
15369
15753
|
classValidator.IsString(),
|
|
15370
15754
|
classValidator.IsNotEmpty(),
|
|
@@ -15372,11 +15756,11 @@ _ts_decorate64([
|
|
|
15372
15756
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
15373
15757
|
message: "tenantId must not contain control characters"
|
|
15374
15758
|
}),
|
|
15375
|
-
|
|
15759
|
+
_ts_metadata64("design:type", String)
|
|
15376
15760
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
15377
15761
|
|
|
15378
15762
|
// src/server/oauth/oauth.controller.ts
|
|
15379
|
-
function
|
|
15763
|
+
function _ts_decorate67(decorators, target, key, desc) {
|
|
15380
15764
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15381
15765
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15382
15766
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15389,19 +15773,19 @@ function _ts_decorate65(decorators, target, key, desc) {
|
|
|
15389
15773
|
}
|
|
15390
15774
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15391
15775
|
}
|
|
15392
|
-
__name(
|
|
15393
|
-
function
|
|
15776
|
+
__name(_ts_decorate67, "_ts_decorate");
|
|
15777
|
+
function _ts_metadata65(metadataKey, metadataValue) {
|
|
15394
15778
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15395
15779
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15396
15780
|
}
|
|
15397
15781
|
}
|
|
15398
|
-
__name(
|
|
15399
|
-
function
|
|
15782
|
+
__name(_ts_metadata65, "_ts_metadata");
|
|
15783
|
+
function _ts_param42(paramIndex, decorator) {
|
|
15400
15784
|
return function(target, key) {
|
|
15401
15785
|
decorator(target, key, paramIndex);
|
|
15402
15786
|
};
|
|
15403
15787
|
}
|
|
15404
|
-
__name(
|
|
15788
|
+
__name(_ts_param42, "_ts_param");
|
|
15405
15789
|
function isOAuthMfaChallenge(result) {
|
|
15406
15790
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
15407
15791
|
}
|
|
@@ -15619,46 +16003,46 @@ var OAuthController = class _OAuthController {
|
|
|
15619
16003
|
});
|
|
15620
16004
|
}
|
|
15621
16005
|
};
|
|
15622
|
-
|
|
16006
|
+
_ts_decorate67([
|
|
15623
16007
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
15624
16008
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
15625
16009
|
common.Get(":provider"),
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
16010
|
+
_ts_param42(0, common.Param("provider")),
|
|
16011
|
+
_ts_param42(1, common.Query()),
|
|
16012
|
+
_ts_param42(2, common.Req()),
|
|
16013
|
+
_ts_param42(3, common.Res({
|
|
15630
16014
|
passthrough: true
|
|
15631
16015
|
})),
|
|
15632
|
-
|
|
15633
|
-
|
|
16016
|
+
_ts_metadata65("design:type", Function),
|
|
16017
|
+
_ts_metadata65("design:paramtypes", [
|
|
15634
16018
|
String,
|
|
15635
16019
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
15636
16020
|
typeof Request === "undefined" ? Object : Request,
|
|
15637
16021
|
typeof Response === "undefined" ? Object : Response
|
|
15638
16022
|
]),
|
|
15639
|
-
|
|
16023
|
+
_ts_metadata65("design:returntype", Promise)
|
|
15640
16024
|
], OAuthController.prototype, "initiate", null);
|
|
15641
|
-
|
|
16025
|
+
_ts_decorate67([
|
|
15642
16026
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
15643
16027
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
15644
16028
|
common.HttpCode(common.HttpStatus.OK),
|
|
15645
16029
|
common.Get(":provider/callback"),
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
16030
|
+
_ts_param42(0, common.Param("provider")),
|
|
16031
|
+
_ts_param42(1, common.Query()),
|
|
16032
|
+
_ts_param42(2, common.Req()),
|
|
16033
|
+
_ts_param42(3, common.Res({
|
|
15650
16034
|
passthrough: true
|
|
15651
16035
|
})),
|
|
15652
|
-
|
|
15653
|
-
|
|
16036
|
+
_ts_metadata65("design:type", Function),
|
|
16037
|
+
_ts_metadata65("design:paramtypes", [
|
|
15654
16038
|
String,
|
|
15655
16039
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
15656
16040
|
typeof Request === "undefined" ? Object : Request,
|
|
15657
16041
|
typeof Response === "undefined" ? Object : Response
|
|
15658
16042
|
]),
|
|
15659
|
-
|
|
16043
|
+
_ts_metadata65("design:returntype", Promise)
|
|
15660
16044
|
], OAuthController.prototype, "callback", null);
|
|
15661
|
-
OAuthController =
|
|
16045
|
+
OAuthController = _ts_decorate67([
|
|
15662
16046
|
Public(),
|
|
15663
16047
|
SkipMfa(),
|
|
15664
16048
|
common.UseInterceptors(NoStoreInterceptor),
|
|
@@ -15667,11 +16051,11 @@ OAuthController = _ts_decorate65([
|
|
|
15667
16051
|
common.UsePipes(createAuthValidationPipe({
|
|
15668
16052
|
forbidUnknownValues: true
|
|
15669
16053
|
})),
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
16054
|
+
_ts_param42(0, common.Inject(exports.OAuthService)),
|
|
16055
|
+
_ts_param42(1, common.Inject(exports.TokenDeliveryService)),
|
|
16056
|
+
_ts_param42(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
16057
|
+
_ts_metadata65("design:type", Function),
|
|
16058
|
+
_ts_metadata65("design:paramtypes", [
|
|
15675
16059
|
typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
|
|
15676
16060
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
15677
16061
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -15810,7 +16194,7 @@ var GoogleOAuthPlugin = class {
|
|
|
15810
16194
|
};
|
|
15811
16195
|
|
|
15812
16196
|
// src/server/oauth/oauth.module.ts
|
|
15813
|
-
function
|
|
16197
|
+
function _ts_decorate68(decorators, target, key, desc) {
|
|
15814
16198
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15815
16199
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15816
16200
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15823,7 +16207,7 @@ function _ts_decorate66(decorators, target, key, desc) {
|
|
|
15823
16207
|
}
|
|
15824
16208
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15825
16209
|
}
|
|
15826
|
-
__name(
|
|
16210
|
+
__name(_ts_decorate68, "_ts_decorate");
|
|
15827
16211
|
function buildOAuthPlugins(options) {
|
|
15828
16212
|
const plugins = [];
|
|
15829
16213
|
if (options.oauth?.google) {
|
|
@@ -15893,7 +16277,7 @@ var OAuthModule = class _OAuthModule {
|
|
|
15893
16277
|
};
|
|
15894
16278
|
}
|
|
15895
16279
|
};
|
|
15896
|
-
OAuthModule =
|
|
16280
|
+
OAuthModule = _ts_decorate68([
|
|
15897
16281
|
common.Module({})
|
|
15898
16282
|
], OAuthModule);
|
|
15899
16283
|
|
|
@@ -16788,7 +17172,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
|
|
|
16788
17172
|
__name(schemesFor, "schemesFor");
|
|
16789
17173
|
|
|
16790
17174
|
// src/server/openapi/auth-openapi.contributor.ts
|
|
16791
|
-
function
|
|
17175
|
+
function _ts_decorate69(decorators, target, key, desc) {
|
|
16792
17176
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16793
17177
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16794
17178
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16801,19 +17185,19 @@ function _ts_decorate67(decorators, target, key, desc) {
|
|
|
16801
17185
|
}
|
|
16802
17186
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16803
17187
|
}
|
|
16804
|
-
__name(
|
|
16805
|
-
function
|
|
17188
|
+
__name(_ts_decorate69, "_ts_decorate");
|
|
17189
|
+
function _ts_metadata66(metadataKey, metadataValue) {
|
|
16806
17190
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16807
17191
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16808
17192
|
}
|
|
16809
17193
|
}
|
|
16810
|
-
__name(
|
|
16811
|
-
function
|
|
17194
|
+
__name(_ts_metadata66, "_ts_metadata");
|
|
17195
|
+
function _ts_param43(paramIndex, decorator) {
|
|
16812
17196
|
return function(target, key) {
|
|
16813
17197
|
decorator(target, key, paramIndex);
|
|
16814
17198
|
};
|
|
16815
17199
|
}
|
|
16816
|
-
__name(
|
|
17200
|
+
__name(_ts_param43, "_ts_param");
|
|
16817
17201
|
var AuthOpenApiContributor = class {
|
|
16818
17202
|
static {
|
|
16819
17203
|
__name(this, "AuthOpenApiContributor");
|
|
@@ -16833,18 +17217,18 @@ var AuthOpenApiContributor = class {
|
|
|
16833
17217
|
return buildAuthOpenApiFragment(this.options, this.registered);
|
|
16834
17218
|
}
|
|
16835
17219
|
};
|
|
16836
|
-
AuthOpenApiContributor =
|
|
17220
|
+
AuthOpenApiContributor = _ts_decorate69([
|
|
16837
17221
|
common.Injectable(),
|
|
16838
17222
|
common.SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
|
|
17223
|
+
_ts_param43(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
17224
|
+
_ts_param43(1, common.Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
|
|
17225
|
+
_ts_metadata66("design:type", Function),
|
|
17226
|
+
_ts_metadata66("design:paramtypes", [
|
|
16843
17227
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
16844
17228
|
typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
|
|
16845
17229
|
])
|
|
16846
17230
|
], AuthOpenApiContributor);
|
|
16847
|
-
function
|
|
17231
|
+
function _ts_decorate70(decorators, target, key, desc) {
|
|
16848
17232
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16849
17233
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16850
17234
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16857,19 +17241,19 @@ function _ts_decorate68(decorators, target, key, desc) {
|
|
|
16857
17241
|
}
|
|
16858
17242
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16859
17243
|
}
|
|
16860
|
-
__name(
|
|
16861
|
-
function
|
|
17244
|
+
__name(_ts_decorate70, "_ts_decorate");
|
|
17245
|
+
function _ts_metadata67(metadataKey, metadataValue) {
|
|
16862
17246
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16863
17247
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16864
17248
|
}
|
|
16865
17249
|
}
|
|
16866
|
-
__name(
|
|
16867
|
-
function
|
|
17250
|
+
__name(_ts_metadata67, "_ts_metadata");
|
|
17251
|
+
function _ts_param44(paramIndex, decorator) {
|
|
16868
17252
|
return function(target, key) {
|
|
16869
17253
|
decorator(target, key, paramIndex);
|
|
16870
17254
|
};
|
|
16871
17255
|
}
|
|
16872
|
-
__name(
|
|
17256
|
+
__name(_ts_param44, "_ts_param");
|
|
16873
17257
|
var COMMON_BASE_WORDS = [
|
|
16874
17258
|
// The perennial top of every published list.
|
|
16875
17259
|
"password",
|
|
@@ -17175,16 +17559,16 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
|
|
|
17175
17559
|
return false;
|
|
17176
17560
|
}
|
|
17177
17561
|
};
|
|
17178
|
-
exports.CommonPasswordChecker =
|
|
17562
|
+
exports.CommonPasswordChecker = _ts_decorate70([
|
|
17179
17563
|
common.Injectable(),
|
|
17180
|
-
|
|
17181
|
-
|
|
17182
|
-
|
|
17183
|
-
|
|
17564
|
+
_ts_param44(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
17565
|
+
_ts_param44(0, common.Optional()),
|
|
17566
|
+
_ts_metadata67("design:type", Function),
|
|
17567
|
+
_ts_metadata67("design:paramtypes", [
|
|
17184
17568
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
17185
17569
|
])
|
|
17186
17570
|
], exports.CommonPasswordChecker);
|
|
17187
|
-
function
|
|
17571
|
+
function _ts_decorate71(decorators, target, key, desc) {
|
|
17188
17572
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17189
17573
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17190
17574
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17197,7 +17581,7 @@ function _ts_decorate69(decorators, target, key, desc) {
|
|
|
17197
17581
|
}
|
|
17198
17582
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17199
17583
|
}
|
|
17200
|
-
__name(
|
|
17584
|
+
__name(_ts_decorate71, "_ts_decorate");
|
|
17201
17585
|
exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
17202
17586
|
static {
|
|
17203
17587
|
__name(this, "NoOpEmailProvider");
|
|
@@ -17232,7 +17616,7 @@ exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
17232
17616
|
this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
|
|
17233
17617
|
}
|
|
17234
17618
|
};
|
|
17235
|
-
exports.NoOpEmailProvider =
|
|
17619
|
+
exports.NoOpEmailProvider = _ts_decorate71([
|
|
17236
17620
|
common.Injectable()
|
|
17237
17621
|
], exports.NoOpEmailProvider);
|
|
17238
17622
|
|
|
@@ -17246,7 +17630,7 @@ var SystemApiKeyClock = class {
|
|
|
17246
17630
|
return /* @__PURE__ */ new Date();
|
|
17247
17631
|
}
|
|
17248
17632
|
};
|
|
17249
|
-
function
|
|
17633
|
+
function _ts_decorate72(decorators, target, key, desc) {
|
|
17250
17634
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17251
17635
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17252
17636
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17259,19 +17643,19 @@ function _ts_decorate70(decorators, target, key, desc) {
|
|
|
17259
17643
|
}
|
|
17260
17644
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17261
17645
|
}
|
|
17262
|
-
__name(
|
|
17263
|
-
function
|
|
17646
|
+
__name(_ts_decorate72, "_ts_decorate");
|
|
17647
|
+
function _ts_metadata68(metadataKey, metadataValue) {
|
|
17264
17648
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17265
17649
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17266
17650
|
}
|
|
17267
17651
|
}
|
|
17268
|
-
__name(
|
|
17269
|
-
function
|
|
17652
|
+
__name(_ts_metadata68, "_ts_metadata");
|
|
17653
|
+
function _ts_param45(paramIndex, decorator) {
|
|
17270
17654
|
return function(target, key) {
|
|
17271
17655
|
decorator(target, key, paramIndex);
|
|
17272
17656
|
};
|
|
17273
17657
|
}
|
|
17274
|
-
__name(
|
|
17658
|
+
__name(_ts_param45, "_ts_param");
|
|
17275
17659
|
var ApiKeyScopeAuditService = class {
|
|
17276
17660
|
static {
|
|
17277
17661
|
__name(this, "ApiKeyScopeAuditService");
|
|
@@ -17314,21 +17698,21 @@ var ApiKeyScopeAuditService = class {
|
|
|
17314
17698
|
}
|
|
17315
17699
|
}
|
|
17316
17700
|
};
|
|
17317
|
-
ApiKeyScopeAuditService =
|
|
17701
|
+
ApiKeyScopeAuditService = _ts_decorate72([
|
|
17318
17702
|
common.Injectable(),
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
|
|
17703
|
+
_ts_param45(0, common.Inject(core.DiscoveryService)),
|
|
17704
|
+
_ts_param45(1, common.Inject(core.MetadataScanner)),
|
|
17705
|
+
_ts_param45(2, common.Inject(core.Reflector)),
|
|
17706
|
+
_ts_param45(3, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
17707
|
+
_ts_metadata68("design:type", Function),
|
|
17708
|
+
_ts_metadata68("design:paramtypes", [
|
|
17325
17709
|
typeof core.DiscoveryService === "undefined" ? Object : core.DiscoveryService,
|
|
17326
17710
|
typeof core.MetadataScanner === "undefined" ? Object : core.MetadataScanner,
|
|
17327
17711
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
17328
17712
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
17329
17713
|
])
|
|
17330
17714
|
], ApiKeyScopeAuditService);
|
|
17331
|
-
function
|
|
17715
|
+
function _ts_decorate73(decorators, target, key, desc) {
|
|
17332
17716
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17333
17717
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17334
17718
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17341,19 +17725,19 @@ function _ts_decorate71(decorators, target, key, desc) {
|
|
|
17341
17725
|
}
|
|
17342
17726
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17343
17727
|
}
|
|
17344
|
-
__name(
|
|
17345
|
-
function
|
|
17728
|
+
__name(_ts_decorate73, "_ts_decorate");
|
|
17729
|
+
function _ts_metadata69(metadataKey, metadataValue) {
|
|
17346
17730
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17347
17731
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17348
17732
|
}
|
|
17349
17733
|
}
|
|
17350
|
-
__name(
|
|
17351
|
-
function
|
|
17734
|
+
__name(_ts_metadata69, "_ts_metadata");
|
|
17735
|
+
function _ts_param46(paramIndex, decorator) {
|
|
17352
17736
|
return function(target, key) {
|
|
17353
17737
|
decorator(target, key, paramIndex);
|
|
17354
17738
|
};
|
|
17355
17739
|
}
|
|
17356
|
-
__name(
|
|
17740
|
+
__name(_ts_param46, "_ts_param");
|
|
17357
17741
|
var API_KEY_MAX_LABEL_LENGTH = 128;
|
|
17358
17742
|
var API_KEY_MAX_OVERLAP_SECONDS = 2592e3;
|
|
17359
17743
|
var CONTROL_CHARACTERS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
@@ -17491,13 +17875,13 @@ exports.ApiKeyService = class ApiKeyService {
|
|
|
17491
17875
|
return value;
|
|
17492
17876
|
}
|
|
17493
17877
|
};
|
|
17494
|
-
exports.ApiKeyService =
|
|
17878
|
+
exports.ApiKeyService = _ts_decorate73([
|
|
17495
17879
|
common.Injectable(),
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17880
|
+
_ts_param46(0, common.Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
17881
|
+
_ts_param46(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
17882
|
+
_ts_param46(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
17883
|
+
_ts_metadata69("design:type", Function),
|
|
17884
|
+
_ts_metadata69("design:paramtypes", [
|
|
17501
17885
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
17502
17886
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
17503
17887
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -17579,7 +17963,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
|
|
|
17579
17963
|
__name(assertTenantBinding, "assertTenantBinding");
|
|
17580
17964
|
|
|
17581
17965
|
// src/server/services/auth-token-verifier.service.ts
|
|
17582
|
-
function
|
|
17966
|
+
function _ts_decorate74(decorators, target, key, desc) {
|
|
17583
17967
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17584
17968
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17585
17969
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17592,19 +17976,19 @@ function _ts_decorate72(decorators, target, key, desc) {
|
|
|
17592
17976
|
}
|
|
17593
17977
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17594
17978
|
}
|
|
17595
|
-
__name(
|
|
17596
|
-
function
|
|
17979
|
+
__name(_ts_decorate74, "_ts_decorate");
|
|
17980
|
+
function _ts_metadata70(metadataKey, metadataValue) {
|
|
17597
17981
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17598
17982
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17599
17983
|
}
|
|
17600
17984
|
}
|
|
17601
|
-
__name(
|
|
17602
|
-
function
|
|
17985
|
+
__name(_ts_metadata70, "_ts_metadata");
|
|
17986
|
+
function _ts_param47(paramIndex, decorator) {
|
|
17603
17987
|
return function(target, key) {
|
|
17604
17988
|
decorator(target, key, paramIndex);
|
|
17605
17989
|
};
|
|
17606
17990
|
}
|
|
17607
|
-
__name(
|
|
17991
|
+
__name(_ts_param47, "_ts_param");
|
|
17608
17992
|
exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
17609
17993
|
static {
|
|
17610
17994
|
__name(this, "AuthTokenVerifierService");
|
|
@@ -17788,14 +18172,14 @@ exports.AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
17788
18172
|
}
|
|
17789
18173
|
}
|
|
17790
18174
|
};
|
|
17791
|
-
exports.AuthTokenVerifierService =
|
|
18175
|
+
exports.AuthTokenVerifierService = _ts_decorate74([
|
|
17792
18176
|
common.Injectable(),
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
18177
|
+
_ts_param47(0, common.Inject(jwt.JwtService)),
|
|
18178
|
+
_ts_param47(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
18179
|
+
_ts_param47(2, common.Inject(exports.AuthRevocationService)),
|
|
18180
|
+
_ts_param47(3, common.Inject(exports.AccountStatusService)),
|
|
18181
|
+
_ts_metadata70("design:type", Function),
|
|
18182
|
+
_ts_metadata70("design:paramtypes", [
|
|
17799
18183
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
17800
18184
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
17801
18185
|
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
@@ -17804,7 +18188,7 @@ exports.AuthTokenVerifierService = _ts_decorate72([
|
|
|
17804
18188
|
], exports.AuthTokenVerifierService);
|
|
17805
18189
|
|
|
17806
18190
|
// src/server/bymax-auth.module.ts
|
|
17807
|
-
function
|
|
18191
|
+
function _ts_decorate75(decorators, target, key, desc) {
|
|
17808
18192
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17809
18193
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17810
18194
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17817,7 +18201,7 @@ function _ts_decorate73(decorators, target, key, desc) {
|
|
|
17817
18201
|
}
|
|
17818
18202
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17819
18203
|
}
|
|
17820
|
-
__name(
|
|
18204
|
+
__name(_ts_decorate75, "_ts_decorate");
|
|
17821
18205
|
function hasProviderToken(providers, token) {
|
|
17822
18206
|
return providers.some((p) => {
|
|
17823
18207
|
if (typeof p === "function") return false;
|
|
@@ -18072,6 +18456,8 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
18072
18456
|
// it is the one place a caller re-proves the password before a sensitive change.
|
|
18073
18457
|
MfaFlowLockoutService,
|
|
18074
18458
|
MfaRecordService,
|
|
18459
|
+
MfaChallengeService,
|
|
18460
|
+
MfaManagementService,
|
|
18075
18461
|
exports.ReauthenticationService,
|
|
18076
18462
|
exports.OtpService,
|
|
18077
18463
|
// SessionService is always registered (not gated on includeSessions) because
|
|
@@ -18217,7 +18603,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
18217
18603
|
};
|
|
18218
18604
|
}
|
|
18219
18605
|
};
|
|
18220
|
-
exports.BymaxAuthModule =
|
|
18606
|
+
exports.BymaxAuthModule = _ts_decorate75([
|
|
18221
18607
|
common.Module({})
|
|
18222
18608
|
], exports.BymaxAuthModule);
|
|
18223
18609
|
|
|
@@ -18545,7 +18931,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
18545
18931
|
}
|
|
18546
18932
|
}
|
|
18547
18933
|
};
|
|
18548
|
-
function
|
|
18934
|
+
function _ts_decorate76(decorators, target, key, desc) {
|
|
18549
18935
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18550
18936
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18551
18937
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18558,13 +18944,13 @@ function _ts_decorate74(decorators, target, key, desc) {
|
|
|
18558
18944
|
}
|
|
18559
18945
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18560
18946
|
}
|
|
18561
|
-
__name(
|
|
18562
|
-
function
|
|
18947
|
+
__name(_ts_decorate76, "_ts_decorate");
|
|
18948
|
+
function _ts_metadata71(metadataKey, metadataValue) {
|
|
18563
18949
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18564
18950
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18565
18951
|
}
|
|
18566
18952
|
}
|
|
18567
|
-
__name(
|
|
18953
|
+
__name(_ts_metadata71, "_ts_metadata");
|
|
18568
18954
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
18569
18955
|
var PREFIX_LENGTH = 5;
|
|
18570
18956
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -18621,10 +19007,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
|
|
|
18621
19007
|
}
|
|
18622
19008
|
}
|
|
18623
19009
|
};
|
|
18624
|
-
exports.HibpBreachChecker =
|
|
19010
|
+
exports.HibpBreachChecker = _ts_decorate76([
|
|
18625
19011
|
common.Injectable(),
|
|
18626
|
-
|
|
18627
|
-
|
|
19012
|
+
_ts_metadata71("design:type", Function),
|
|
19013
|
+
_ts_metadata71("design:paramtypes", [
|
|
18628
19014
|
Number
|
|
18629
19015
|
])
|
|
18630
19016
|
], exports.HibpBreachChecker);
|
|
@@ -18637,10 +19023,10 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
|
|
|
18637
19023
|
return false;
|
|
18638
19024
|
}
|
|
18639
19025
|
};
|
|
18640
|
-
exports.AllowAllBreachChecker =
|
|
19026
|
+
exports.AllowAllBreachChecker = _ts_decorate76([
|
|
18641
19027
|
common.Injectable()
|
|
18642
19028
|
], exports.AllowAllBreachChecker);
|
|
18643
|
-
function
|
|
19029
|
+
function _ts_decorate77(decorators, target, key, desc) {
|
|
18644
19030
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18645
19031
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18646
19032
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18653,7 +19039,7 @@ function _ts_decorate75(decorators, target, key, desc) {
|
|
|
18653
19039
|
}
|
|
18654
19040
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18655
19041
|
}
|
|
18656
|
-
__name(
|
|
19042
|
+
__name(_ts_decorate77, "_ts_decorate");
|
|
18657
19043
|
exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
|
|
18658
19044
|
static {
|
|
18659
19045
|
__name(this, "OptionalAuthGuard");
|
|
@@ -18668,10 +19054,10 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
|
|
|
18668
19054
|
return super.canActivate(context);
|
|
18669
19055
|
}
|
|
18670
19056
|
};
|
|
18671
|
-
exports.OptionalAuthGuard =
|
|
19057
|
+
exports.OptionalAuthGuard = _ts_decorate77([
|
|
18672
19058
|
common.Injectable()
|
|
18673
19059
|
], exports.OptionalAuthGuard);
|
|
18674
|
-
function
|
|
19060
|
+
function _ts_decorate78(decorators, target, key, desc) {
|
|
18675
19061
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18676
19062
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18677
19063
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18684,19 +19070,19 @@ function _ts_decorate76(decorators, target, key, desc) {
|
|
|
18684
19070
|
}
|
|
18685
19071
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18686
19072
|
}
|
|
18687
|
-
__name(
|
|
18688
|
-
function
|
|
19073
|
+
__name(_ts_decorate78, "_ts_decorate");
|
|
19074
|
+
function _ts_metadata72(metadataKey, metadataValue) {
|
|
18689
19075
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18690
19076
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18691
19077
|
}
|
|
18692
19078
|
}
|
|
18693
|
-
__name(
|
|
18694
|
-
function
|
|
19079
|
+
__name(_ts_metadata72, "_ts_metadata");
|
|
19080
|
+
function _ts_param48(paramIndex, decorator) {
|
|
18695
19081
|
return function(target, key) {
|
|
18696
19082
|
decorator(target, key, paramIndex);
|
|
18697
19083
|
};
|
|
18698
19084
|
}
|
|
18699
|
-
__name(
|
|
19085
|
+
__name(_ts_param48, "_ts_param");
|
|
18700
19086
|
exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
18701
19087
|
static {
|
|
18702
19088
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -18732,11 +19118,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
|
18732
19118
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
18733
19119
|
}
|
|
18734
19120
|
};
|
|
18735
|
-
exports.SelfOrAdminGuard =
|
|
19121
|
+
exports.SelfOrAdminGuard = _ts_decorate78([
|
|
18736
19122
|
common.Injectable(),
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
|
|
19123
|
+
_ts_param48(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
19124
|
+
_ts_metadata72("design:type", Function),
|
|
19125
|
+
_ts_metadata72("design:paramtypes", [
|
|
18740
19126
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
18741
19127
|
])
|
|
18742
19128
|
], exports.SelfOrAdminGuard);
|
|
@@ -18758,7 +19144,7 @@ function isHexLooking(value) {
|
|
|
18758
19144
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
18759
19145
|
}
|
|
18760
19146
|
__name(isHexLooking, "isHexLooking");
|
|
18761
|
-
function
|
|
19147
|
+
function _ts_decorate79(decorators, target, key, desc) {
|
|
18762
19148
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18763
19149
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18764
19150
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18771,19 +19157,19 @@ function _ts_decorate77(decorators, target, key, desc) {
|
|
|
18771
19157
|
}
|
|
18772
19158
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18773
19159
|
}
|
|
18774
|
-
__name(
|
|
18775
|
-
function
|
|
19160
|
+
__name(_ts_decorate79, "_ts_decorate");
|
|
19161
|
+
function _ts_metadata73(metadataKey, metadataValue) {
|
|
18776
19162
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18777
19163
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18778
19164
|
}
|
|
18779
19165
|
}
|
|
18780
|
-
__name(
|
|
18781
|
-
function
|
|
19166
|
+
__name(_ts_metadata73, "_ts_metadata");
|
|
19167
|
+
function _ts_param49(paramIndex, decorator) {
|
|
18782
19168
|
return function(target, key) {
|
|
18783
19169
|
decorator(target, key, paramIndex);
|
|
18784
19170
|
};
|
|
18785
19171
|
}
|
|
18786
|
-
__name(
|
|
19172
|
+
__name(_ts_param49, "_ts_param");
|
|
18787
19173
|
exports.WsJwtGuard = class WsJwtGuard {
|
|
18788
19174
|
static {
|
|
18789
19175
|
__name(this, "WsJwtGuard");
|
|
@@ -18847,14 +19233,14 @@ exports.WsJwtGuard = class WsJwtGuard {
|
|
|
18847
19233
|
return true;
|
|
18848
19234
|
}
|
|
18849
19235
|
};
|
|
18850
|
-
exports.WsJwtGuard =
|
|
19236
|
+
exports.WsJwtGuard = _ts_decorate79([
|
|
18851
19237
|
common.Injectable(),
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
19238
|
+
_ts_param49(0, common.Inject(jwt.JwtService)),
|
|
19239
|
+
_ts_param49(1, common.Inject(exports.AuthRevocationService)),
|
|
19240
|
+
_ts_param49(2, common.Inject(exports.WsTicketService)),
|
|
19241
|
+
_ts_param49(3, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
19242
|
+
_ts_metadata73("design:type", Function),
|
|
19243
|
+
_ts_metadata73("design:paramtypes", [
|
|
18858
19244
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
18859
19245
|
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
18860
19246
|
typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
|
|
@@ -18894,7 +19280,7 @@ function bindingInput(handshake) {
|
|
|
18894
19280
|
};
|
|
18895
19281
|
}
|
|
18896
19282
|
__name(bindingInput, "bindingInput");
|
|
18897
|
-
function
|
|
19283
|
+
function _ts_decorate80(decorators, target, key, desc) {
|
|
18898
19284
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18899
19285
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18900
19286
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18907,7 +19293,7 @@ function _ts_decorate78(decorators, target, key, desc) {
|
|
|
18907
19293
|
}
|
|
18908
19294
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18909
19295
|
}
|
|
18910
|
-
__name(
|
|
19296
|
+
__name(_ts_decorate80, "_ts_decorate");
|
|
18911
19297
|
function isAuthEnvelope(body) {
|
|
18912
19298
|
if (typeof body !== "object" || body === null) return false;
|
|
18913
19299
|
const error = body.error;
|
|
@@ -19026,10 +19412,10 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
19026
19412
|
});
|
|
19027
19413
|
}
|
|
19028
19414
|
};
|
|
19029
|
-
exports.AuthExceptionFilter =
|
|
19415
|
+
exports.AuthExceptionFilter = _ts_decorate80([
|
|
19030
19416
|
common.Catch()
|
|
19031
19417
|
], exports.AuthExceptionFilter);
|
|
19032
|
-
function
|
|
19418
|
+
function _ts_decorate81(decorators, target, key, desc) {
|
|
19033
19419
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19034
19420
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
19035
19421
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -19042,7 +19428,7 @@ function _ts_decorate79(decorators, target, key, desc) {
|
|
|
19042
19428
|
}
|
|
19043
19429
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19044
19430
|
}
|
|
19045
|
-
__name(
|
|
19431
|
+
__name(_ts_decorate81, "_ts_decorate");
|
|
19046
19432
|
function isEmittingClient(client) {
|
|
19047
19433
|
return typeof client?.emit === "function";
|
|
19048
19434
|
}
|
|
@@ -19086,7 +19472,7 @@ exports.WsAuthExceptionFilter = class _WsAuthExceptionFilter {
|
|
|
19086
19472
|
this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
|
|
19087
19473
|
}
|
|
19088
19474
|
};
|
|
19089
|
-
exports.WsAuthExceptionFilter =
|
|
19475
|
+
exports.WsAuthExceptionFilter = _ts_decorate81([
|
|
19090
19476
|
common.Catch(AuthException)
|
|
19091
19477
|
], exports.WsAuthExceptionFilter);
|
|
19092
19478
|
var ServiceKey = /* @__PURE__ */ __name((...scopes) => common.applyDecorators(common.SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), common.UseGuards(exports.ApiKeyGuard)), "ServiceKey");
|