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