@bymax-one/nest-auth 1.4.19 → 1.4.21
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 +80 -1
- package/README.md +10 -9
- package/dist/server/index.cjs +1234 -1155
- package/dist/server/index.d.cts +259 -294
- package/dist/server/index.d.ts +259 -294
- package/dist/server/index.mjs +1235 -1156
- package/package.json +3 -1
package/dist/server/index.mjs
CHANGED
|
@@ -1967,7 +1967,6 @@ var REFRESH_PREFIXES = {
|
|
|
1967
1967
|
grace: "rp",
|
|
1968
1968
|
consumed: "cf",
|
|
1969
1969
|
family: "fam",
|
|
1970
|
-
index: "sess",
|
|
1971
1970
|
detail: "sd"
|
|
1972
1971
|
},
|
|
1973
1972
|
platform: {
|
|
@@ -1975,7 +1974,6 @@ var REFRESH_PREFIXES = {
|
|
|
1975
1974
|
grace: "prp",
|
|
1976
1975
|
consumed: "pcf",
|
|
1977
1976
|
family: "pfam",
|
|
1978
|
-
index: "psess",
|
|
1979
1977
|
detail: "psd"
|
|
1980
1978
|
}
|
|
1981
1979
|
};
|
|
@@ -4655,7 +4653,7 @@ var MAX_SCRYPT_PARAMETER = 255;
|
|
|
4655
4653
|
var MIN_KEY_LEN = 10;
|
|
4656
4654
|
var MAX_KEY_LEN = 64;
|
|
4657
4655
|
function toPhcB64(value) {
|
|
4658
|
-
return value.toString("base64").
|
|
4656
|
+
return value.toString("base64").replaceAll("=", "");
|
|
4659
4657
|
}
|
|
4660
4658
|
__name(toPhcB64, "toPhcB64");
|
|
4661
4659
|
function fromPhcB64(value) {
|
|
@@ -9970,6 +9968,130 @@ _ts_decorate36([
|
|
|
9970
9968
|
IsNotEmpty(),
|
|
9971
9969
|
_ts_metadata35("design:type", String)
|
|
9972
9970
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
9971
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
9972
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9973
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9974
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
9975
|
+
} else {
|
|
9976
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9977
|
+
if (d = decorators[i]) {
|
|
9978
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
}
|
|
9982
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9983
|
+
}
|
|
9984
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
9985
|
+
function _ts_metadata36(metadataKey, metadataValue) {
|
|
9986
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9987
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
9988
|
+
}
|
|
9989
|
+
}
|
|
9990
|
+
__name(_ts_metadata36, "_ts_metadata");
|
|
9991
|
+
function _ts_param21(paramIndex, decorator) {
|
|
9992
|
+
return function(target, key) {
|
|
9993
|
+
decorator(target, key, paramIndex);
|
|
9994
|
+
};
|
|
9995
|
+
}
|
|
9996
|
+
__name(_ts_param21, "_ts_param");
|
|
9997
|
+
var MfaFlowLockoutService = class {
|
|
9998
|
+
static {
|
|
9999
|
+
__name(this, "MfaFlowLockoutService");
|
|
10000
|
+
}
|
|
10001
|
+
options;
|
|
10002
|
+
bruteForce;
|
|
10003
|
+
constructor(options, bruteForce) {
|
|
10004
|
+
this.options = options;
|
|
10005
|
+
this.bruteForce = bruteForce;
|
|
10006
|
+
}
|
|
10007
|
+
/**
|
|
10008
|
+
* The tenant-scoped brute-force identifier for one MFA flow, and the plane-only one that pods on
|
|
10009
|
+
* an older version count under. The two are equal on the platform plane, where the subject
|
|
10010
|
+
* carries no tenant, and distinct on the dashboard plane, where it does.
|
|
10011
|
+
*
|
|
10012
|
+
* A rolling upgrade runs old and new code against one Redis at once: on the dashboard plane an
|
|
10013
|
+
* old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
|
|
10014
|
+
* `{flow}:{userSubject}`, and either alone leaves a hole: a lockout an old pod filled would not
|
|
10015
|
+
* stop a new pod, and a success on one would not clear the other. So every read consults both
|
|
10016
|
+
* and every write touches both, and the two move as one; the plane-only arm can be dropped once
|
|
10017
|
+
* no pod writes it. On the platform plane the two ids are identical, so the plane-only arm is
|
|
10018
|
+
* skipped: operating it would be the same key a second time, double-counting a failure and
|
|
10019
|
+
* locking a platform admin out at half the threshold. `{flow}` (`challenge` / `disable` /
|
|
10020
|
+
* `reauth`) keeps the three counters isolated from each other.
|
|
10021
|
+
*/
|
|
10022
|
+
counterIds(flow, context, userId, tenantId) {
|
|
10023
|
+
return {
|
|
10024
|
+
legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
|
|
10025
|
+
scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
|
|
10026
|
+
};
|
|
10027
|
+
}
|
|
10028
|
+
/**
|
|
10029
|
+
* Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
|
|
10030
|
+
* neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
|
|
10031
|
+
*/
|
|
10032
|
+
async isLockedOut(flow, context, userId, tenantId) {
|
|
10033
|
+
const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
|
|
10034
|
+
if (await this.bruteForce.isLockedOut(scoped)) return true;
|
|
10035
|
+
return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
|
|
10036
|
+
}
|
|
10037
|
+
/**
|
|
10038
|
+
* Records the failure under both counters so the budget an attacker spends is seen by old and
|
|
10039
|
+
* new code alike — but under the scoped id ONCE when the two coincide (platform plane).
|
|
10040
|
+
*/
|
|
10041
|
+
async recordFailure(flow, context, userId, tenantId) {
|
|
10042
|
+
const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
|
|
10043
|
+
await this.bruteForce.recordFailure(scoped);
|
|
10044
|
+
if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
|
|
10045
|
+
}
|
|
10046
|
+
/**
|
|
10047
|
+
* Clears both counters on success — resetting only one would leave the other to lock a
|
|
10048
|
+
* legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
|
|
10049
|
+
*/
|
|
10050
|
+
async reset(flow, context, userId, tenantId) {
|
|
10051
|
+
const { legacy, scoped } = this.counterIds(flow, context, userId, tenantId);
|
|
10052
|
+
await this.bruteForce.resetFailures(scoped);
|
|
10053
|
+
if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
|
|
10054
|
+
}
|
|
10055
|
+
};
|
|
10056
|
+
MfaFlowLockoutService = _ts_decorate37([
|
|
10057
|
+
Injectable(),
|
|
10058
|
+
_ts_param21(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
10059
|
+
_ts_param21(1, Inject(BruteForceService)),
|
|
10060
|
+
_ts_metadata36("design:type", Function),
|
|
10061
|
+
_ts_metadata36("design:paramtypes", [
|
|
10062
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
10063
|
+
typeof BruteForceService === "undefined" ? Object : BruteForceService
|
|
10064
|
+
])
|
|
10065
|
+
], MfaFlowLockoutService);
|
|
10066
|
+
|
|
10067
|
+
// src/server/utils/mfa-plane-tenant.ts
|
|
10068
|
+
var PLANE_TENANT_MESSAGE = "tenantId must be a non-empty value on the dashboard plane and absent on the platform plane";
|
|
10069
|
+
function assertDashboardTenant(tenantId) {
|
|
10070
|
+
if (tenantId === void 0 || tenantId === "") {
|
|
10071
|
+
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
10072
|
+
{
|
|
10073
|
+
field: "tenantId",
|
|
10074
|
+
message: PLANE_TENANT_MESSAGE
|
|
10075
|
+
}
|
|
10076
|
+
]);
|
|
10077
|
+
}
|
|
10078
|
+
}
|
|
10079
|
+
__name(assertDashboardTenant, "assertDashboardTenant");
|
|
10080
|
+
function assertPlaneTenant(context, tenantId) {
|
|
10081
|
+
if (context === "dashboard") {
|
|
10082
|
+
assertDashboardTenant(tenantId);
|
|
10083
|
+
return;
|
|
10084
|
+
}
|
|
10085
|
+
if (tenantId !== void 0) {
|
|
10086
|
+
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
10087
|
+
{
|
|
10088
|
+
field: "tenantId",
|
|
10089
|
+
message: PLANE_TENANT_MESSAGE
|
|
10090
|
+
}
|
|
10091
|
+
]);
|
|
10092
|
+
}
|
|
10093
|
+
}
|
|
10094
|
+
__name(assertPlaneTenant, "assertPlaneTenant");
|
|
9973
10095
|
var IV_LENGTH = 12;
|
|
9974
10096
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
9975
10097
|
function encrypt(plaintext, keyBase64) {
|
|
@@ -10019,20 +10141,47 @@ function decrypt(ciphertext, keyBase64) {
|
|
|
10019
10141
|
}
|
|
10020
10142
|
__name(decrypt, "decrypt");
|
|
10021
10143
|
|
|
10022
|
-
// src/server/utils/
|
|
10023
|
-
function
|
|
10144
|
+
// src/server/utils/mfa-secret-cipher.ts
|
|
10145
|
+
function holdsSecret(stored, secretBase32, keys) {
|
|
10146
|
+
if (!stored) return false;
|
|
10024
10147
|
try {
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
} catch (err) {
|
|
10029
|
-
logger.error(`${failure}: ${describeChannelStatus(err)}`);
|
|
10148
|
+
return timingSafeCompare(decryptWithRotation(stored, keys).secret, secretBase32);
|
|
10149
|
+
} catch {
|
|
10150
|
+
return false;
|
|
10030
10151
|
}
|
|
10031
10152
|
}
|
|
10032
|
-
__name(
|
|
10153
|
+
__name(holdsSecret, "holdsSecret");
|
|
10154
|
+
function encryptMfaSecret(secret, keys) {
|
|
10155
|
+
return encrypt(secret, keys.encryptionKey);
|
|
10156
|
+
}
|
|
10157
|
+
__name(encryptMfaSecret, "encryptMfaSecret");
|
|
10158
|
+
function decryptMfaSecret(encrypted, keys) {
|
|
10159
|
+
return decryptWithRotation(encrypted, keys).secret;
|
|
10160
|
+
}
|
|
10161
|
+
__name(decryptMfaSecret, "decryptMfaSecret");
|
|
10162
|
+
function decryptWithRotation(encrypted, keys) {
|
|
10163
|
+
try {
|
|
10164
|
+
return {
|
|
10165
|
+
secret: decrypt(encrypted, keys.encryptionKey),
|
|
10166
|
+
stale: false
|
|
10167
|
+
};
|
|
10168
|
+
} catch {
|
|
10169
|
+
for (const key of keys.previousEncryptionKeys ?? []) {
|
|
10170
|
+
try {
|
|
10171
|
+
return {
|
|
10172
|
+
secret: decrypt(encrypted, key),
|
|
10173
|
+
stale: true
|
|
10174
|
+
};
|
|
10175
|
+
} catch {
|
|
10176
|
+
}
|
|
10177
|
+
}
|
|
10178
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10179
|
+
}
|
|
10180
|
+
}
|
|
10181
|
+
__name(decryptWithRotation, "decryptWithRotation");
|
|
10033
10182
|
|
|
10034
|
-
// src/server/services/mfa.service.ts
|
|
10035
|
-
function
|
|
10183
|
+
// src/server/services/mfa-record.service.ts
|
|
10184
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
10036
10185
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10037
10186
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10038
10187
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -10045,25 +10194,19 @@ function _ts_decorate37(decorators, target, key, desc) {
|
|
|
10045
10194
|
}
|
|
10046
10195
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10047
10196
|
}
|
|
10048
|
-
__name(
|
|
10049
|
-
function
|
|
10197
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
10198
|
+
function _ts_metadata37(metadataKey, metadataValue) {
|
|
10050
10199
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10051
10200
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
10052
10201
|
}
|
|
10053
10202
|
}
|
|
10054
|
-
__name(
|
|
10055
|
-
function
|
|
10203
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
10204
|
+
function _ts_param22(paramIndex, decorator) {
|
|
10056
10205
|
return function(target, key) {
|
|
10057
10206
|
decorator(target, key, paramIndex);
|
|
10058
10207
|
};
|
|
10059
10208
|
}
|
|
10060
|
-
__name(
|
|
10061
|
-
var PLATFORM_EMAIL_TENANT = "platform";
|
|
10062
|
-
function emailTenantOf(user) {
|
|
10063
|
-
return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
|
|
10064
|
-
}
|
|
10065
|
-
__name(emailTenantOf, "emailTenantOf");
|
|
10066
|
-
var MFA_SETUP_TTL_SECONDS = 600;
|
|
10209
|
+
__name(_ts_param22, "_ts_param");
|
|
10067
10210
|
var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
|
|
10068
10211
|
function totpAntiReplayTtlSeconds(window) {
|
|
10069
10212
|
const effective = Math.min(Math.max(window, 0), MAX_VERIFY_WINDOW);
|
|
@@ -10075,58 +10218,21 @@ var RELEASE_LOCK_LUA = `if redis.call('GET', KEYS[1]) == ARGV[1] then
|
|
|
10075
10218
|
return redis.call('DEL', KEYS[1])
|
|
10076
10219
|
end
|
|
10077
10220
|
return 0`;
|
|
10078
|
-
var
|
|
10079
|
-
function isMfaSetupData(value) {
|
|
10080
|
-
if (value === null) return false;
|
|
10081
|
-
if (typeof value !== "object") return false;
|
|
10082
|
-
const v = value;
|
|
10083
|
-
return typeof v["encryptedSecret"] === "string" && typeof v["encryptedPlainCodes"] === "string" && Array.isArray(v["hashedCodes"]) && v["hashedCodes"].every((code) => typeof code === "string");
|
|
10084
|
-
}
|
|
10085
|
-
__name(isMfaSetupData, "isMfaSetupData");
|
|
10086
|
-
var PLANE_TENANT_MESSAGE = "tenantId must be a non-empty value on the dashboard plane and absent on the platform plane";
|
|
10087
|
-
var MfaService = class _MfaService {
|
|
10221
|
+
var MfaRecordService = class _MfaRecordService {
|
|
10088
10222
|
static {
|
|
10089
|
-
__name(this, "
|
|
10223
|
+
__name(this, "MfaRecordService");
|
|
10090
10224
|
}
|
|
10091
10225
|
options;
|
|
10092
10226
|
userRepo;
|
|
10093
10227
|
platformUserRepo;
|
|
10094
10228
|
redis;
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
passwordService;
|
|
10098
|
-
sessionService;
|
|
10099
|
-
emailProvider;
|
|
10100
|
-
hooks;
|
|
10101
|
-
logger = new Logger(_MfaService.name);
|
|
10102
|
-
constructor(options, userRepo, platformUserRepo, redis, tokenManager, bruteForce, passwordService, sessionService, emailProvider, hooks) {
|
|
10229
|
+
logger = new Logger(_MfaRecordService.name);
|
|
10230
|
+
constructor(options, userRepo, platformUserRepo, redis) {
|
|
10103
10231
|
this.options = options;
|
|
10104
10232
|
this.userRepo = userRepo;
|
|
10105
10233
|
this.platformUserRepo = platformUserRepo;
|
|
10106
10234
|
this.redis = redis;
|
|
10107
|
-
this.tokenManager = tokenManager;
|
|
10108
|
-
this.bruteForce = bruteForce;
|
|
10109
|
-
this.passwordService = passwordService;
|
|
10110
|
-
this.sessionService = sessionService;
|
|
10111
|
-
this.emailProvider = emailProvider;
|
|
10112
|
-
this.hooks = hooks;
|
|
10113
10235
|
}
|
|
10114
|
-
// ---------------------------------------------------------------------------
|
|
10115
|
-
// Private accessor — options.mfa is guaranteed non-null when service is active
|
|
10116
|
-
// ---------------------------------------------------------------------------
|
|
10117
|
-
/**
|
|
10118
|
-
* Returns the resolved MFA configuration. `options.mfa` is always present when `MfaService` is registered.
|
|
10119
|
-
*
|
|
10120
|
-
* `options.mfa` is always present when `MfaService` is registered — the module
|
|
10121
|
-
* only registers the service when `mfa` is configured. The single suppression
|
|
10122
|
-
* here eliminates repetitive `!` assertions throughout the class.
|
|
10123
|
-
*/
|
|
10124
|
-
get mfaOptions() {
|
|
10125
|
-
return this.options.mfa;
|
|
10126
|
-
}
|
|
10127
|
-
// ---------------------------------------------------------------------------
|
|
10128
|
-
// Private crypto helpers
|
|
10129
|
-
// ---------------------------------------------------------------------------
|
|
10130
10236
|
/**
|
|
10131
10237
|
* Store the TOTP secret re-encrypted under the current key.
|
|
10132
10238
|
*
|
|
@@ -10144,14 +10250,15 @@ var MfaService = class _MfaService {
|
|
|
10144
10250
|
* @param context - Which identity plane the account belongs to.
|
|
10145
10251
|
* @param secretBase32 - The decrypted secret.
|
|
10146
10252
|
* @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
|
|
10253
|
+
* @param keys - The secret-cipher keys; the secret is written under the current one.
|
|
10147
10254
|
*/
|
|
10148
|
-
async reencryptSecret(userId, context, secretBase32, tenantId) {
|
|
10255
|
+
async reencryptSecret(userId, context, secretBase32, tenantId, keys) {
|
|
10149
10256
|
try {
|
|
10150
|
-
await this.
|
|
10151
|
-
if (!current.mfaEnabled || !
|
|
10257
|
+
await this.transition(context, userId, tenantId, (current) => {
|
|
10258
|
+
if (!current.mfaEnabled || !holdsSecret(current.mfaSecret, secretBase32, keys)) return null;
|
|
10152
10259
|
return {
|
|
10153
10260
|
mfaEnabled: true,
|
|
10154
|
-
mfaSecret:
|
|
10261
|
+
mfaSecret: encryptMfaSecret(secretBase32, keys),
|
|
10155
10262
|
mfaRecoveryCodes: current.mfaRecoveryCodes ?? []
|
|
10156
10263
|
};
|
|
10157
10264
|
});
|
|
@@ -10196,7 +10303,7 @@ var MfaService = class _MfaService {
|
|
|
10196
10303
|
* @returns `true` when a write happened, `false` when `mutate` abandoned the transition.
|
|
10197
10304
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
10198
10305
|
*/
|
|
10199
|
-
async
|
|
10306
|
+
async transition(context, userId, tenantId, mutate) {
|
|
10200
10307
|
const scopedLockKey = `mfalock:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
10201
10308
|
const legacyLockKey = `mfalock:${hmacSha256(`${context}:${userId}`, this.options.hmacKey)}`;
|
|
10202
10309
|
const acquireLegacy = legacyLockKey !== scopedLockKey;
|
|
@@ -10213,7 +10320,7 @@ var MfaService = class _MfaService {
|
|
|
10213
10320
|
throw new AuthException(AUTH_ERROR_CODES.MFA_STATE_CONFLICT);
|
|
10214
10321
|
}
|
|
10215
10322
|
try {
|
|
10216
|
-
const current = await this.
|
|
10323
|
+
const current = await this.loadAccount(context, userId, tenantId);
|
|
10217
10324
|
const update = mutate(current);
|
|
10218
10325
|
if (update === null) return false;
|
|
10219
10326
|
const write = {
|
|
@@ -10224,7 +10331,7 @@ var MfaService = class _MfaService {
|
|
|
10224
10331
|
if (context === "platform" && this.platformUserRepo) {
|
|
10225
10332
|
await this.platformUserRepo.updateMfa(userId, write);
|
|
10226
10333
|
} else {
|
|
10227
|
-
|
|
10334
|
+
assertDashboardTenant(tenantId);
|
|
10228
10335
|
await this.userRepo.updateMfa({
|
|
10229
10336
|
id: userId,
|
|
10230
10337
|
tenantId,
|
|
@@ -10248,180 +10355,6 @@ var MfaService = class _MfaService {
|
|
|
10248
10355
|
}
|
|
10249
10356
|
}
|
|
10250
10357
|
/**
|
|
10251
|
-
* Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
|
|
10252
|
-
*
|
|
10253
|
-
* Compares plaintext, so a record that was only re-encrypted still matches and one holding a
|
|
10254
|
-
* different secret does not. A ciphertext no key opens does not match either.
|
|
10255
|
-
*/
|
|
10256
|
-
holdsSecret(stored, secretBase32) {
|
|
10257
|
-
if (!stored) return false;
|
|
10258
|
-
try {
|
|
10259
|
-
return timingSafeCompare(this.decryptWithRotation(stored).secret, secretBase32);
|
|
10260
|
-
} catch {
|
|
10261
|
-
return false;
|
|
10262
|
-
}
|
|
10263
|
-
}
|
|
10264
|
-
/**
|
|
10265
|
-
* Encrypts a TOTP secret for storage in the database using AES-256-GCM.
|
|
10266
|
-
*/
|
|
10267
|
-
encryptSecret(secret) {
|
|
10268
|
-
return encrypt(secret, this.mfaOptions.encryptionKey);
|
|
10269
|
-
}
|
|
10270
|
-
/**
|
|
10271
|
-
* Decrypts a stored TOTP secret, falling back to keys retired by a rotation.
|
|
10272
|
-
*
|
|
10273
|
-
* The ciphertext records no key identifier, so without the retired keys, changing
|
|
10274
|
-
* `mfa.encryptionKey` makes every stored secret undecryptable — every enrolled user's
|
|
10275
|
-
* authenticator stops matching at once, with no way back. AES-GCM authenticates, so a wrong
|
|
10276
|
-
* key fails unambiguously rather than returning garbage; trying them in order is safe.
|
|
10277
|
-
*
|
|
10278
|
-
* Re-throws any decryption failure as an opaque `TOKEN_INVALID` to prevent
|
|
10279
|
-
* error-type oracle attacks (callers cannot distinguish format vs. tamper errors).
|
|
10280
|
-
*/
|
|
10281
|
-
decryptSecret(encrypted) {
|
|
10282
|
-
return this.decryptWithRotation(encrypted).secret;
|
|
10283
|
-
}
|
|
10284
|
-
/**
|
|
10285
|
-
* Decrypt under the current key, then under each retired one.
|
|
10286
|
-
*
|
|
10287
|
-
* @param encrypted - The stored ciphertext.
|
|
10288
|
-
* @returns The plaintext and whether a retired key produced it — the signal that the record
|
|
10289
|
-
* should be re-encrypted under the current key.
|
|
10290
|
-
* @throws {@link AuthException} `TOKEN_INVALID` when no key decrypts it.
|
|
10291
|
-
*/
|
|
10292
|
-
decryptWithRotation(encrypted) {
|
|
10293
|
-
try {
|
|
10294
|
-
return {
|
|
10295
|
-
secret: decrypt(encrypted, this.mfaOptions.encryptionKey),
|
|
10296
|
-
stale: false
|
|
10297
|
-
};
|
|
10298
|
-
} catch {
|
|
10299
|
-
for (const key of this.mfaOptions.previousEncryptionKeys ?? []) {
|
|
10300
|
-
try {
|
|
10301
|
-
return {
|
|
10302
|
-
secret: decrypt(encrypted, key),
|
|
10303
|
-
stale: true
|
|
10304
|
-
};
|
|
10305
|
-
} catch {
|
|
10306
|
-
}
|
|
10307
|
-
}
|
|
10308
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10309
|
-
}
|
|
10310
|
-
}
|
|
10311
|
-
/**
|
|
10312
|
-
* Safely parses a Redis-stored {@link MfaSetupData} JSON payload.
|
|
10313
|
-
*
|
|
10314
|
-
* A corrupted or tampered Redis value would otherwise raise an unhandled
|
|
10315
|
-
* `SyntaxError` from the service boundary (uncaught 500). We translate the
|
|
10316
|
-
* failure into an opaque `MFA_SETUP_REQUIRED`, which mirrors the response
|
|
10317
|
-
* the caller would receive if the key were absent — preventing an attacker
|
|
10318
|
-
* with Redis write access from distinguishing "no setup pending" from
|
|
10319
|
-
* "setup payload corrupted".
|
|
10320
|
-
*/
|
|
10321
|
-
parseSetupData(raw, userId) {
|
|
10322
|
-
let parsed;
|
|
10323
|
-
try {
|
|
10324
|
-
parsed = JSON.parse(raw);
|
|
10325
|
-
} catch {
|
|
10326
|
-
this.logger.warn(`parseSetupData: pending-setup payload is not valid JSON userId=${logSafe(userId)}`);
|
|
10327
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10328
|
-
}
|
|
10329
|
-
if (!isMfaSetupData(parsed)) {
|
|
10330
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10331
|
-
}
|
|
10332
|
-
return parsed;
|
|
10333
|
-
}
|
|
10334
|
-
/**
|
|
10335
|
-
* Safely parses the AES-decrypted JSON array of plain-text recovery codes.
|
|
10336
|
-
*
|
|
10337
|
-
* A decrypted value that fails JSON parsing indicates either a downgrade of
|
|
10338
|
-
* the stored payload (highly unlikely, since AES-GCM authenticates the
|
|
10339
|
-
* ciphertext) or an internal bug. Both cases are surfaced opaquely as
|
|
10340
|
-
* `MFA_SETUP_REQUIRED` so callers do not learn structural details of the
|
|
10341
|
-
* encrypted payload.
|
|
10342
|
-
*/
|
|
10343
|
-
parsePlainRecoveryCodes(raw, userId) {
|
|
10344
|
-
let parsed;
|
|
10345
|
-
try {
|
|
10346
|
-
parsed = JSON.parse(raw);
|
|
10347
|
-
} catch {
|
|
10348
|
-
this.logger.warn(`parsePlainRecoveryCodes: decrypted payload is not valid JSON userId=${logSafe(userId)}`);
|
|
10349
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10350
|
-
}
|
|
10351
|
-
if (!Array.isArray(parsed) || parsed.some((code) => typeof code !== "string")) {
|
|
10352
|
-
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10353
|
-
}
|
|
10354
|
-
return parsed;
|
|
10355
|
-
}
|
|
10356
|
-
/**
|
|
10357
|
-
* Generates `count` recovery codes in `XXXX-XXXX-XXXX-XXXX-XXXX-XXXX` format
|
|
10358
|
-
* (96 bits of entropy per code, hex-encoded).
|
|
10359
|
-
*
|
|
10360
|
-
* Returns both the plain-text (shown once to the user) and scrypt-hashed
|
|
10361
|
-
* versions (stored in the database).
|
|
10362
|
-
*
|
|
10363
|
-
* @remarks
|
|
10364
|
-
* Each code carries 96 bits of entropy (12 random bytes → 24 hex chars grouped
|
|
10365
|
-
* as 6 × 4). This is well above the NIST SP 800-63B recommendation for
|
|
10366
|
-
* offline-resistant credentials. The previous 12-digit decimal format offered
|
|
10367
|
-
* ~40 bits, which relied entirely on the scrypt hash for offline resistance —
|
|
10368
|
-
* any database leak would have put the raw codes within offline reach.
|
|
10369
|
-
*/
|
|
10370
|
-
hashRecoveryCodes(count) {
|
|
10371
|
-
const plainCodes = [];
|
|
10372
|
-
const hashedCodes = [];
|
|
10373
|
-
for (let i = 0; i < count; i++) {
|
|
10374
|
-
const hex = randomBytes(12).toString("hex");
|
|
10375
|
-
const groups = [];
|
|
10376
|
-
for (let offset = 0; offset < hex.length; offset += 4) {
|
|
10377
|
-
groups.push(hex.slice(offset, offset + 4));
|
|
10378
|
-
}
|
|
10379
|
-
const code = groups.join("-").toUpperCase();
|
|
10380
|
-
plainCodes.push(code);
|
|
10381
|
-
hashedCodes.push(this.digestRecoveryCode(code));
|
|
10382
|
-
}
|
|
10383
|
-
return {
|
|
10384
|
-
plainCodes,
|
|
10385
|
-
hashedCodes
|
|
10386
|
-
};
|
|
10387
|
-
}
|
|
10388
|
-
/**
|
|
10389
|
-
* Derives the stored digest for a recovery code: a keyed HMAC-SHA-256, hex encoded.
|
|
10390
|
-
*
|
|
10391
|
-
* A recovery code is 96 bits of CSPRNG output, not a human-chosen password, so a
|
|
10392
|
-
* memory-hard KDF buys nothing against it — there is no dictionary to walk and brute
|
|
10393
|
-
* forcing 2^96 is out of reach whatever the hash costs. What the KDF did buy was an
|
|
10394
|
-
* attacker-reachable CPU amplifier: a challenge submitting a wrong recovery code scanned
|
|
10395
|
-
* every stored digest, so one request cost as many scrypt derivations as the user had
|
|
10396
|
-
* codes. The keyed MAC is the right primitive here — the secret key is what stops an
|
|
10397
|
-
* offline attacker precomputing digests from a leaked table, and it costs microseconds.
|
|
10398
|
-
*/
|
|
10399
|
-
digestRecoveryCode(code) {
|
|
10400
|
-
return hmacSha256(code, this.options.hmacKey);
|
|
10401
|
-
}
|
|
10402
|
-
/**
|
|
10403
|
-
* Compares a submitted recovery code against every stored digest.
|
|
10404
|
-
*
|
|
10405
|
-
* One storage format only: a keyed MAC over the code. Every digest is compared in constant
|
|
10406
|
-
* time and the scan always runs to completion — including the step that picks the winner out
|
|
10407
|
-
* of the recorded results — so neither the position of a match nor the number of codes still
|
|
10408
|
-
* unused is observable in the response time.
|
|
10409
|
-
*
|
|
10410
|
-
* @returns Index of the first matching digest, or `-1` if none match.
|
|
10411
|
-
*/
|
|
10412
|
-
async verifyRecoveryCode(code, hashedCodes) {
|
|
10413
|
-
const candidates = [
|
|
10414
|
-
this.digestRecoveryCode(code),
|
|
10415
|
-
...this.options.previousHmacKeys.map((key) => hmacSha256(code, key))
|
|
10416
|
-
];
|
|
10417
|
-
const macMatches = [];
|
|
10418
|
-
for (const hashedCode of hashedCodes) {
|
|
10419
|
-
const hit = candidates.reduce((found, candidate) => timingSafeCompare(candidate, hashedCode) || found, false);
|
|
10420
|
-
macMatches.push(hit);
|
|
10421
|
-
}
|
|
10422
|
-
return macMatches.reduce((found, hit, index) => found === -1 && hit ? index : found, -1);
|
|
10423
|
-
}
|
|
10424
|
-
/**
|
|
10425
10358
|
* Claims a matched recovery code for exactly one challenge.
|
|
10426
10359
|
*
|
|
10427
10360
|
* Consuming a code is a read-modify-write against the consumer's repository: the challenge
|
|
@@ -10452,60 +10385,388 @@ var MfaService = class _MfaService {
|
|
|
10452
10385
|
return await this.redis.setnx(claimKey, RECOVERY_CODE_CLAIM_TTL_SECONDS);
|
|
10453
10386
|
}
|
|
10454
10387
|
/**
|
|
10455
|
-
*
|
|
10456
|
-
*
|
|
10388
|
+
* Verifies a TOTP code and enforces anti-replay within the validation window.
|
|
10389
|
+
*
|
|
10390
|
+
* Stores a Redis key `tu:{hmac}` where `hmac = hmacSha256("{userSubject}:{code}", hmacKey)` —
|
|
10391
|
+
* so the marker is scoped to the plane and, on the dashboard plane, to the tenant. A second
|
|
10392
|
+
* submission of the same code within the TTL is rejected as a replay. Binding the marker to
|
|
10393
|
+
* both the subject and the code value prevents code disclosure in Redis and cross-user,
|
|
10394
|
+
* cross-tenant and cross-plane replay alike.
|
|
10395
|
+
*
|
|
10396
|
+
* A second marker under the plane-only preimage `{context}:{userId}:{code}` is written and
|
|
10397
|
+
* required alongside it; see the call site for why both must be fresh while pods of two
|
|
10398
|
+
* versions are live.
|
|
10399
|
+
*
|
|
10400
|
+
* @returns `true` if the code is valid and has not been replayed, `false` otherwise.
|
|
10457
10401
|
*/
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10402
|
+
async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
|
|
10403
|
+
if (!verifyTotp(secretBase32, code, window)) return false;
|
|
10404
|
+
const ttl = totpAntiReplayTtlSeconds(window);
|
|
10405
|
+
const scopedReplayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
|
|
10406
|
+
const legacyReplayKey = `tu:${hmacSha256(`${context}:${userId}:${code}`, this.options.hmacKey)}`;
|
|
10407
|
+
const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
|
|
10408
|
+
if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
|
|
10409
|
+
const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
|
|
10410
|
+
return scopedIsNew && legacyIsNew;
|
|
10461
10411
|
}
|
|
10462
10412
|
/**
|
|
10463
|
-
*
|
|
10464
|
-
*
|
|
10413
|
+
* Fetches a user from the correct repository based on the MFA context, and refuses one whose
|
|
10414
|
+
* account is blocked.
|
|
10415
|
+
*
|
|
10416
|
+
* The status gate lives here rather than in each caller because every entry point that
|
|
10417
|
+
* reaches this method changes or spends an authentication factor, and every one of them
|
|
10418
|
+
* must refuse a suspended or banned account. A gate in `challenge` alone would leave `setup`,
|
|
10419
|
+
* `verifyAndEnable`, `disable` and `regenerateRecoveryCodes` open: an operator who suspended a
|
|
10420
|
+
* compromised account would buy nothing against an attacker still holding an unexpired access
|
|
10421
|
+
* token, who could turn the second factor off — or enrol their own authenticator over it — for
|
|
10422
|
+
* the token's remaining lifetime. Nothing else covers that window: no status change bumps the
|
|
10423
|
+
* token epoch, so the per-request check is the only defence, and neither MFA controller
|
|
10424
|
+
* composes `UserStatusGuard` (the platform plane has no status guard at all). Every other
|
|
10425
|
+
* authority-bearing route in the library does gate on status; changing an authentication
|
|
10426
|
+
* factor is at least as privileged as minting an invitation.
|
|
10427
|
+
*
|
|
10428
|
+
* Gating the fetch rather than the callers is deliberate: a method added later inherits the
|
|
10429
|
+
* check instead of having to remember it.
|
|
10430
|
+
*
|
|
10431
|
+
* @param context - Which identity plane the caller is acting on.
|
|
10432
|
+
* @param userId - The subject taken from the verified token.
|
|
10433
|
+
* @param tenantId - The tenant the caller was authenticated in, on the dashboard plane;
|
|
10434
|
+
* absent on the platform plane, whose admins belong to none.
|
|
10435
|
+
* @returns The account record, guaranteed to be in good standing.
|
|
10436
|
+
* @throws `TOKEN_INVALID` if the user is not found.
|
|
10437
|
+
* @throws {@link AuthException} the status error when the account is blocked.
|
|
10465
10438
|
*/
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10439
|
+
async loadAccount(context, userId, tenantId) {
|
|
10440
|
+
if (context === "dashboard") {
|
|
10441
|
+
assertDashboardTenant(tenantId);
|
|
10442
|
+
const user = await this.userRepo.findById({
|
|
10443
|
+
id: userId,
|
|
10444
|
+
tenantId
|
|
10445
|
+
});
|
|
10446
|
+
if (!user) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10447
|
+
assertNotBlocked(user.status, this.options.blockedStatuses);
|
|
10448
|
+
return user;
|
|
10449
|
+
}
|
|
10450
|
+
if (!this.platformUserRepo) {
|
|
10451
|
+
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10452
|
+
}
|
|
10453
|
+
const admin = await this.platformUserRepo.findById(userId);
|
|
10454
|
+
if (!admin) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10455
|
+
assertNotBlocked(admin.status, this.options.blockedStatuses);
|
|
10456
|
+
return admin;
|
|
10457
|
+
}
|
|
10458
|
+
};
|
|
10459
|
+
MfaRecordService = _ts_decorate38([
|
|
10460
|
+
Injectable(),
|
|
10461
|
+
_ts_param22(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
10462
|
+
_ts_param22(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
10463
|
+
_ts_param22(2, Optional()),
|
|
10464
|
+
_ts_param22(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
10465
|
+
_ts_param22(3, Inject(AuthRedisService)),
|
|
10466
|
+
_ts_metadata37("design:type", Function),
|
|
10467
|
+
_ts_metadata37("design:paramtypes", [
|
|
10468
|
+
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
10469
|
+
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
10470
|
+
Object,
|
|
10471
|
+
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
10472
|
+
])
|
|
10473
|
+
], MfaRecordService);
|
|
10474
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
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;
|
|
10469
10514
|
}
|
|
10470
10515
|
/**
|
|
10471
|
-
*
|
|
10472
|
-
* that it can be passed to hooks typed for `SafeAuthUser`.
|
|
10516
|
+
* Requires the caller to re-prove the account password before a factor is changed.
|
|
10473
10517
|
*
|
|
10474
|
-
*
|
|
10475
|
-
*
|
|
10476
|
-
*
|
|
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.
|
|
10477
10538
|
*/
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
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);
|
|
10575
|
+
function digestRecoveryCode(code, hmacKey) {
|
|
10576
|
+
return hmacSha256(code, hmacKey);
|
|
10577
|
+
}
|
|
10578
|
+
__name(digestRecoveryCode, "digestRecoveryCode");
|
|
10579
|
+
function generateRecoveryCodes(count, hmacKey) {
|
|
10580
|
+
const plainCodes = [];
|
|
10581
|
+
const hashedCodes = [];
|
|
10582
|
+
for (let i = 0; i < count; i++) {
|
|
10583
|
+
const hex = randomBytes(12).toString("hex");
|
|
10584
|
+
const groups = [];
|
|
10585
|
+
for (let offset = 0; offset < hex.length; offset += 4) {
|
|
10586
|
+
groups.push(hex.slice(offset, offset + 4));
|
|
10587
|
+
}
|
|
10588
|
+
const code = groups.join("-").toUpperCase();
|
|
10589
|
+
plainCodes.push(code);
|
|
10590
|
+
hashedCodes.push(digestRecoveryCode(code, hmacKey));
|
|
10591
|
+
}
|
|
10592
|
+
return {
|
|
10593
|
+
plainCodes,
|
|
10594
|
+
hashedCodes
|
|
10595
|
+
};
|
|
10596
|
+
}
|
|
10597
|
+
__name(generateRecoveryCodes, "generateRecoveryCodes");
|
|
10598
|
+
async function verifyRecoveryCode(code, hashedCodes, hmacKey, previousHmacKeys) {
|
|
10599
|
+
const candidates = [
|
|
10600
|
+
digestRecoveryCode(code, hmacKey),
|
|
10601
|
+
...previousHmacKeys.map((key) => hmacSha256(code, key))
|
|
10602
|
+
];
|
|
10603
|
+
const macMatches = [];
|
|
10604
|
+
for (const hashedCode of hashedCodes) {
|
|
10605
|
+
const hit = candidates.reduce((found, candidate) => timingSafeCompare(candidate, hashedCode) || found, false);
|
|
10606
|
+
macMatches.push(hit);
|
|
10607
|
+
}
|
|
10608
|
+
return macMatches.reduce((found, hit, index) => found === -1 && hit ? index : found, -1);
|
|
10609
|
+
}
|
|
10610
|
+
__name(verifyRecoveryCode, "verifyRecoveryCode");
|
|
10611
|
+
|
|
10612
|
+
// src/server/utils/mfa-safe-user.ts
|
|
10613
|
+
function toSafeUser3(user) {
|
|
10614
|
+
const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = user;
|
|
10615
|
+
return safe;
|
|
10616
|
+
}
|
|
10617
|
+
__name(toSafeUser3, "toSafeUser");
|
|
10618
|
+
function toSafePlatformUser(admin) {
|
|
10619
|
+
const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = admin;
|
|
10620
|
+
return safe;
|
|
10621
|
+
}
|
|
10622
|
+
__name(toSafePlatformUser, "toSafePlatformUser");
|
|
10623
|
+
function platformUserAsSafeUser(admin) {
|
|
10624
|
+
const safe = toSafePlatformUser(admin);
|
|
10625
|
+
return {
|
|
10626
|
+
...safe,
|
|
10627
|
+
tenantId: "",
|
|
10628
|
+
emailVerified: true
|
|
10629
|
+
};
|
|
10630
|
+
}
|
|
10631
|
+
__name(platformUserAsSafeUser, "platformUserAsSafeUser");
|
|
10632
|
+
function committedSafeUser(context, user, mfaEnabled) {
|
|
10633
|
+
const committed = {
|
|
10634
|
+
...user,
|
|
10635
|
+
mfaEnabled
|
|
10636
|
+
};
|
|
10637
|
+
return context === "platform" ? platformUserAsSafeUser(committed) : toSafeUser3(committed);
|
|
10638
|
+
}
|
|
10639
|
+
__name(committedSafeUser, "committedSafeUser");
|
|
10640
|
+
|
|
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);
|
|
10485
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
|
+
// src/server/utils/run-detached.ts
|
|
10679
|
+
function runDetached(logger, run, failure) {
|
|
10680
|
+
try {
|
|
10681
|
+
void Promise.resolve(run()).catch((err) => {
|
|
10682
|
+
logger.error(`${failure}: ${describeChannelStatus(err)}`);
|
|
10683
|
+
});
|
|
10684
|
+
} catch (err) {
|
|
10685
|
+
logger.error(`${failure}: ${describeChannelStatus(err)}`);
|
|
10686
|
+
}
|
|
10687
|
+
}
|
|
10688
|
+
__name(runDetached, "runDetached");
|
|
10689
|
+
|
|
10690
|
+
// src/server/services/mfa.service.ts
|
|
10691
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
10692
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10693
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
10694
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
10695
|
+
} else {
|
|
10696
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
10697
|
+
if (d = decorators[i]) {
|
|
10698
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10699
|
+
}
|
|
10700
|
+
}
|
|
10701
|
+
}
|
|
10702
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10703
|
+
}
|
|
10704
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
10705
|
+
function _ts_metadata39(metadataKey, metadataValue) {
|
|
10706
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
10707
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
10708
|
+
}
|
|
10709
|
+
}
|
|
10710
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
10711
|
+
function _ts_param24(paramIndex, decorator) {
|
|
10712
|
+
return function(target, key) {
|
|
10713
|
+
decorator(target, key, paramIndex);
|
|
10714
|
+
};
|
|
10715
|
+
}
|
|
10716
|
+
__name(_ts_param24, "_ts_param");
|
|
10717
|
+
var PLATFORM_EMAIL_TENANT = "platform";
|
|
10718
|
+
function emailTenantOf(user) {
|
|
10719
|
+
return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
|
|
10720
|
+
}
|
|
10721
|
+
__name(emailTenantOf, "emailTenantOf");
|
|
10722
|
+
var MFA_SETUP_TTL_SECONDS = 600;
|
|
10723
|
+
var DEFAULT_RECOVERY_CODE_COUNT = 8;
|
|
10724
|
+
var MfaService = class _MfaService {
|
|
10725
|
+
static {
|
|
10726
|
+
__name(this, "MfaService");
|
|
10727
|
+
}
|
|
10728
|
+
options;
|
|
10729
|
+
userRepo;
|
|
10730
|
+
platformUserRepo;
|
|
10731
|
+
redis;
|
|
10732
|
+
tokenManager;
|
|
10733
|
+
records;
|
|
10734
|
+
flowLockout;
|
|
10735
|
+
reauthentication;
|
|
10736
|
+
sessionService;
|
|
10737
|
+
emailProvider;
|
|
10738
|
+
hooks;
|
|
10739
|
+
logger = new Logger(_MfaService.name);
|
|
10740
|
+
constructor(options, userRepo, platformUserRepo, redis, tokenManager, records, flowLockout, reauthentication, sessionService, emailProvider, hooks) {
|
|
10741
|
+
this.options = options;
|
|
10742
|
+
this.userRepo = userRepo;
|
|
10743
|
+
this.platformUserRepo = platformUserRepo;
|
|
10744
|
+
this.redis = redis;
|
|
10745
|
+
this.tokenManager = tokenManager;
|
|
10746
|
+
this.records = records;
|
|
10747
|
+
this.flowLockout = flowLockout;
|
|
10748
|
+
this.reauthentication = reauthentication;
|
|
10749
|
+
this.sessionService = sessionService;
|
|
10750
|
+
this.emailProvider = emailProvider;
|
|
10751
|
+
this.hooks = hooks;
|
|
10752
|
+
}
|
|
10753
|
+
// ---------------------------------------------------------------------------
|
|
10754
|
+
// Private accessor — options.mfa is guaranteed non-null when service is active
|
|
10755
|
+
// ---------------------------------------------------------------------------
|
|
10486
10756
|
/**
|
|
10487
|
-
*
|
|
10488
|
-
* wrote.
|
|
10489
|
-
*
|
|
10490
|
-
* The record in hand was read before the transition, so its `mfaEnabled` still describes the
|
|
10491
|
-
* state the transition replaced; the hooks run after the write and must be told what it
|
|
10492
|
-
* produced. Only the flag is overridden. The secret and recovery-code fields are stripped by
|
|
10493
|
-
* the same projections every other hook payload uses, and the repository's own record is not
|
|
10494
|
-
* modified.
|
|
10757
|
+
* Returns the resolved MFA configuration. `options.mfa` is always present when `MfaService` is registered.
|
|
10495
10758
|
*
|
|
10496
|
-
*
|
|
10497
|
-
*
|
|
10498
|
-
*
|
|
10499
|
-
* @returns The projection for the plane, with `mfaEnabled` as written.
|
|
10759
|
+
* `options.mfa` is always present when `MfaService` is registered — the module
|
|
10760
|
+
* only registers the service when `mfa` is configured. The single suppression
|
|
10761
|
+
* here eliminates repetitive `!` assertions throughout the class.
|
|
10500
10762
|
*/
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
...user,
|
|
10504
|
-
mfaEnabled
|
|
10505
|
-
};
|
|
10506
|
-
return context === "platform" ? this.platformUserAsSafeUser(committed) : this.toSafeUser(committed);
|
|
10763
|
+
get mfaOptions() {
|
|
10764
|
+
return this.options.mfa;
|
|
10507
10765
|
}
|
|
10508
10766
|
// ---------------------------------------------------------------------------
|
|
10767
|
+
// Private crypto helpers
|
|
10768
|
+
// ---------------------------------------------------------------------------
|
|
10769
|
+
// ---------------------------------------------------------------------------
|
|
10509
10770
|
// setup — TOTP secret generation, idempotent key reservation, recovery codes
|
|
10510
10771
|
// ---------------------------------------------------------------------------
|
|
10511
10772
|
/**
|
|
@@ -10529,20 +10790,20 @@ var MfaService = class _MfaService {
|
|
|
10529
10790
|
* meaning is the same: "platform MFA cannot operate".
|
|
10530
10791
|
*/
|
|
10531
10792
|
async setup(userId, context = "dashboard", password, tenantId) {
|
|
10532
|
-
|
|
10793
|
+
assertPlaneTenant(context, tenantId);
|
|
10533
10794
|
if (context === "platform" && !this.platformUserRepo) {
|
|
10534
10795
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10535
10796
|
}
|
|
10536
|
-
const user = await this.
|
|
10797
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10537
10798
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
10538
|
-
await this.assertReauthenticated(context, userId, user.passwordHash, password, tenantId);
|
|
10799
|
+
await this.reauthentication.assertReauthenticated(context, userId, user.passwordHash, password, tenantId);
|
|
10539
10800
|
const setupKey = `mfa_setup:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
10540
10801
|
const existingFast = await this.redis.get(setupKey);
|
|
10541
10802
|
if (existingFast !== null) {
|
|
10542
|
-
const data =
|
|
10543
|
-
const existingSecret =
|
|
10544
|
-
const decryptedCodesJson =
|
|
10545
|
-
const existingCodes =
|
|
10803
|
+
const data = parseSetupData(existingFast, userId, this.logger);
|
|
10804
|
+
const existingSecret = decryptMfaSecret(data.encryptedSecret, this.mfaOptions);
|
|
10805
|
+
const decryptedCodesJson = decryptMfaSecret(data.encryptedPlainCodes, this.mfaOptions);
|
|
10806
|
+
const existingCodes = parsePlainRecoveryCodes(decryptedCodesJson, userId, this.logger);
|
|
10546
10807
|
const qrCodeUri2 = buildTotpUri(existingSecret, user.email, this.mfaOptions.issuer);
|
|
10547
10808
|
return {
|
|
10548
10809
|
secret: existingSecret,
|
|
@@ -10551,9 +10812,9 @@ var MfaService = class _MfaService {
|
|
|
10551
10812
|
};
|
|
10552
10813
|
}
|
|
10553
10814
|
const { base32: secretBase32 } = generateTotpSecret();
|
|
10554
|
-
const encryptedSecret = this.
|
|
10815
|
+
const encryptedSecret = encryptMfaSecret(secretBase32, this.mfaOptions);
|
|
10555
10816
|
const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
10556
|
-
const { plainCodes, hashedCodes } = this.
|
|
10817
|
+
const { plainCodes, hashedCodes } = generateRecoveryCodes(recoveryCount, this.options.hmacKey);
|
|
10557
10818
|
const encryptedPlainCodes = encrypt(JSON.stringify(plainCodes), this.mfaOptions.encryptionKey);
|
|
10558
10819
|
const setupData = {
|
|
10559
10820
|
encryptedSecret,
|
|
@@ -10565,10 +10826,10 @@ var MfaService = class _MfaService {
|
|
|
10565
10826
|
if (!wasSet) {
|
|
10566
10827
|
const existing = await this.redis.get(setupKey);
|
|
10567
10828
|
if (existing !== null) {
|
|
10568
|
-
const data =
|
|
10569
|
-
const existingSecret =
|
|
10570
|
-
const decryptedCodesJson =
|
|
10571
|
-
const existingCodes =
|
|
10829
|
+
const data = parseSetupData(existing, userId, this.logger);
|
|
10830
|
+
const existingSecret = decryptMfaSecret(data.encryptedSecret, this.mfaOptions);
|
|
10831
|
+
const decryptedCodesJson = decryptMfaSecret(data.encryptedPlainCodes, this.mfaOptions);
|
|
10832
|
+
const existingCodes = parsePlainRecoveryCodes(decryptedCodesJson, userId, this.logger);
|
|
10572
10833
|
const qrCodeUri2 = buildTotpUri(existingSecret, user.email, this.mfaOptions.issuer);
|
|
10573
10834
|
return {
|
|
10574
10835
|
secret: existingSecret,
|
|
@@ -10610,19 +10871,19 @@ var MfaService = class _MfaService {
|
|
|
10610
10871
|
* repository was not configured at module registration.
|
|
10611
10872
|
*/
|
|
10612
10873
|
async verifyAndEnable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
|
|
10613
|
-
|
|
10874
|
+
assertPlaneTenant(context, tenantId);
|
|
10614
10875
|
if (context === "platform" && !this.platformUserRepo) {
|
|
10615
10876
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10616
10877
|
}
|
|
10617
|
-
const user = await this.
|
|
10878
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10618
10879
|
if (user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_ALREADY_ENABLED);
|
|
10619
10880
|
const setupKey = `mfa_setup:${hmacSha256(userSubject(context, userId, tenantId), this.options.hmacKey)}`;
|
|
10620
10881
|
const raw = await this.redis.get(setupKey);
|
|
10621
10882
|
if (raw === null) throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10622
|
-
const data =
|
|
10623
|
-
const secretBase32 =
|
|
10883
|
+
const data = parseSetupData(raw, userId, this.logger);
|
|
10884
|
+
const secretBase32 = decryptMfaSecret(data.encryptedSecret, this.mfaOptions);
|
|
10624
10885
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
10625
|
-
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
10886
|
+
const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
10626
10887
|
if (!codeValid) {
|
|
10627
10888
|
this.logger.warn(`verifyAndEnable: invalid TOTP code userId=${logSafe(userId)}`);
|
|
10628
10889
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
@@ -10632,7 +10893,7 @@ var MfaService = class _MfaService {
|
|
|
10632
10893
|
this.logger.warn(`verifyAndEnable: setup key consumed by concurrent request userId=${logSafe(userId)}`);
|
|
10633
10894
|
throw new AuthException(AUTH_ERROR_CODES.MFA_SETUP_REQUIRED);
|
|
10634
10895
|
}
|
|
10635
|
-
await this.
|
|
10896
|
+
await this.records.transition(context, userId, tenantId, () => ({
|
|
10636
10897
|
mfaEnabled: true,
|
|
10637
10898
|
mfaSecret: data.encryptedSecret,
|
|
10638
10899
|
mfaRecoveryCodes: data.hashedCodes
|
|
@@ -10642,7 +10903,7 @@ var MfaService = class _MfaService {
|
|
|
10642
10903
|
this.logger.log(`verifyAndEnable: MFA enabled userId=${logSafe(userId)} context=${context}`);
|
|
10643
10904
|
this.notify("verifyAndEnable", userId, user, (provider, tenant, email) => provider.sendMfaEnabledNotification(tenant, email));
|
|
10644
10905
|
if (this.hooks.afterMfaEnabled) {
|
|
10645
|
-
const safeUser =
|
|
10906
|
+
const safeUser = committedSafeUser(context, user, true);
|
|
10646
10907
|
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
10647
10908
|
// The plane, because the tenant cannot carry it: a platform admin is rendered with the
|
|
10648
10909
|
// sentinel `tenantId: ''` while a platform token has no tenant claim at all.
|
|
@@ -10676,32 +10937,32 @@ var MfaService = class _MfaService {
|
|
|
10676
10937
|
*/
|
|
10677
10938
|
async challenge(mfaTempToken, code, ip, userAgent) {
|
|
10678
10939
|
const { userId, context, tenantId, jti: tempTokenJti } = await this.tokenManager.verifyMfaTempToken(mfaTempToken);
|
|
10679
|
-
if (await this.
|
|
10940
|
+
if (await this.flowLockout.isLockedOut("challenge", context, userId, tenantId)) {
|
|
10680
10941
|
this.logger.warn(`challenge: account locked userId=${logSafe(userId)}`);
|
|
10681
10942
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
10682
10943
|
}
|
|
10683
|
-
const user = await this.
|
|
10944
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10684
10945
|
if (!user.mfaEnabled || !user.mfaSecret) {
|
|
10685
10946
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10686
10947
|
}
|
|
10687
|
-
const { secret: secretBase32, stale: encryptedUnderRetiredKey } =
|
|
10948
|
+
const { secret: secretBase32, stale: encryptedUnderRetiredKey } = decryptWithRotation(user.mfaSecret, this.mfaOptions);
|
|
10688
10949
|
const isTotpCode = /^\d{6}$/.test(code);
|
|
10689
10950
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
10690
10951
|
let codeValid = false;
|
|
10691
10952
|
let usedRecoveryIndex = -1;
|
|
10692
10953
|
if (isTotpCode) {
|
|
10693
|
-
codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
10954
|
+
codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
10694
10955
|
} else {
|
|
10695
10956
|
const recoveryCodes = user.mfaRecoveryCodes ?? [];
|
|
10696
|
-
usedRecoveryIndex = await
|
|
10697
|
-
codeValid = usedRecoveryIndex >= 0 && await this.claimRecoveryCode(context, userId, code, tenantId);
|
|
10957
|
+
usedRecoveryIndex = await verifyRecoveryCode(code, recoveryCodes, this.options.hmacKey, this.options.previousHmacKeys);
|
|
10958
|
+
codeValid = usedRecoveryIndex >= 0 && await this.records.claimRecoveryCode(context, userId, code, tenantId);
|
|
10698
10959
|
}
|
|
10699
10960
|
if (!codeValid) {
|
|
10700
|
-
await this.
|
|
10961
|
+
await this.flowLockout.recordFailure("challenge", context, userId, tenantId);
|
|
10701
10962
|
this.logger.warn(`challenge: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
10702
10963
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
10703
10964
|
}
|
|
10704
|
-
await this.
|
|
10965
|
+
await this.flowLockout.reset("challenge", context, userId, tenantId);
|
|
10705
10966
|
if (!await this.tokenManager.consumeMfaTempToken(tempTokenJti)) {
|
|
10706
10967
|
throw new AuthException(AUTH_ERROR_CODES.MFA_TEMP_TOKEN_INVALID);
|
|
10707
10968
|
}
|
|
@@ -10710,9 +10971,9 @@ var MfaService = class _MfaService {
|
|
|
10710
10971
|
// Stryker disable next-line ArrayDeclaration: unreachable — this branch is only taken
|
|
10711
10972
|
// when `verifyRecoveryCode` matched a code inside an array it had to iterate first.
|
|
10712
10973
|
[];
|
|
10713
|
-
await this.
|
|
10974
|
+
await this.records.transition(context, userId, tenantId, (current) => {
|
|
10714
10975
|
if (!current.mfaEnabled) return null;
|
|
10715
|
-
if (!
|
|
10976
|
+
if (!holdsSecret(current.mfaSecret, secretBase32, this.mfaOptions)) return null;
|
|
10716
10977
|
const currentCodes = current.mfaRecoveryCodes ?? [];
|
|
10717
10978
|
const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
|
|
10718
10979
|
const liveIndex = currentCodes.indexOf(spentDigest);
|
|
@@ -10725,16 +10986,16 @@ var MfaService = class _MfaService {
|
|
|
10725
10986
|
mfaEnabled: true,
|
|
10726
10987
|
// Re-encrypted here when the secret opened under a retired key: the write is
|
|
10727
10988
|
// already happening, so the rotation drains for free.
|
|
10728
|
-
mfaSecret: encryptedUnderRetiredKey ? this.
|
|
10989
|
+
mfaSecret: encryptedUnderRetiredKey ? encryptMfaSecret(secretBase32, this.mfaOptions) : current.mfaSecret,
|
|
10729
10990
|
mfaRecoveryCodes: updatedCodes
|
|
10730
10991
|
};
|
|
10731
10992
|
});
|
|
10732
10993
|
} else if (encryptedUnderRetiredKey) {
|
|
10733
|
-
void this.reencryptSecret(userId, context, secretBase32, tenantId);
|
|
10994
|
+
void this.records.reencryptSecret(userId, context, secretBase32, tenantId, this.mfaOptions);
|
|
10734
10995
|
}
|
|
10735
10996
|
this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
|
|
10736
10997
|
if (context === "dashboard") {
|
|
10737
|
-
const safeUser =
|
|
10998
|
+
const safeUser = toSafeUser3(user);
|
|
10738
10999
|
const result2 = await this.tokenManager.issueTokens(safeUser, ip, userAgent, {
|
|
10739
11000
|
mfaVerified: true
|
|
10740
11001
|
});
|
|
@@ -10764,13 +11025,13 @@ var MfaService = class _MfaService {
|
|
|
10764
11025
|
return result2;
|
|
10765
11026
|
}
|
|
10766
11027
|
const platformUser = user;
|
|
10767
|
-
const result = await this.tokenManager.issuePlatformTokens(
|
|
11028
|
+
const result = await this.tokenManager.issuePlatformTokens(toSafePlatformUser(platformUser), ip, userAgent, {
|
|
10768
11029
|
mfaVerified: true
|
|
10769
11030
|
});
|
|
10770
11031
|
runDetached(this.logger, () => this.platformUserRepo.updateLastLogin(platformUser.id), "challenge: platform updateLastLogin failed");
|
|
10771
11032
|
if (this.hooks.afterLogin) {
|
|
10772
11033
|
const afterLogin = this.hooks.afterLogin.bind(this.hooks);
|
|
10773
|
-
runDetached(this.logger, () => afterLogin(
|
|
11034
|
+
runDetached(this.logger, () => afterLogin(platformUserAsSafeUser(platformUser), {
|
|
10774
11035
|
plane: "platform",
|
|
10775
11036
|
userId,
|
|
10776
11037
|
ip,
|
|
@@ -10839,26 +11100,26 @@ var MfaService = class _MfaService {
|
|
|
10839
11100
|
* @throws `MFA_INVALID_CODE` if the submitted TOTP code is incorrect.
|
|
10840
11101
|
*/
|
|
10841
11102
|
async disable(userId, code, ip, userAgent, context = "dashboard", tenantId) {
|
|
10842
|
-
|
|
10843
|
-
const user = await this.
|
|
11103
|
+
assertPlaneTenant(context, tenantId);
|
|
11104
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10844
11105
|
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10845
|
-
if (await this.
|
|
11106
|
+
if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
|
|
10846
11107
|
this.logger.warn(`disable: account locked userId=${logSafe(userId)} context=${context}`);
|
|
10847
11108
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
10848
11109
|
}
|
|
10849
11110
|
if (!user.mfaSecret) {
|
|
10850
11111
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10851
11112
|
}
|
|
10852
|
-
const secretBase32 =
|
|
11113
|
+
const secretBase32 = decryptMfaSecret(user.mfaSecret, this.mfaOptions);
|
|
10853
11114
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
10854
|
-
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
11115
|
+
const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, code, totpWindow, tenantId);
|
|
10855
11116
|
if (!codeValid) {
|
|
10856
|
-
await this.
|
|
11117
|
+
await this.flowLockout.recordFailure("disable", context, userId, tenantId);
|
|
10857
11118
|
this.logger.warn(`disable: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
10858
11119
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
10859
11120
|
}
|
|
10860
|
-
await this.
|
|
10861
|
-
await this.
|
|
11121
|
+
await this.flowLockout.reset("disable", context, userId, tenantId);
|
|
11122
|
+
await this.records.transition(context, userId, tenantId, () => ({
|
|
10862
11123
|
mfaEnabled: false,
|
|
10863
11124
|
mfaSecret: null,
|
|
10864
11125
|
mfaRecoveryCodes: null
|
|
@@ -10867,7 +11128,7 @@ var MfaService = class _MfaService {
|
|
|
10867
11128
|
await this.redis.bumpUserTokenEpoch(userId, tenantId, context);
|
|
10868
11129
|
this.logger.log(`disable: MFA disabled userId=${logSafe(userId)} context=${context}`);
|
|
10869
11130
|
this.notify("disable", userId, user, (provider, tenant, email) => provider.sendMfaDisabledNotification(tenant, email));
|
|
10870
|
-
const safeUser =
|
|
11131
|
+
const safeUser = committedSafeUser(context, user, false);
|
|
10871
11132
|
if (this.hooks.afterMfaDisabled) {
|
|
10872
11133
|
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
10873
11134
|
plane: context,
|
|
@@ -10920,13 +11181,13 @@ var MfaService = class _MfaService {
|
|
|
10920
11181
|
* @throws `TOKEN_INVALID` if no user with that ID exists in the given plane.
|
|
10921
11182
|
*/
|
|
10922
11183
|
async resetMfa(userId, context = "dashboard", tenantId) {
|
|
10923
|
-
|
|
10924
|
-
const user = await this.
|
|
11184
|
+
assertPlaneTenant(context, tenantId);
|
|
11185
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10925
11186
|
if (!user.mfaEnabled) {
|
|
10926
11187
|
this.logger.log(`resetMfa: no second factor to remove userId=${logSafe(userId)} context=${context}`);
|
|
10927
11188
|
return;
|
|
10928
11189
|
}
|
|
10929
|
-
await this.
|
|
11190
|
+
await this.records.transition(context, userId, tenantId, () => ({
|
|
10930
11191
|
mfaEnabled: false,
|
|
10931
11192
|
mfaSecret: null,
|
|
10932
11193
|
mfaRecoveryCodes: null
|
|
@@ -10935,7 +11196,7 @@ var MfaService = class _MfaService {
|
|
|
10935
11196
|
await this.redis.bumpUserTokenEpoch(userId, tenantId, context);
|
|
10936
11197
|
this.logger.warn(`resetMfa: MFA removed administratively userId=${logSafe(userId)} context=${context}`);
|
|
10937
11198
|
this.notify("resetMfa", userId, user, (provider, tenant, email) => provider.sendMfaDisabledNotification(tenant, email));
|
|
10938
|
-
const safeUser =
|
|
11199
|
+
const safeUser = committedSafeUser(context, user, false);
|
|
10939
11200
|
if (this.hooks.afterMfaDisabled) {
|
|
10940
11201
|
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
10941
11202
|
plane: context,
|
|
@@ -10989,31 +11250,31 @@ var MfaService = class _MfaService {
|
|
|
10989
11250
|
* @returns The freshly generated plain-text recovery codes, one-time display.
|
|
10990
11251
|
*/
|
|
10991
11252
|
async regenerateRecoveryCodes(userId, totpCode, ip, userAgent, context = "dashboard", tenantId) {
|
|
10992
|
-
|
|
11253
|
+
assertPlaneTenant(context, tenantId);
|
|
10993
11254
|
if (context === "platform" && !this.platformUserRepo) {
|
|
10994
11255
|
throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10995
11256
|
}
|
|
10996
|
-
const user = await this.
|
|
11257
|
+
const user = await this.records.loadAccount(context, userId, tenantId);
|
|
10997
11258
|
if (!user.mfaEnabled) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
10998
|
-
if (await this.
|
|
11259
|
+
if (await this.flowLockout.isLockedOut("disable", context, userId, tenantId)) {
|
|
10999
11260
|
this.logger.warn(`regenerateRecoveryCodes: account locked userId=${logSafe(userId)} context=${context}`);
|
|
11000
11261
|
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
11001
11262
|
}
|
|
11002
11263
|
if (!user.mfaSecret) {
|
|
11003
11264
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11004
11265
|
}
|
|
11005
|
-
const secretBase32 =
|
|
11266
|
+
const secretBase32 = decryptMfaSecret(user.mfaSecret, this.mfaOptions);
|
|
11006
11267
|
const totpWindow = this.mfaOptions.totpWindow;
|
|
11007
|
-
const codeValid = await this.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow, tenantId);
|
|
11268
|
+
const codeValid = await this.records.verifyTotpWithAntiReplay(context, userId, secretBase32, totpCode, totpWindow, tenantId);
|
|
11008
11269
|
if (!codeValid) {
|
|
11009
|
-
await this.
|
|
11270
|
+
await this.flowLockout.recordFailure("disable", context, userId, tenantId);
|
|
11010
11271
|
this.logger.warn(`regenerateRecoveryCodes: invalid MFA code userId=${logSafe(userId)} context=${context}`);
|
|
11011
11272
|
throw new AuthException(AUTH_ERROR_CODES.MFA_INVALID_CODE);
|
|
11012
11273
|
}
|
|
11013
|
-
await this.
|
|
11274
|
+
await this.flowLockout.reset("disable", context, userId, tenantId);
|
|
11014
11275
|
const recoveryCount = this.mfaOptions.recoveryCodeCount ?? DEFAULT_RECOVERY_CODE_COUNT;
|
|
11015
|
-
const { plainCodes, hashedCodes } = this.
|
|
11016
|
-
const replaced = await this.
|
|
11276
|
+
const { plainCodes, hashedCodes } = generateRecoveryCodes(recoveryCount, this.options.hmacKey);
|
|
11277
|
+
const replaced = await this.records.transition(context, userId, tenantId, (current) => {
|
|
11017
11278
|
if (!current.mfaEnabled) return null;
|
|
11018
11279
|
return {
|
|
11019
11280
|
mfaEnabled: true,
|
|
@@ -11024,7 +11285,7 @@ var MfaService = class _MfaService {
|
|
|
11024
11285
|
if (!replaced) throw new AuthException(AUTH_ERROR_CODES.MFA_NOT_ENABLED);
|
|
11025
11286
|
this.logger.log(`regenerateRecoveryCodes: recovery codes regenerated userId=${logSafe(userId)} context=${context}`);
|
|
11026
11287
|
if (this.hooks.afterMfaRecoveryCodesRegenerated) {
|
|
11027
|
-
const safeUser = context === "platform" ?
|
|
11288
|
+
const safeUser = context === "platform" ? platformUserAsSafeUser(user) : toSafeUser3(user);
|
|
11028
11289
|
void Promise.resolve(this.hooks.afterMfaRecoveryCodesRegenerated(safeUser, {
|
|
11029
11290
|
plane: context,
|
|
11030
11291
|
userId,
|
|
@@ -11041,175 +11302,6 @@ var MfaService = class _MfaService {
|
|
|
11041
11302
|
// Private helpers
|
|
11042
11303
|
// ---------------------------------------------------------------------------
|
|
11043
11304
|
/**
|
|
11044
|
-
* Verifies a TOTP code and enforces anti-replay within the validation window.
|
|
11045
|
-
*
|
|
11046
|
-
* Stores a Redis key `tu:{hmac}` where `hmac = hmacSha256("{userSubject}:{code}", hmacKey)` —
|
|
11047
|
-
* so the marker is scoped to the plane and, on the dashboard plane, to the tenant. A second
|
|
11048
|
-
* submission of the same code within the TTL is rejected as a replay. Binding the marker to
|
|
11049
|
-
* both the subject and the code value prevents code disclosure in Redis and cross-user,
|
|
11050
|
-
* cross-tenant and cross-plane replay alike.
|
|
11051
|
-
*
|
|
11052
|
-
* A second marker under the pre-scoping preimage `{context}:{userId}:{code}` is written and
|
|
11053
|
-
* required alongside it; see the call site for why both must be fresh during a rolling upgrade.
|
|
11054
|
-
*
|
|
11055
|
-
* @returns `true` if the code is valid and has not been replayed, `false` otherwise.
|
|
11056
|
-
*/
|
|
11057
|
-
async verifyTotpWithAntiReplay(context, userId, secretBase32, code, window, tenantId) {
|
|
11058
|
-
if (!verifyTotp(secretBase32, code, window)) return false;
|
|
11059
|
-
const ttl = totpAntiReplayTtlSeconds(window);
|
|
11060
|
-
const scopedReplayKey = `tu:${hmacSha256(`${userSubject(context, userId, tenantId)}:${code}`, this.options.hmacKey)}`;
|
|
11061
|
-
const legacyReplayKey = `tu:${hmacSha256(`${context}:${userId}:${code}`, this.options.hmacKey)}`;
|
|
11062
|
-
const scopedIsNew = await this.redis.setnx(scopedReplayKey, ttl);
|
|
11063
|
-
if (scopedReplayKey === legacyReplayKey) return scopedIsNew;
|
|
11064
|
-
const legacyIsNew = await this.redis.setnx(legacyReplayKey, ttl);
|
|
11065
|
-
return scopedIsNew && legacyIsNew;
|
|
11066
|
-
}
|
|
11067
|
-
/**
|
|
11068
|
-
* Requires the caller to re-prove the account password before a factor is changed.
|
|
11069
|
-
*
|
|
11070
|
-
* Counted like a login, and for the same reason. `login` refuses an account after N wrong
|
|
11071
|
-
* passwords; this door asks for the same secret and used to refuse nothing, so a caller
|
|
11072
|
-
* holding a stolen access token but not the password could guess it here indefinitely. The
|
|
11073
|
-
* only control left was the per-route IP limit, which a distributed caller sidesteps — and
|
|
11074
|
-
* winning the guess buys the whole account: enrol a factor, change the password, move the
|
|
11075
|
-
* address. A door that takes the password has to carry the password's lockout.
|
|
11076
|
-
*
|
|
11077
|
-
* The identifier is namespaced by flow and by plane. Sharing one counter with `login` would
|
|
11078
|
-
* let an authenticated caller lock the owner out of their own sign-in, and sharing it across
|
|
11079
|
-
* planes would let a dashboard user and a platform admin holding the same id exhaust each
|
|
11080
|
-
* other's budget — the same two reasons the challenge and disable counters are split.
|
|
11081
|
-
*
|
|
11082
|
-
* @param context - The authentication plane, part of the counter's key.
|
|
11083
|
-
* @param userId - The account being changed, part of the counter's key.
|
|
11084
|
-
* @param passwordHash - The account's stored hash, or `null` for an OAuth-only account.
|
|
11085
|
-
* @param password - The password the caller submitted, if any.
|
|
11086
|
-
* @throws {@link AuthException} `ACCOUNT_LOCKED` once the failure budget for this flow is
|
|
11087
|
-
* spent, or `INVALID_CREDENTIALS` when the account has a password and the submitted one is
|
|
11088
|
-
* absent or wrong. The latter is deliberately the same code a failed login returns: an
|
|
11089
|
-
* attacker holding a stolen token learns nothing from it beyond what they already knew.
|
|
11090
|
-
*/
|
|
11091
|
-
async assertReauthenticated(context, userId, passwordHash, password, tenantId) {
|
|
11092
|
-
if (passwordHash === null) {
|
|
11093
|
-
const recent = await this.redis.get(recentAuthKey(context, userId, this.options.hmacKey, tenantId));
|
|
11094
|
-
if (recent === null) {
|
|
11095
|
-
this.logger.warn(`reauthenticate: no recent authentication userId=${logSafe(userId)} context=${context}`);
|
|
11096
|
-
throw new AuthException(AUTH_ERROR_CODES.REAUTHENTICATION_REQUIRED);
|
|
11097
|
-
}
|
|
11098
|
-
return;
|
|
11099
|
-
}
|
|
11100
|
-
if (await this.isMfaFlowLockedOut("reauth", context, userId, tenantId)) {
|
|
11101
|
-
this.logger.warn(`reauthenticate: account locked userId=${logSafe(userId)} context=${context}`);
|
|
11102
|
-
throw new AuthException(AUTH_ERROR_CODES.ACCOUNT_LOCKED);
|
|
11103
|
-
}
|
|
11104
|
-
const supplied = password ?? "";
|
|
11105
|
-
const matches = await this.passwordService.compare(supplied, passwordHash);
|
|
11106
|
-
if (!matches) {
|
|
11107
|
-
await this.recordMfaFlowFailure("reauth", context, userId, tenantId);
|
|
11108
|
-
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
11109
|
-
}
|
|
11110
|
-
await this.resetMfaFlowFailures("reauth", context, userId, tenantId);
|
|
11111
|
-
}
|
|
11112
|
-
/**
|
|
11113
|
-
* Asserts a dashboard-plane call carries a tenant, narrowing it to `string` for the caller.
|
|
11114
|
-
*
|
|
11115
|
-
* This is the dashboard half of {@link assertPlaneTenant}, split out for one reason: an
|
|
11116
|
-
* assertion signature is the only way to state "past this point the tenant is present" to the
|
|
11117
|
-
* type system. `IUserRepository.findById` requires the tenant, and the account read behind the
|
|
11118
|
-
* MFA flows sits under a `context === 'dashboard'` branch where a `void` guard run earlier in
|
|
11119
|
-
* the caller has narrowed nothing. Without this the branch had to pass `string | undefined`
|
|
11120
|
-
* into a `string` parameter, which is precisely the tenant-blind read the guard exists to stop.
|
|
11121
|
-
*
|
|
11122
|
-
* @param tenantId - The tenant supplied by the caller, if any.
|
|
11123
|
-
* @throws {@link AuthException} `VALIDATION` (400) when it is missing or blank.
|
|
11124
|
-
*/
|
|
11125
|
-
assertDashboardTenant(tenantId) {
|
|
11126
|
-
if (tenantId === void 0 || tenantId === "") {
|
|
11127
|
-
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
11128
|
-
{
|
|
11129
|
-
field: "tenantId",
|
|
11130
|
-
message: PLANE_TENANT_MESSAGE
|
|
11131
|
-
}
|
|
11132
|
-
]);
|
|
11133
|
-
}
|
|
11134
|
-
}
|
|
11135
|
-
/**
|
|
11136
|
-
* A dashboard MFA flow MUST carry the tenant it was authenticated in; a platform flow MUST NOT.
|
|
11137
|
-
*
|
|
11138
|
-
* The controller sources the tenant from the verified JWT, which always carries a validated
|
|
11139
|
-
* `tenantId`, so this never trips through the HTTP surface. It guards the OTHER caller:
|
|
11140
|
-
* `MfaService` is a public API, and a host wiring it directly — or a future SSO path — could hand
|
|
11141
|
-
* a dashboard `userId` with no tenant, which would silently reach the tenant-blind account read
|
|
11142
|
-
* and key derivation. Refuse it here, naming the field, rather than let it degrade to the
|
|
11143
|
-
* pre-tenant behaviour, which is exactly the fallback an attacker would aim for.
|
|
11144
|
-
*
|
|
11145
|
-
* @param context - The identity plane the call is on.
|
|
11146
|
-
* @param tenantId - The tenant supplied by the caller, if any.
|
|
11147
|
-
* @throws {@link AuthException} `VALIDATION` (400) when a dashboard call omits the tenant, or a
|
|
11148
|
-
* platform call supplies one.
|
|
11149
|
-
*/
|
|
11150
|
-
assertPlaneTenant(context, tenantId) {
|
|
11151
|
-
if (context === "dashboard") {
|
|
11152
|
-
this.assertDashboardTenant(tenantId);
|
|
11153
|
-
return;
|
|
11154
|
-
}
|
|
11155
|
-
if (tenantId !== void 0) {
|
|
11156
|
-
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, [
|
|
11157
|
-
{
|
|
11158
|
-
field: "tenantId",
|
|
11159
|
-
message: PLANE_TENANT_MESSAGE
|
|
11160
|
-
}
|
|
11161
|
-
]);
|
|
11162
|
-
}
|
|
11163
|
-
}
|
|
11164
|
-
/**
|
|
11165
|
-
* The tenant-scoped brute-force identifier for one MFA flow, and the legacy plane-only one it
|
|
11166
|
-
* replaces — equal on the platform plane, where the subject never carried a tenant, and distinct
|
|
11167
|
-
* on the dashboard plane, where it now does.
|
|
11168
|
-
*
|
|
11169
|
-
* A rolling upgrade runs old and new code against one Redis at once: on the dashboard plane an
|
|
11170
|
-
* old pod counts a failure under `{flow}:{plane}:{userId}` while a new pod counts it under
|
|
11171
|
-
* `{flow}:{userSubject}`, and either alone leaves a hole — a lockout an old pod filled would not
|
|
11172
|
-
* stop a new pod, and a success on one would not clear the other. For one release every read
|
|
11173
|
-
* consults both and every write touches both, so the two move as one; a later release drops the
|
|
11174
|
-
* legacy arm. On the platform plane the two ids are identical (no tenant ever entered the
|
|
11175
|
-
* subject), so the legacy arm is skipped — operating it would just be the same key a second time,
|
|
11176
|
-
* double-counting a failure and locking a platform admin out at half the threshold. `{flow}`
|
|
11177
|
-
* (`challenge` / `disable` / `reauth`) keeps the three counters isolated, exactly as before.
|
|
11178
|
-
*/
|
|
11179
|
-
mfaFlowCounterIds(flow, context, userId, tenantId) {
|
|
11180
|
-
return {
|
|
11181
|
-
legacy: hmacSha256(`${flow}:${context}:${userId}`, this.options.hmacKey),
|
|
11182
|
-
scoped: hmacSha256(`${flow}:${userSubject(context, userId, tenantId)}`, this.options.hmacKey)
|
|
11183
|
-
};
|
|
11184
|
-
}
|
|
11185
|
-
/**
|
|
11186
|
-
* Locked out when EITHER the legacy or the tenant-scoped counter has reached the threshold, so
|
|
11187
|
-
* neither a lockout an old pod recorded nor one a new pod recorded can be bypassed mid-migration.
|
|
11188
|
-
*/
|
|
11189
|
-
async isMfaFlowLockedOut(flow, context, userId, tenantId) {
|
|
11190
|
-
const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
|
|
11191
|
-
if (await this.bruteForce.isLockedOut(scoped)) return true;
|
|
11192
|
-
return legacy !== scoped ? this.bruteForce.isLockedOut(legacy) : false;
|
|
11193
|
-
}
|
|
11194
|
-
/**
|
|
11195
|
-
* Records the failure under both counters so the budget an attacker spends is seen by old and
|
|
11196
|
-
* new code alike — but under the scoped id ONCE when the two coincide (platform plane).
|
|
11197
|
-
*/
|
|
11198
|
-
async recordMfaFlowFailure(flow, context, userId, tenantId) {
|
|
11199
|
-
const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
|
|
11200
|
-
await this.bruteForce.recordFailure(scoped);
|
|
11201
|
-
if (legacy !== scoped) await this.bruteForce.recordFailure(legacy);
|
|
11202
|
-
}
|
|
11203
|
-
/**
|
|
11204
|
-
* Clears both counters on success — resetting only one would leave the other to lock a
|
|
11205
|
-
* legitimately authenticated user out on the next attempt — collapsing to one when they coincide.
|
|
11206
|
-
*/
|
|
11207
|
-
async resetMfaFlowFailures(flow, context, userId, tenantId) {
|
|
11208
|
-
const { legacy, scoped } = this.mfaFlowCounterIds(flow, context, userId, tenantId);
|
|
11209
|
-
await this.bruteForce.resetFailures(scoped);
|
|
11210
|
-
if (legacy !== scoped) await this.bruteForce.resetFailures(legacy);
|
|
11211
|
-
}
|
|
11212
|
-
/**
|
|
11213
11305
|
* Sends an MFA state-change notice, fire-and-forget, with the recipient kept out of the log.
|
|
11214
11306
|
*
|
|
11215
11307
|
* **Not awaited, and that is the fix, not a shortcut.** These three sends used to be awaited
|
|
@@ -11247,76 +11339,31 @@ var MfaService = class _MfaService {
|
|
|
11247
11339
|
}
|
|
11248
11340
|
})();
|
|
11249
11341
|
}
|
|
11250
|
-
/**
|
|
11251
|
-
* Fetches a user from the correct repository based on the MFA context, and refuses one whose
|
|
11252
|
-
* account is blocked.
|
|
11253
|
-
*
|
|
11254
|
-
* The status gate lives here rather than in each caller because every entry point that
|
|
11255
|
-
* reaches this method changes or spends an authentication factor, and every one of them
|
|
11256
|
-
* must refuse a suspended or banned account. It used to live in `challenge` alone, so
|
|
11257
|
-
* `setup`, `verifyAndEnable`, `disable` and `regenerateRecoveryCodes` had no gate at all:
|
|
11258
|
-
* an operator who suspended a compromised account bought nothing against an attacker still
|
|
11259
|
-
* holding an unexpired access token, who could turn the second factor off — or enrol their
|
|
11260
|
-
* own authenticator over it — for the token's remaining lifetime. Nothing else covers that
|
|
11261
|
-
* window: no status change bumps the token epoch, so the per-request check is the only
|
|
11262
|
-
* defence, and neither MFA controller composes `UserStatusGuard` (the platform plane has no
|
|
11263
|
-
* status guard at all). Every other authority-bearing route in the library does gate on
|
|
11264
|
-
* status; changing an authentication factor is at least as privileged as minting an
|
|
11265
|
-
* invitation.
|
|
11266
|
-
*
|
|
11267
|
-
* Gating the fetch rather than the callers is deliberate: a method added later inherits the
|
|
11268
|
-
* check instead of having to remember it.
|
|
11269
|
-
*
|
|
11270
|
-
* @param context - Which identity plane the caller is acting on.
|
|
11271
|
-
* @param userId - The subject taken from the verified token.
|
|
11272
|
-
* @param tenantId - The tenant the caller was authenticated in, on the dashboard plane;
|
|
11273
|
-
* absent on the platform plane, whose admins belong to none.
|
|
11274
|
-
* @returns The account record, guaranteed to be in good standing.
|
|
11275
|
-
* @throws `TOKEN_INVALID` if the user is not found.
|
|
11276
|
-
* @throws {@link AuthException} the status error when the account is blocked.
|
|
11277
|
-
*/
|
|
11278
|
-
async fetchUserForContext(context, userId, tenantId) {
|
|
11279
|
-
if (context === "dashboard") {
|
|
11280
|
-
this.assertDashboardTenant(tenantId);
|
|
11281
|
-
const user = await this.userRepo.findById({
|
|
11282
|
-
id: userId,
|
|
11283
|
-
tenantId
|
|
11284
|
-
});
|
|
11285
|
-
if (!user) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11286
|
-
assertNotBlocked(user.status, this.options.blockedStatuses);
|
|
11287
|
-
return user;
|
|
11288
|
-
}
|
|
11289
|
-
if (!this.platformUserRepo) {
|
|
11290
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11291
|
-
}
|
|
11292
|
-
const admin = await this.platformUserRepo.findById(userId);
|
|
11293
|
-
if (!admin) throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
11294
|
-
assertNotBlocked(admin.status, this.options.blockedStatuses);
|
|
11295
|
-
return admin;
|
|
11296
|
-
}
|
|
11297
11342
|
};
|
|
11298
|
-
MfaService =
|
|
11343
|
+
MfaService = _ts_decorate40([
|
|
11299
11344
|
Injectable(),
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11345
|
+
_ts_param24(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
11346
|
+
_ts_param24(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
11347
|
+
_ts_param24(2, Optional()),
|
|
11348
|
+
_ts_param24(2, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
11349
|
+
_ts_param24(3, Inject(AuthRedisService)),
|
|
11350
|
+
_ts_param24(4, Inject(TokenManagerService)),
|
|
11351
|
+
_ts_param24(5, Inject(MfaRecordService)),
|
|
11352
|
+
_ts_param24(6, Inject(MfaFlowLockoutService)),
|
|
11353
|
+
_ts_param24(7, Inject(ReauthenticationService)),
|
|
11354
|
+
_ts_param24(8, Inject(SessionService)),
|
|
11355
|
+
_ts_param24(9, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
11356
|
+
_ts_param24(10, Inject(BYMAX_AUTH_HOOKS)),
|
|
11357
|
+
_ts_metadata39("design:type", Function),
|
|
11358
|
+
_ts_metadata39("design:paramtypes", [
|
|
11313
11359
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
11314
11360
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
11315
11361
|
Object,
|
|
11316
11362
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
11317
11363
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
11318
|
-
typeof
|
|
11319
|
-
typeof
|
|
11364
|
+
typeof MfaRecordService === "undefined" ? Object : MfaRecordService,
|
|
11365
|
+
typeof MfaFlowLockoutService === "undefined" ? Object : MfaFlowLockoutService,
|
|
11366
|
+
typeof ReauthenticationService === "undefined" ? Object : ReauthenticationService,
|
|
11320
11367
|
typeof SessionService === "undefined" ? Object : SessionService,
|
|
11321
11368
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
11322
11369
|
typeof IAuthHooks === "undefined" ? Object : IAuthHooks
|
|
@@ -11324,7 +11371,7 @@ MfaService = _ts_decorate37([
|
|
|
11324
11371
|
], MfaService);
|
|
11325
11372
|
|
|
11326
11373
|
// src/server/controllers/mfa.controller.ts
|
|
11327
|
-
function
|
|
11374
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
11328
11375
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11329
11376
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11330
11377
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11337,19 +11384,19 @@ function _ts_decorate38(decorators, target, key, desc) {
|
|
|
11337
11384
|
}
|
|
11338
11385
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11339
11386
|
}
|
|
11340
|
-
__name(
|
|
11341
|
-
function
|
|
11387
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
11388
|
+
function _ts_metadata40(metadataKey, metadataValue) {
|
|
11342
11389
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11343
11390
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11344
11391
|
}
|
|
11345
11392
|
}
|
|
11346
|
-
__name(
|
|
11347
|
-
function
|
|
11393
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
11394
|
+
function _ts_param25(paramIndex, decorator) {
|
|
11348
11395
|
return function(target, key) {
|
|
11349
11396
|
decorator(target, key, paramIndex);
|
|
11350
11397
|
};
|
|
11351
11398
|
}
|
|
11352
|
-
__name(
|
|
11399
|
+
__name(_ts_param25, "_ts_param");
|
|
11353
11400
|
function isPlatformResult(result) {
|
|
11354
11401
|
return "admin" in result;
|
|
11355
11402
|
}
|
|
@@ -11538,111 +11585,111 @@ var MfaController = class {
|
|
|
11538
11585
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
|
|
11539
11586
|
}
|
|
11540
11587
|
};
|
|
11541
|
-
|
|
11588
|
+
_ts_decorate41([
|
|
11542
11589
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11543
11590
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11544
11591
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11545
11592
|
RequestEncoding("when-body"),
|
|
11546
11593
|
Post("setup"),
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11594
|
+
_ts_param25(0, CurrentUser()),
|
|
11595
|
+
_ts_param25(1, Body()),
|
|
11596
|
+
_ts_metadata40("design:type", Function),
|
|
11597
|
+
_ts_metadata40("design:paramtypes", [
|
|
11551
11598
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11552
11599
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
11553
11600
|
]),
|
|
11554
|
-
|
|
11601
|
+
_ts_metadata40("design:returntype", Promise)
|
|
11555
11602
|
], MfaController.prototype, "setup", null);
|
|
11556
|
-
|
|
11603
|
+
_ts_decorate41([
|
|
11557
11604
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11558
11605
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11559
11606
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11560
11607
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
11561
11608
|
Post("verify-enable"),
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
|
|
11609
|
+
_ts_param25(0, CurrentUser()),
|
|
11610
|
+
_ts_param25(1, Body()),
|
|
11611
|
+
_ts_param25(2, Req()),
|
|
11612
|
+
_ts_metadata40("design:type", Function),
|
|
11613
|
+
_ts_metadata40("design:paramtypes", [
|
|
11567
11614
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11568
11615
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
11569
11616
|
typeof Request === "undefined" ? Object : Request
|
|
11570
11617
|
]),
|
|
11571
|
-
|
|
11618
|
+
_ts_metadata40("design:returntype", Promise)
|
|
11572
11619
|
], MfaController.prototype, "verifyEnable", null);
|
|
11573
|
-
|
|
11620
|
+
_ts_decorate41([
|
|
11574
11621
|
Public(),
|
|
11575
11622
|
SkipMfa(),
|
|
11576
11623
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11577
11624
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11578
11625
|
HttpCode(HttpStatus.OK),
|
|
11579
11626
|
Post("challenge"),
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11627
|
+
_ts_param25(0, Body()),
|
|
11628
|
+
_ts_param25(1, Req()),
|
|
11629
|
+
_ts_param25(2, Res({
|
|
11583
11630
|
passthrough: true
|
|
11584
11631
|
})),
|
|
11585
|
-
|
|
11586
|
-
|
|
11632
|
+
_ts_metadata40("design:type", Function),
|
|
11633
|
+
_ts_metadata40("design:paramtypes", [
|
|
11587
11634
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
11588
11635
|
typeof Request === "undefined" ? Object : Request,
|
|
11589
11636
|
typeof Response === "undefined" ? Object : Response
|
|
11590
11637
|
]),
|
|
11591
|
-
|
|
11638
|
+
_ts_metadata40("design:returntype", Promise)
|
|
11592
11639
|
], MfaController.prototype, "challenge", null);
|
|
11593
|
-
|
|
11640
|
+
_ts_decorate41([
|
|
11594
11641
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11595
11642
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11596
11643
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11597
11644
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
11598
11645
|
Post("disable"),
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11646
|
+
_ts_param25(0, CurrentUser()),
|
|
11647
|
+
_ts_param25(1, Body()),
|
|
11648
|
+
_ts_param25(2, Req()),
|
|
11649
|
+
_ts_metadata40("design:type", Function),
|
|
11650
|
+
_ts_metadata40("design:paramtypes", [
|
|
11604
11651
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11605
11652
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
11606
11653
|
typeof Request === "undefined" ? Object : Request
|
|
11607
11654
|
]),
|
|
11608
|
-
|
|
11655
|
+
_ts_metadata40("design:returntype", Promise)
|
|
11609
11656
|
], MfaController.prototype, "disable", null);
|
|
11610
|
-
|
|
11657
|
+
_ts_decorate41([
|
|
11611
11658
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11612
11659
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11613
11660
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11614
11661
|
HttpCode(HttpStatus.OK),
|
|
11615
11662
|
Post("recovery-codes"),
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11663
|
+
_ts_param25(0, CurrentUser()),
|
|
11664
|
+
_ts_param25(1, Body()),
|
|
11665
|
+
_ts_param25(2, Req()),
|
|
11666
|
+
_ts_metadata40("design:type", Function),
|
|
11667
|
+
_ts_metadata40("design:paramtypes", [
|
|
11621
11668
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11622
11669
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
11623
11670
|
typeof Request === "undefined" ? Object : Request
|
|
11624
11671
|
]),
|
|
11625
|
-
|
|
11672
|
+
_ts_metadata40("design:returntype", Promise)
|
|
11626
11673
|
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
11627
|
-
MfaController =
|
|
11674
|
+
MfaController = _ts_decorate41([
|
|
11628
11675
|
UseInterceptors(NoStoreInterceptor),
|
|
11629
11676
|
Controller("mfa"),
|
|
11630
11677
|
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
11631
11678
|
UsePipes(createAuthValidationPipe({
|
|
11632
11679
|
forbidUnknownValues: true
|
|
11633
11680
|
})),
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11681
|
+
_ts_param25(0, Inject(MfaService)),
|
|
11682
|
+
_ts_param25(1, Inject(TokenDeliveryService)),
|
|
11683
|
+
_ts_param25(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
11684
|
+
_ts_metadata40("design:type", Function),
|
|
11685
|
+
_ts_metadata40("design:paramtypes", [
|
|
11639
11686
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
11640
11687
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
11641
11688
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11642
11689
|
])
|
|
11643
11690
|
], MfaController);
|
|
11644
11691
|
var Authenticated = /* @__PURE__ */ __name(() => SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
|
|
11645
|
-
function
|
|
11692
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
11646
11693
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11647
11694
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11648
11695
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11655,13 +11702,13 @@ function _ts_decorate39(decorators, target, key, desc) {
|
|
|
11655
11702
|
}
|
|
11656
11703
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11657
11704
|
}
|
|
11658
|
-
__name(
|
|
11659
|
-
function
|
|
11705
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
11706
|
+
function _ts_metadata41(metadataKey, metadataValue) {
|
|
11660
11707
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11661
11708
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11662
11709
|
}
|
|
11663
11710
|
}
|
|
11664
|
-
__name(
|
|
11711
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
11665
11712
|
var ChangePasswordDto = class {
|
|
11666
11713
|
static {
|
|
11667
11714
|
__name(this, "ChangePasswordDto");
|
|
@@ -11714,26 +11761,26 @@ var ChangePasswordDto = class {
|
|
|
11714
11761
|
*/
|
|
11715
11762
|
refreshToken;
|
|
11716
11763
|
};
|
|
11717
|
-
|
|
11764
|
+
_ts_decorate42([
|
|
11718
11765
|
IsString(),
|
|
11719
11766
|
MinLength(1),
|
|
11720
11767
|
MaxLength(128),
|
|
11721
|
-
|
|
11768
|
+
_ts_metadata41("design:type", String)
|
|
11722
11769
|
], ChangePasswordDto.prototype, "currentPassword", void 0);
|
|
11723
|
-
|
|
11770
|
+
_ts_decorate42([
|
|
11724
11771
|
IsString(),
|
|
11725
11772
|
MinLength(8),
|
|
11726
11773
|
MaxLength(128),
|
|
11727
|
-
|
|
11774
|
+
_ts_metadata41("design:type", String)
|
|
11728
11775
|
], ChangePasswordDto.prototype, "newPassword", void 0);
|
|
11729
|
-
|
|
11776
|
+
_ts_decorate42([
|
|
11730
11777
|
IsOptional(),
|
|
11731
11778
|
IsString(),
|
|
11732
11779
|
IsNotEmpty(),
|
|
11733
11780
|
MaxLength(2048),
|
|
11734
|
-
|
|
11781
|
+
_ts_metadata41("design:type", String)
|
|
11735
11782
|
], ChangePasswordDto.prototype, "refreshToken", void 0);
|
|
11736
|
-
function
|
|
11783
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
11737
11784
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11738
11785
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11739
11786
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11746,13 +11793,13 @@ function _ts_decorate40(decorators, target, key, desc) {
|
|
|
11746
11793
|
}
|
|
11747
11794
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11748
11795
|
}
|
|
11749
|
-
__name(
|
|
11750
|
-
function
|
|
11796
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
11797
|
+
function _ts_metadata42(metadataKey, metadataValue) {
|
|
11751
11798
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11752
11799
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11753
11800
|
}
|
|
11754
11801
|
}
|
|
11755
|
-
__name(
|
|
11802
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
11756
11803
|
var ForgotPasswordDto = class {
|
|
11757
11804
|
static {
|
|
11758
11805
|
__name(this, "ForgotPasswordDto");
|
|
@@ -11768,13 +11815,13 @@ var ForgotPasswordDto = class {
|
|
|
11768
11815
|
*/
|
|
11769
11816
|
tenantId;
|
|
11770
11817
|
};
|
|
11771
|
-
|
|
11818
|
+
_ts_decorate43([
|
|
11772
11819
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11773
11820
|
IsEmail(),
|
|
11774
11821
|
MaxLength(255),
|
|
11775
|
-
|
|
11822
|
+
_ts_metadata42("design:type", String)
|
|
11776
11823
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
11777
|
-
|
|
11824
|
+
_ts_decorate43([
|
|
11778
11825
|
IsOptional(),
|
|
11779
11826
|
IsString(),
|
|
11780
11827
|
IsNotEmpty(),
|
|
@@ -11782,9 +11829,9 @@ _ts_decorate40([
|
|
|
11782
11829
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11783
11830
|
message: "tenantId must not contain control characters"
|
|
11784
11831
|
}),
|
|
11785
|
-
|
|
11832
|
+
_ts_metadata42("design:type", String)
|
|
11786
11833
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
11787
|
-
function
|
|
11834
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
11788
11835
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11789
11836
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11790
11837
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11797,13 +11844,13 @@ function _ts_decorate41(decorators, target, key, desc) {
|
|
|
11797
11844
|
}
|
|
11798
11845
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11799
11846
|
}
|
|
11800
|
-
__name(
|
|
11801
|
-
function
|
|
11847
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
11848
|
+
function _ts_metadata43(metadataKey, metadataValue) {
|
|
11802
11849
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11803
11850
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11804
11851
|
}
|
|
11805
11852
|
}
|
|
11806
|
-
__name(
|
|
11853
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
11807
11854
|
var ResendOtpDto = class {
|
|
11808
11855
|
static {
|
|
11809
11856
|
__name(this, "ResendOtpDto");
|
|
@@ -11818,13 +11865,13 @@ var ResendOtpDto = class {
|
|
|
11818
11865
|
*/
|
|
11819
11866
|
tenantId;
|
|
11820
11867
|
};
|
|
11821
|
-
|
|
11868
|
+
_ts_decorate44([
|
|
11822
11869
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11823
11870
|
IsEmail(),
|
|
11824
11871
|
MaxLength(255),
|
|
11825
|
-
|
|
11872
|
+
_ts_metadata43("design:type", String)
|
|
11826
11873
|
], ResendOtpDto.prototype, "email", void 0);
|
|
11827
|
-
|
|
11874
|
+
_ts_decorate44([
|
|
11828
11875
|
IsOptional(),
|
|
11829
11876
|
IsString(),
|
|
11830
11877
|
IsNotEmpty(),
|
|
@@ -11832,9 +11879,9 @@ _ts_decorate41([
|
|
|
11832
11879
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11833
11880
|
message: "tenantId must not contain control characters"
|
|
11834
11881
|
}),
|
|
11835
|
-
|
|
11882
|
+
_ts_metadata43("design:type", String)
|
|
11836
11883
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
11837
|
-
function
|
|
11884
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
11838
11885
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11839
11886
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11840
11887
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11847,13 +11894,13 @@ function _ts_decorate42(decorators, target, key, desc) {
|
|
|
11847
11894
|
}
|
|
11848
11895
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11849
11896
|
}
|
|
11850
|
-
__name(
|
|
11851
|
-
function
|
|
11897
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
11898
|
+
function _ts_metadata44(metadataKey, metadataValue) {
|
|
11852
11899
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11853
11900
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11854
11901
|
}
|
|
11855
11902
|
}
|
|
11856
|
-
__name(
|
|
11903
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
11857
11904
|
var ResetPasswordDto = class {
|
|
11858
11905
|
static {
|
|
11859
11906
|
__name(this, "ResetPasswordDto");
|
|
@@ -11900,38 +11947,38 @@ var ResetPasswordDto = class {
|
|
|
11900
11947
|
*/
|
|
11901
11948
|
tenantId;
|
|
11902
11949
|
};
|
|
11903
|
-
|
|
11950
|
+
_ts_decorate45([
|
|
11904
11951
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11905
11952
|
IsEmail(),
|
|
11906
11953
|
MaxLength(255),
|
|
11907
|
-
|
|
11954
|
+
_ts_metadata44("design:type", String)
|
|
11908
11955
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
11909
|
-
|
|
11956
|
+
_ts_decorate45([
|
|
11910
11957
|
IsString(),
|
|
11911
11958
|
MinLength(8),
|
|
11912
11959
|
MaxLength(128),
|
|
11913
|
-
|
|
11960
|
+
_ts_metadata44("design:type", String)
|
|
11914
11961
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
11915
|
-
|
|
11962
|
+
_ts_decorate45([
|
|
11916
11963
|
IsOptional(),
|
|
11917
11964
|
IsString(),
|
|
11918
11965
|
IsNotEmpty(),
|
|
11919
11966
|
MaxLength(2048),
|
|
11920
|
-
|
|
11967
|
+
_ts_metadata44("design:type", String)
|
|
11921
11968
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
11922
|
-
|
|
11969
|
+
_ts_decorate45([
|
|
11923
11970
|
IsOptional(),
|
|
11924
11971
|
IsString(),
|
|
11925
11972
|
Length(4, 8),
|
|
11926
|
-
|
|
11973
|
+
_ts_metadata44("design:type", String)
|
|
11927
11974
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
11928
|
-
|
|
11975
|
+
_ts_decorate45([
|
|
11929
11976
|
IsOptional(),
|
|
11930
11977
|
IsString(),
|
|
11931
11978
|
Length(64, 64),
|
|
11932
|
-
|
|
11979
|
+
_ts_metadata44("design:type", String)
|
|
11933
11980
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
11934
|
-
|
|
11981
|
+
_ts_decorate45([
|
|
11935
11982
|
IsOptional(),
|
|
11936
11983
|
IsString(),
|
|
11937
11984
|
IsNotEmpty(),
|
|
@@ -11939,9 +11986,9 @@ _ts_decorate42([
|
|
|
11939
11986
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11940
11987
|
message: "tenantId must not contain control characters"
|
|
11941
11988
|
}),
|
|
11942
|
-
|
|
11989
|
+
_ts_metadata44("design:type", String)
|
|
11943
11990
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
11944
|
-
function
|
|
11991
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
11945
11992
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11946
11993
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11947
11994
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11954,13 +12001,13 @@ function _ts_decorate43(decorators, target, key, desc) {
|
|
|
11954
12001
|
}
|
|
11955
12002
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11956
12003
|
}
|
|
11957
|
-
__name(
|
|
11958
|
-
function
|
|
12004
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
12005
|
+
function _ts_metadata45(metadataKey, metadataValue) {
|
|
11959
12006
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11960
12007
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11961
12008
|
}
|
|
11962
12009
|
}
|
|
11963
|
-
__name(
|
|
12010
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
11964
12011
|
var VerifyOtpDto = class {
|
|
11965
12012
|
static {
|
|
11966
12013
|
__name(this, "VerifyOtpDto");
|
|
@@ -11982,18 +12029,18 @@ var VerifyOtpDto = class {
|
|
|
11982
12029
|
*/
|
|
11983
12030
|
tenantId;
|
|
11984
12031
|
};
|
|
11985
|
-
|
|
12032
|
+
_ts_decorate46([
|
|
11986
12033
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11987
12034
|
IsEmail(),
|
|
11988
12035
|
MaxLength(255),
|
|
11989
|
-
|
|
12036
|
+
_ts_metadata45("design:type", String)
|
|
11990
12037
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
11991
|
-
|
|
12038
|
+
_ts_decorate46([
|
|
11992
12039
|
IsString(),
|
|
11993
12040
|
Length(4, 8),
|
|
11994
|
-
|
|
12041
|
+
_ts_metadata45("design:type", String)
|
|
11995
12042
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
11996
|
-
|
|
12043
|
+
_ts_decorate46([
|
|
11997
12044
|
IsOptional(),
|
|
11998
12045
|
IsString(),
|
|
11999
12046
|
IsNotEmpty(),
|
|
@@ -12001,7 +12048,7 @@ _ts_decorate43([
|
|
|
12001
12048
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
12002
12049
|
message: "tenantId must not contain control characters"
|
|
12003
12050
|
}),
|
|
12004
|
-
|
|
12051
|
+
_ts_metadata45("design:type", String)
|
|
12005
12052
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
12006
12053
|
|
|
12007
12054
|
// src/server/utils/answer-reset-request.ts
|
|
@@ -12048,7 +12095,7 @@ async function answerResetRequest(deps, request) {
|
|
|
12048
12095
|
__name(answerResetRequest, "answerResetRequest");
|
|
12049
12096
|
|
|
12050
12097
|
// src/server/services/password-reset.service.ts
|
|
12051
|
-
function
|
|
12098
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
12052
12099
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12053
12100
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12054
12101
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12061,19 +12108,19 @@ function _ts_decorate44(decorators, target, key, desc) {
|
|
|
12061
12108
|
}
|
|
12062
12109
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12063
12110
|
}
|
|
12064
|
-
__name(
|
|
12065
|
-
function
|
|
12111
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
12112
|
+
function _ts_metadata46(metadataKey, metadataValue) {
|
|
12066
12113
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12067
12114
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12068
12115
|
}
|
|
12069
12116
|
}
|
|
12070
|
-
__name(
|
|
12071
|
-
function
|
|
12117
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
12118
|
+
function _ts_param26(paramIndex, decorator) {
|
|
12072
12119
|
return function(target, key) {
|
|
12073
12120
|
decorator(target, key, paramIndex);
|
|
12074
12121
|
};
|
|
12075
12122
|
}
|
|
12076
|
-
__name(
|
|
12123
|
+
__name(_ts_param26, "_ts_param");
|
|
12077
12124
|
var ANTI_ENUM_MIN_MS2 = 300;
|
|
12078
12125
|
var VERIFIED_TOKEN_TTL_SECONDS = 300;
|
|
12079
12126
|
var PASSWORD_RESET_PURPOSE = "password_reset";
|
|
@@ -12539,7 +12586,7 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
12539
12586
|
if (user) {
|
|
12540
12587
|
await this.notifyPasswordChanged(user);
|
|
12541
12588
|
if (this.hooks?.afterPasswordReset) {
|
|
12542
|
-
void Promise.resolve(this.hooks.afterPasswordReset(
|
|
12589
|
+
void Promise.resolve(this.hooks.afterPasswordReset(toSafeUser4(user), {
|
|
12543
12590
|
...createEmptyHookContext(),
|
|
12544
12591
|
plane: "dashboard"
|
|
12545
12592
|
})).catch((err) => {
|
|
@@ -12667,21 +12714,21 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
12667
12714
|
};
|
|
12668
12715
|
}
|
|
12669
12716
|
};
|
|
12670
|
-
PasswordResetService =
|
|
12717
|
+
PasswordResetService = _ts_decorate47([
|
|
12671
12718
|
Injectable(),
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12719
|
+
_ts_param26(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
12720
|
+
_ts_param26(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
12721
|
+
_ts_param26(2, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
12722
|
+
_ts_param26(2, Optional()),
|
|
12723
|
+
_ts_param26(3, Inject(BYMAX_AUTH_HOOKS)),
|
|
12724
|
+
_ts_param26(3, Optional()),
|
|
12725
|
+
_ts_param26(4, Inject(OtpService)),
|
|
12726
|
+
_ts_param26(5, Inject(PasswordService)),
|
|
12727
|
+
_ts_param26(6, Inject(AuthRedisService)),
|
|
12728
|
+
_ts_param26(7, Inject(SessionService)),
|
|
12729
|
+
_ts_param26(8, Inject(BruteForceService)),
|
|
12730
|
+
_ts_metadata46("design:type", Function),
|
|
12731
|
+
_ts_metadata46("design:paramtypes", [
|
|
12685
12732
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
12686
12733
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
12687
12734
|
Object,
|
|
@@ -12693,14 +12740,14 @@ PasswordResetService = _ts_decorate44([
|
|
|
12693
12740
|
typeof BruteForceService === "undefined" ? Object : BruteForceService
|
|
12694
12741
|
])
|
|
12695
12742
|
], PasswordResetService);
|
|
12696
|
-
function
|
|
12743
|
+
function toSafeUser4(user) {
|
|
12697
12744
|
const { passwordHash: _passwordHash, mfaSecret: _mfaSecret, mfaRecoveryCodes: _mfaRecoveryCodes, ...safe } = user;
|
|
12698
12745
|
return safe;
|
|
12699
12746
|
}
|
|
12700
|
-
__name(
|
|
12747
|
+
__name(toSafeUser4, "toSafeUser");
|
|
12701
12748
|
|
|
12702
12749
|
// src/server/controllers/password-reset.controller.ts
|
|
12703
|
-
function
|
|
12750
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
12704
12751
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12705
12752
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12706
12753
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12713,19 +12760,19 @@ function _ts_decorate45(decorators, target, key, desc) {
|
|
|
12713
12760
|
}
|
|
12714
12761
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12715
12762
|
}
|
|
12716
|
-
__name(
|
|
12717
|
-
function
|
|
12763
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
12764
|
+
function _ts_metadata47(metadataKey, metadataValue) {
|
|
12718
12765
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12719
12766
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12720
12767
|
}
|
|
12721
12768
|
}
|
|
12722
|
-
__name(
|
|
12723
|
-
function
|
|
12769
|
+
__name(_ts_metadata47, "_ts_metadata");
|
|
12770
|
+
function _ts_param27(paramIndex, decorator) {
|
|
12724
12771
|
return function(target, key) {
|
|
12725
12772
|
decorator(target, key, paramIndex);
|
|
12726
12773
|
};
|
|
12727
12774
|
}
|
|
12728
|
-
__name(
|
|
12775
|
+
__name(_ts_param27, "_ts_param");
|
|
12729
12776
|
var PasswordResetController = class {
|
|
12730
12777
|
static {
|
|
12731
12778
|
__name(this, "PasswordResetController");
|
|
@@ -12844,95 +12891,95 @@ var PasswordResetController = class {
|
|
|
12844
12891
|
return {};
|
|
12845
12892
|
}
|
|
12846
12893
|
};
|
|
12847
|
-
|
|
12894
|
+
_ts_decorate48([
|
|
12848
12895
|
Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
12849
12896
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
12850
12897
|
HttpCode(HttpStatus.OK),
|
|
12851
12898
|
Post("forgot-password"),
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12899
|
+
_ts_param27(0, Body()),
|
|
12900
|
+
_ts_param27(1, Req()),
|
|
12901
|
+
_ts_metadata47("design:type", Function),
|
|
12902
|
+
_ts_metadata47("design:paramtypes", [
|
|
12856
12903
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
|
|
12857
12904
|
typeof Request === "undefined" ? Object : Request
|
|
12858
12905
|
]),
|
|
12859
|
-
|
|
12906
|
+
_ts_metadata47("design:returntype", Promise)
|
|
12860
12907
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
12861
|
-
|
|
12908
|
+
_ts_decorate48([
|
|
12862
12909
|
Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
12863
12910
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
12864
12911
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
12865
12912
|
Post("reset-password"),
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12913
|
+
_ts_param27(0, Body()),
|
|
12914
|
+
_ts_param27(1, Req()),
|
|
12915
|
+
_ts_metadata47("design:type", Function),
|
|
12916
|
+
_ts_metadata47("design:paramtypes", [
|
|
12870
12917
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
|
|
12871
12918
|
typeof Request === "undefined" ? Object : Request
|
|
12872
12919
|
]),
|
|
12873
|
-
|
|
12920
|
+
_ts_metadata47("design:returntype", Promise)
|
|
12874
12921
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
12875
|
-
|
|
12922
|
+
_ts_decorate48([
|
|
12876
12923
|
Authenticated(),
|
|
12877
12924
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
12878
12925
|
Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
12879
12926
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
12880
12927
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
12881
12928
|
Post("change"),
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12929
|
+
_ts_param27(0, CurrentUser()),
|
|
12930
|
+
_ts_param27(1, Body()),
|
|
12931
|
+
_ts_param27(2, Req()),
|
|
12932
|
+
_ts_metadata47("design:type", Function),
|
|
12933
|
+
_ts_metadata47("design:paramtypes", [
|
|
12887
12934
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
12888
12935
|
typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
|
|
12889
12936
|
typeof Request === "undefined" ? Object : Request
|
|
12890
12937
|
]),
|
|
12891
|
-
|
|
12938
|
+
_ts_metadata47("design:returntype", Promise)
|
|
12892
12939
|
], PasswordResetController.prototype, "changePassword", null);
|
|
12893
|
-
|
|
12940
|
+
_ts_decorate48([
|
|
12894
12941
|
Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
12895
12942
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
12896
12943
|
HttpCode(HttpStatus.OK),
|
|
12897
12944
|
Post("verify-otp"),
|
|
12898
|
-
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12945
|
+
_ts_param27(0, Body()),
|
|
12946
|
+
_ts_param27(1, Req()),
|
|
12947
|
+
_ts_metadata47("design:type", Function),
|
|
12948
|
+
_ts_metadata47("design:paramtypes", [
|
|
12902
12949
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
|
|
12903
12950
|
typeof Request === "undefined" ? Object : Request
|
|
12904
12951
|
]),
|
|
12905
|
-
|
|
12952
|
+
_ts_metadata47("design:returntype", Promise)
|
|
12906
12953
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
12907
|
-
|
|
12954
|
+
_ts_decorate48([
|
|
12908
12955
|
Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
12909
12956
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
12910
12957
|
HttpCode(HttpStatus.OK),
|
|
12911
12958
|
Post("resend-otp"),
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12959
|
+
_ts_param27(0, Body()),
|
|
12960
|
+
_ts_param27(1, Req()),
|
|
12961
|
+
_ts_metadata47("design:type", Function),
|
|
12962
|
+
_ts_metadata47("design:paramtypes", [
|
|
12916
12963
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
|
|
12917
12964
|
typeof Request === "undefined" ? Object : Request
|
|
12918
12965
|
]),
|
|
12919
|
-
|
|
12966
|
+
_ts_metadata47("design:returntype", Promise)
|
|
12920
12967
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
12921
|
-
PasswordResetController =
|
|
12968
|
+
PasswordResetController = _ts_decorate48([
|
|
12922
12969
|
Public(),
|
|
12923
12970
|
UseInterceptors(NoStoreInterceptor),
|
|
12924
12971
|
Controller("password"),
|
|
12925
12972
|
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
12926
12973
|
UsePipes(createAuthValidationPipe()),
|
|
12927
|
-
|
|
12928
|
-
|
|
12929
|
-
|
|
12930
|
-
|
|
12974
|
+
_ts_param27(0, Inject(PasswordResetService)),
|
|
12975
|
+
_ts_param27(1, Inject(TokenDeliveryService)),
|
|
12976
|
+
_ts_metadata47("design:type", Function),
|
|
12977
|
+
_ts_metadata47("design:paramtypes", [
|
|
12931
12978
|
typeof PasswordResetService === "undefined" ? Object : PasswordResetService,
|
|
12932
12979
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
12933
12980
|
])
|
|
12934
12981
|
], PasswordResetController);
|
|
12935
|
-
function
|
|
12982
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
12936
12983
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12937
12984
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12938
12985
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12945,13 +12992,13 @@ function _ts_decorate46(decorators, target, key, desc) {
|
|
|
12945
12992
|
}
|
|
12946
12993
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12947
12994
|
}
|
|
12948
|
-
__name(
|
|
12949
|
-
function
|
|
12995
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
12996
|
+
function _ts_metadata48(metadataKey, metadataValue) {
|
|
12950
12997
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12951
12998
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12952
12999
|
}
|
|
12953
13000
|
}
|
|
12954
|
-
__name(
|
|
13001
|
+
__name(_ts_metadata48, "_ts_metadata");
|
|
12955
13002
|
var PlatformLoginDto = class {
|
|
12956
13003
|
static {
|
|
12957
13004
|
__name(this, "PlatformLoginDto");
|
|
@@ -12979,14 +13026,14 @@ var PlatformLoginDto = class {
|
|
|
12979
13026
|
*/
|
|
12980
13027
|
password;
|
|
12981
13028
|
};
|
|
12982
|
-
|
|
13029
|
+
_ts_decorate49([
|
|
12983
13030
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
12984
13031
|
IsEmail(),
|
|
12985
13032
|
IsNotEmpty(),
|
|
12986
13033
|
MaxLength(255),
|
|
12987
|
-
|
|
13034
|
+
_ts_metadata48("design:type", String)
|
|
12988
13035
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
12989
|
-
|
|
13036
|
+
_ts_decorate49([
|
|
12990
13037
|
IsString(),
|
|
12991
13038
|
IsNotEmpty(),
|
|
12992
13039
|
Matches(/\S/, {
|
|
@@ -12994,9 +13041,9 @@ _ts_decorate46([
|
|
|
12994
13041
|
}),
|
|
12995
13042
|
MinLength(1),
|
|
12996
13043
|
MaxLength(128),
|
|
12997
|
-
|
|
13044
|
+
_ts_metadata48("design:type", String)
|
|
12998
13045
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
12999
|
-
function
|
|
13046
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
13000
13047
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13001
13048
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13002
13049
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13009,19 +13056,19 @@ function _ts_decorate47(decorators, target, key, desc) {
|
|
|
13009
13056
|
}
|
|
13010
13057
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13011
13058
|
}
|
|
13012
|
-
__name(
|
|
13013
|
-
function
|
|
13059
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
13060
|
+
function _ts_metadata49(metadataKey, metadataValue) {
|
|
13014
13061
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13015
13062
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13016
13063
|
}
|
|
13017
13064
|
}
|
|
13018
|
-
__name(
|
|
13019
|
-
function
|
|
13065
|
+
__name(_ts_metadata49, "_ts_metadata");
|
|
13066
|
+
function _ts_param28(paramIndex, decorator) {
|
|
13020
13067
|
return function(target, key) {
|
|
13021
13068
|
decorator(target, key, paramIndex);
|
|
13022
13069
|
};
|
|
13023
13070
|
}
|
|
13024
|
-
__name(
|
|
13071
|
+
__name(_ts_param28, "_ts_param");
|
|
13025
13072
|
var JwtPlatformGuard = class {
|
|
13026
13073
|
static {
|
|
13027
13074
|
__name(this, "JwtPlatformGuard");
|
|
@@ -13067,15 +13114,15 @@ var JwtPlatformGuard = class {
|
|
|
13067
13114
|
return true;
|
|
13068
13115
|
}
|
|
13069
13116
|
};
|
|
13070
|
-
JwtPlatformGuard =
|
|
13117
|
+
JwtPlatformGuard = _ts_decorate50([
|
|
13071
13118
|
Injectable(),
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13119
|
+
_ts_param28(0, Inject(JwtService)),
|
|
13120
|
+
_ts_param28(1, Inject(TokenDeliveryService)),
|
|
13121
|
+
_ts_param28(2, Inject(AuthRevocationService)),
|
|
13122
|
+
_ts_param28(3, Inject(Reflector)),
|
|
13123
|
+
_ts_param28(4, Inject(BYMAX_AUTH_OPTIONS)),
|
|
13124
|
+
_ts_metadata49("design:type", Function),
|
|
13125
|
+
_ts_metadata49("design:paramtypes", [
|
|
13079
13126
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
13080
13127
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
13081
13128
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
@@ -13083,7 +13130,7 @@ JwtPlatformGuard = _ts_decorate47([
|
|
|
13083
13130
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13084
13131
|
])
|
|
13085
13132
|
], JwtPlatformGuard);
|
|
13086
|
-
function
|
|
13133
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
13087
13134
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13088
13135
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13089
13136
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13096,19 +13143,19 @@ function _ts_decorate48(decorators, target, key, desc) {
|
|
|
13096
13143
|
}
|
|
13097
13144
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13098
13145
|
}
|
|
13099
|
-
__name(
|
|
13100
|
-
function
|
|
13146
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
13147
|
+
function _ts_metadata50(metadataKey, metadataValue) {
|
|
13101
13148
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13102
13149
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13103
13150
|
}
|
|
13104
13151
|
}
|
|
13105
|
-
__name(
|
|
13106
|
-
function
|
|
13152
|
+
__name(_ts_metadata50, "_ts_metadata");
|
|
13153
|
+
function _ts_param29(paramIndex, decorator) {
|
|
13107
13154
|
return function(target, key) {
|
|
13108
13155
|
decorator(target, key, paramIndex);
|
|
13109
13156
|
};
|
|
13110
13157
|
}
|
|
13111
|
-
__name(
|
|
13158
|
+
__name(_ts_param29, "_ts_param");
|
|
13112
13159
|
var PlatformAuthService = class _PlatformAuthService {
|
|
13113
13160
|
static {
|
|
13114
13161
|
__name(this, "PlatformAuthService");
|
|
@@ -13401,18 +13448,18 @@ var PlatformAuthService = class _PlatformAuthService {
|
|
|
13401
13448
|
await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
|
|
13402
13449
|
}
|
|
13403
13450
|
};
|
|
13404
|
-
PlatformAuthService =
|
|
13451
|
+
PlatformAuthService = _ts_decorate51([
|
|
13405
13452
|
Injectable(),
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13453
|
+
_ts_param29(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
13454
|
+
_ts_param29(1, Inject(PasswordService)),
|
|
13455
|
+
_ts_param29(2, Inject(TokenManagerService)),
|
|
13456
|
+
_ts_param29(3, Inject(BruteForceService)),
|
|
13457
|
+
_ts_param29(4, Inject(AuthRedisService)),
|
|
13458
|
+
_ts_param29(5, Inject(BYMAX_AUTH_OPTIONS)),
|
|
13459
|
+
_ts_param29(6, Inject(BYMAX_AUTH_HOOKS)),
|
|
13460
|
+
_ts_param29(6, Optional()),
|
|
13461
|
+
_ts_metadata50("design:type", Function),
|
|
13462
|
+
_ts_metadata50("design:paramtypes", [
|
|
13416
13463
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
13417
13464
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
13418
13465
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -13424,7 +13471,7 @@ PlatformAuthService = _ts_decorate48([
|
|
|
13424
13471
|
], PlatformAuthService);
|
|
13425
13472
|
|
|
13426
13473
|
// src/server/controllers/platform-auth.controller.ts
|
|
13427
|
-
function
|
|
13474
|
+
function _ts_decorate52(decorators, target, key, desc) {
|
|
13428
13475
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13429
13476
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13430
13477
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13437,19 +13484,19 @@ function _ts_decorate49(decorators, target, key, desc) {
|
|
|
13437
13484
|
}
|
|
13438
13485
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13439
13486
|
}
|
|
13440
|
-
__name(
|
|
13441
|
-
function
|
|
13487
|
+
__name(_ts_decorate52, "_ts_decorate");
|
|
13488
|
+
function _ts_metadata51(metadataKey, metadataValue) {
|
|
13442
13489
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13443
13490
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13444
13491
|
}
|
|
13445
13492
|
}
|
|
13446
|
-
__name(
|
|
13447
|
-
function
|
|
13493
|
+
__name(_ts_metadata51, "_ts_metadata");
|
|
13494
|
+
function _ts_param30(paramIndex, decorator) {
|
|
13448
13495
|
return function(target, key) {
|
|
13449
13496
|
decorator(target, key, paramIndex);
|
|
13450
13497
|
};
|
|
13451
13498
|
}
|
|
13452
|
-
__name(
|
|
13499
|
+
__name(_ts_param30, "_ts_param");
|
|
13453
13500
|
function isMfaChallenge2(result) {
|
|
13454
13501
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
13455
13502
|
}
|
|
@@ -13595,103 +13642,103 @@ var PlatformAuthController = class {
|
|
|
13595
13642
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
13596
13643
|
}
|
|
13597
13644
|
};
|
|
13598
|
-
|
|
13645
|
+
_ts_decorate52([
|
|
13599
13646
|
Public(),
|
|
13600
13647
|
Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
13601
13648
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
13602
13649
|
HttpCode(HttpStatus.OK),
|
|
13603
13650
|
Post("login"),
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13651
|
+
_ts_param30(0, Body()),
|
|
13652
|
+
_ts_param30(1, Req()),
|
|
13653
|
+
_ts_metadata51("design:type", Function),
|
|
13654
|
+
_ts_metadata51("design:paramtypes", [
|
|
13608
13655
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
13609
13656
|
typeof Request === "undefined" ? Object : Request
|
|
13610
13657
|
]),
|
|
13611
|
-
|
|
13658
|
+
_ts_metadata51("design:returntype", Promise)
|
|
13612
13659
|
], PlatformAuthController.prototype, "login", null);
|
|
13613
|
-
|
|
13660
|
+
_ts_decorate52([
|
|
13614
13661
|
Public(),
|
|
13615
13662
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
13616
13663
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
13617
13664
|
HttpCode(HttpStatus.OK),
|
|
13618
13665
|
Post("mfa/challenge"),
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13666
|
+
_ts_param30(0, Body()),
|
|
13667
|
+
_ts_param30(1, Req()),
|
|
13668
|
+
_ts_metadata51("design:type", Function),
|
|
13669
|
+
_ts_metadata51("design:paramtypes", [
|
|
13623
13670
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
13624
13671
|
typeof Request === "undefined" ? Object : Request
|
|
13625
13672
|
]),
|
|
13626
|
-
|
|
13673
|
+
_ts_metadata51("design:returntype", Promise)
|
|
13627
13674
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
13628
|
-
|
|
13675
|
+
_ts_decorate52([
|
|
13629
13676
|
UseGuards(JwtPlatformGuard),
|
|
13630
13677
|
Get("me"),
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13678
|
+
_ts_param30(0, CurrentUser()),
|
|
13679
|
+
_ts_metadata51("design:type", Function),
|
|
13680
|
+
_ts_metadata51("design:paramtypes", [
|
|
13634
13681
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
13635
13682
|
]),
|
|
13636
|
-
|
|
13683
|
+
_ts_metadata51("design:returntype", Promise)
|
|
13637
13684
|
], PlatformAuthController.prototype, "me", null);
|
|
13638
|
-
|
|
13685
|
+
_ts_decorate52([
|
|
13639
13686
|
Public(),
|
|
13640
13687
|
Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
13641
13688
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
13642
13689
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13643
13690
|
RequestEncoding("unchecked"),
|
|
13644
13691
|
Post("logout"),
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13692
|
+
_ts_param30(0, Req()),
|
|
13693
|
+
_ts_metadata51("design:type", Function),
|
|
13694
|
+
_ts_metadata51("design:paramtypes", [
|
|
13648
13695
|
typeof Request === "undefined" ? Object : Request
|
|
13649
13696
|
]),
|
|
13650
|
-
|
|
13697
|
+
_ts_metadata51("design:returntype", Promise)
|
|
13651
13698
|
], PlatformAuthController.prototype, "logout", null);
|
|
13652
|
-
|
|
13699
|
+
_ts_decorate52([
|
|
13653
13700
|
Public(),
|
|
13654
13701
|
Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
13655
13702
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
13656
13703
|
HttpCode(HttpStatus.OK),
|
|
13657
13704
|
RequestEncoding("unchecked"),
|
|
13658
13705
|
Post("refresh"),
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13706
|
+
_ts_param30(0, Req()),
|
|
13707
|
+
_ts_metadata51("design:type", Function),
|
|
13708
|
+
_ts_metadata51("design:paramtypes", [
|
|
13662
13709
|
typeof Request === "undefined" ? Object : Request
|
|
13663
13710
|
]),
|
|
13664
|
-
|
|
13711
|
+
_ts_metadata51("design:returntype", Promise)
|
|
13665
13712
|
], PlatformAuthController.prototype, "refresh", null);
|
|
13666
|
-
|
|
13713
|
+
_ts_decorate52([
|
|
13667
13714
|
UseGuards(JwtPlatformGuard),
|
|
13668
13715
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13669
13716
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13670
13717
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13671
13718
|
Delete("sessions"),
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13719
|
+
_ts_param30(0, CurrentUser()),
|
|
13720
|
+
_ts_metadata51("design:type", Function),
|
|
13721
|
+
_ts_metadata51("design:paramtypes", [
|
|
13675
13722
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
13676
13723
|
]),
|
|
13677
|
-
|
|
13724
|
+
_ts_metadata51("design:returntype", Promise)
|
|
13678
13725
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
13679
|
-
PlatformAuthController =
|
|
13726
|
+
PlatformAuthController = _ts_decorate52([
|
|
13680
13727
|
UseInterceptors(NoStoreInterceptor),
|
|
13681
13728
|
Controller("platform"),
|
|
13682
13729
|
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
13683
13730
|
UsePipes(createAuthValidationPipe()),
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13731
|
+
_ts_param30(0, Inject(PlatformAuthService)),
|
|
13732
|
+
_ts_param30(1, Inject(MfaService)),
|
|
13733
|
+
_ts_param30(2, Inject(TokenDeliveryService)),
|
|
13734
|
+
_ts_metadata51("design:type", Function),
|
|
13735
|
+
_ts_metadata51("design:paramtypes", [
|
|
13689
13736
|
typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
|
|
13690
13737
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
13691
13738
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
13692
13739
|
])
|
|
13693
13740
|
], PlatformAuthController);
|
|
13694
|
-
function
|
|
13741
|
+
function _ts_decorate53(decorators, target, key, desc) {
|
|
13695
13742
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13696
13743
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13697
13744
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13704,19 +13751,19 @@ function _ts_decorate50(decorators, target, key, desc) {
|
|
|
13704
13751
|
}
|
|
13705
13752
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13706
13753
|
}
|
|
13707
|
-
__name(
|
|
13708
|
-
function
|
|
13754
|
+
__name(_ts_decorate53, "_ts_decorate");
|
|
13755
|
+
function _ts_metadata52(metadataKey, metadataValue) {
|
|
13709
13756
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13710
13757
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13711
13758
|
}
|
|
13712
13759
|
}
|
|
13713
|
-
__name(
|
|
13714
|
-
function
|
|
13760
|
+
__name(_ts_metadata52, "_ts_metadata");
|
|
13761
|
+
function _ts_param31(paramIndex, decorator) {
|
|
13715
13762
|
return function(target, key) {
|
|
13716
13763
|
decorator(target, key, paramIndex);
|
|
13717
13764
|
};
|
|
13718
13765
|
}
|
|
13719
|
-
__name(
|
|
13766
|
+
__name(_ts_param31, "_ts_param");
|
|
13720
13767
|
var PlatformMfaController = class {
|
|
13721
13768
|
static {
|
|
13722
13769
|
__name(this, "PlatformMfaController");
|
|
@@ -13795,86 +13842,86 @@ var PlatformMfaController = class {
|
|
|
13795
13842
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
13796
13843
|
}
|
|
13797
13844
|
};
|
|
13798
|
-
|
|
13845
|
+
_ts_decorate53([
|
|
13799
13846
|
UseGuards(JwtPlatformGuard),
|
|
13800
13847
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
13801
13848
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
13802
13849
|
RequestEncoding("when-body"),
|
|
13803
13850
|
Post("setup"),
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13851
|
+
_ts_param31(0, CurrentUser()),
|
|
13852
|
+
_ts_param31(1, Body()),
|
|
13853
|
+
_ts_metadata52("design:type", Function),
|
|
13854
|
+
_ts_metadata52("design:paramtypes", [
|
|
13808
13855
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13809
13856
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
13810
13857
|
]),
|
|
13811
|
-
|
|
13858
|
+
_ts_metadata52("design:returntype", Promise)
|
|
13812
13859
|
], PlatformMfaController.prototype, "setup", null);
|
|
13813
|
-
|
|
13860
|
+
_ts_decorate53([
|
|
13814
13861
|
UseGuards(JwtPlatformGuard),
|
|
13815
13862
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
13816
13863
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
13817
13864
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13818
13865
|
Post("verify-enable"),
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13866
|
+
_ts_param31(0, CurrentUser()),
|
|
13867
|
+
_ts_param31(1, Body()),
|
|
13868
|
+
_ts_param31(2, Req()),
|
|
13869
|
+
_ts_metadata52("design:type", Function),
|
|
13870
|
+
_ts_metadata52("design:paramtypes", [
|
|
13824
13871
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13825
13872
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
13826
13873
|
typeof Request === "undefined" ? Object : Request
|
|
13827
13874
|
]),
|
|
13828
|
-
|
|
13875
|
+
_ts_metadata52("design:returntype", Promise)
|
|
13829
13876
|
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
13830
|
-
|
|
13877
|
+
_ts_decorate53([
|
|
13831
13878
|
UseGuards(JwtPlatformGuard),
|
|
13832
13879
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13833
13880
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13834
13881
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13835
13882
|
Post("disable"),
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
13883
|
+
_ts_param31(0, CurrentUser()),
|
|
13884
|
+
_ts_param31(1, Body()),
|
|
13885
|
+
_ts_param31(2, Req()),
|
|
13886
|
+
_ts_metadata52("design:type", Function),
|
|
13887
|
+
_ts_metadata52("design:paramtypes", [
|
|
13841
13888
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13842
13889
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
13843
13890
|
typeof Request === "undefined" ? Object : Request
|
|
13844
13891
|
]),
|
|
13845
|
-
|
|
13892
|
+
_ts_metadata52("design:returntype", Promise)
|
|
13846
13893
|
], PlatformMfaController.prototype, "disable", null);
|
|
13847
|
-
|
|
13894
|
+
_ts_decorate53([
|
|
13848
13895
|
UseGuards(JwtPlatformGuard),
|
|
13849
13896
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13850
13897
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13851
13898
|
HttpCode(HttpStatus.OK),
|
|
13852
13899
|
Post("recovery-codes"),
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
|
|
13857
|
-
|
|
13900
|
+
_ts_param31(0, CurrentUser()),
|
|
13901
|
+
_ts_param31(1, Body()),
|
|
13902
|
+
_ts_param31(2, Req()),
|
|
13903
|
+
_ts_metadata52("design:type", Function),
|
|
13904
|
+
_ts_metadata52("design:paramtypes", [
|
|
13858
13905
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13859
13906
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
13860
13907
|
typeof Request === "undefined" ? Object : Request
|
|
13861
13908
|
]),
|
|
13862
|
-
|
|
13909
|
+
_ts_metadata52("design:returntype", Promise)
|
|
13863
13910
|
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
13864
|
-
PlatformMfaController =
|
|
13911
|
+
PlatformMfaController = _ts_decorate53([
|
|
13865
13912
|
UseInterceptors(NoStoreInterceptor),
|
|
13866
13913
|
Controller("platform/mfa"),
|
|
13867
13914
|
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
13868
13915
|
UsePipes(createAuthValidationPipe({
|
|
13869
13916
|
forbidUnknownValues: true
|
|
13870
13917
|
})),
|
|
13871
|
-
|
|
13872
|
-
|
|
13873
|
-
|
|
13918
|
+
_ts_param31(0, Inject(MfaService)),
|
|
13919
|
+
_ts_metadata52("design:type", Function),
|
|
13920
|
+
_ts_metadata52("design:paramtypes", [
|
|
13874
13921
|
typeof MfaService === "undefined" ? Object : MfaService
|
|
13875
13922
|
])
|
|
13876
13923
|
], PlatformMfaController);
|
|
13877
|
-
function
|
|
13924
|
+
function _ts_decorate54(decorators, target, key, desc) {
|
|
13878
13925
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13879
13926
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13880
13927
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13887,19 +13934,19 @@ function _ts_decorate51(decorators, target, key, desc) {
|
|
|
13887
13934
|
}
|
|
13888
13935
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13889
13936
|
}
|
|
13890
|
-
__name(
|
|
13891
|
-
function
|
|
13937
|
+
__name(_ts_decorate54, "_ts_decorate");
|
|
13938
|
+
function _ts_metadata53(metadataKey, metadataValue) {
|
|
13892
13939
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13893
13940
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13894
13941
|
}
|
|
13895
13942
|
}
|
|
13896
|
-
__name(
|
|
13897
|
-
function
|
|
13943
|
+
__name(_ts_metadata53, "_ts_metadata");
|
|
13944
|
+
function _ts_param32(paramIndex, decorator) {
|
|
13898
13945
|
return function(target, key) {
|
|
13899
13946
|
decorator(target, key, paramIndex);
|
|
13900
13947
|
};
|
|
13901
13948
|
}
|
|
13902
|
-
__name(
|
|
13949
|
+
__name(_ts_param32, "_ts_param");
|
|
13903
13950
|
var SessionController = class {
|
|
13904
13951
|
static {
|
|
13905
13952
|
__name(this, "SessionController");
|
|
@@ -13999,64 +14046,64 @@ var SessionController = class {
|
|
|
13999
14046
|
});
|
|
14000
14047
|
}
|
|
14001
14048
|
};
|
|
14002
|
-
|
|
14049
|
+
_ts_decorate54([
|
|
14003
14050
|
Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
14004
14051
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
14005
14052
|
Get(),
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14053
|
+
_ts_param32(0, CurrentUser()),
|
|
14054
|
+
_ts_param32(1, Req()),
|
|
14055
|
+
_ts_metadata53("design:type", Function),
|
|
14056
|
+
_ts_metadata53("design:paramtypes", [
|
|
14010
14057
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
14011
14058
|
typeof Request === "undefined" ? Object : Request
|
|
14012
14059
|
]),
|
|
14013
|
-
|
|
14060
|
+
_ts_metadata53("design:returntype", Promise)
|
|
14014
14061
|
], SessionController.prototype, "listSessions", null);
|
|
14015
|
-
|
|
14062
|
+
_ts_decorate54([
|
|
14016
14063
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
14017
14064
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
14018
14065
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
14019
14066
|
RequestEncoding("unchecked"),
|
|
14020
14067
|
Post("revoke-all"),
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14068
|
+
_ts_param32(0, CurrentUser()),
|
|
14069
|
+
_ts_param32(1, Req()),
|
|
14070
|
+
_ts_metadata53("design:type", Function),
|
|
14071
|
+
_ts_metadata53("design:paramtypes", [
|
|
14025
14072
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
14026
14073
|
typeof Request === "undefined" ? Object : Request
|
|
14027
14074
|
]),
|
|
14028
|
-
|
|
14075
|
+
_ts_metadata53("design:returntype", Promise)
|
|
14029
14076
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
14030
|
-
|
|
14077
|
+
_ts_decorate54([
|
|
14031
14078
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
14032
14079
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
14033
14080
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
14034
14081
|
Delete(":id"),
|
|
14035
|
-
|
|
14036
|
-
|
|
14037
|
-
|
|
14038
|
-
|
|
14082
|
+
_ts_param32(0, CurrentUser()),
|
|
14083
|
+
_ts_param32(1, Param("id")),
|
|
14084
|
+
_ts_metadata53("design:type", Function),
|
|
14085
|
+
_ts_metadata53("design:paramtypes", [
|
|
14039
14086
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
14040
14087
|
String
|
|
14041
14088
|
]),
|
|
14042
|
-
|
|
14089
|
+
_ts_metadata53("design:returntype", Promise)
|
|
14043
14090
|
], SessionController.prototype, "revokeSession", null);
|
|
14044
|
-
SessionController =
|
|
14091
|
+
SessionController = _ts_decorate54([
|
|
14045
14092
|
UseInterceptors(NoStoreInterceptor),
|
|
14046
14093
|
Controller("sessions"),
|
|
14047
14094
|
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard, JwtAuthGuard, UserStatusGuard),
|
|
14048
14095
|
UsePipes(createAuthValidationPipe()),
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14096
|
+
_ts_param32(0, Inject(SessionService)),
|
|
14097
|
+
_ts_param32(1, Inject(TokenDeliveryService)),
|
|
14098
|
+
_ts_metadata53("design:type", Function),
|
|
14099
|
+
_ts_metadata53("design:paramtypes", [
|
|
14053
14100
|
typeof SessionService === "undefined" ? Object : SessionService,
|
|
14054
14101
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
14055
14102
|
])
|
|
14056
14103
|
], SessionController);
|
|
14057
14104
|
var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
|
|
14058
14105
|
var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
|
|
14059
|
-
function
|
|
14106
|
+
function _ts_decorate55(decorators, target, key, desc) {
|
|
14060
14107
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14061
14108
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14062
14109
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14069,19 +14116,19 @@ function _ts_decorate52(decorators, target, key, desc) {
|
|
|
14069
14116
|
}
|
|
14070
14117
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14071
14118
|
}
|
|
14072
|
-
__name(
|
|
14073
|
-
function
|
|
14119
|
+
__name(_ts_decorate55, "_ts_decorate");
|
|
14120
|
+
function _ts_metadata54(metadataKey, metadataValue) {
|
|
14074
14121
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14075
14122
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14076
14123
|
}
|
|
14077
14124
|
}
|
|
14078
|
-
__name(
|
|
14079
|
-
function
|
|
14125
|
+
__name(_ts_metadata54, "_ts_metadata");
|
|
14126
|
+
function _ts_param33(paramIndex, decorator) {
|
|
14080
14127
|
return function(target, key) {
|
|
14081
14128
|
decorator(target, key, paramIndex);
|
|
14082
14129
|
};
|
|
14083
14130
|
}
|
|
14084
|
-
__name(
|
|
14131
|
+
__name(_ts_param33, "_ts_param");
|
|
14085
14132
|
var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
|
|
14086
14133
|
static {
|
|
14087
14134
|
__name(this, "ApiKeyLastUsedService");
|
|
@@ -14142,12 +14189,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
|
|
|
14142
14189
|
await this.flush();
|
|
14143
14190
|
}
|
|
14144
14191
|
};
|
|
14145
|
-
ApiKeyLastUsedService =
|
|
14192
|
+
ApiKeyLastUsedService = _ts_decorate55([
|
|
14146
14193
|
Injectable(),
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14194
|
+
_ts_param33(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
14195
|
+
_ts_param33(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14196
|
+
_ts_metadata54("design:type", Function),
|
|
14197
|
+
_ts_metadata54("design:paramtypes", [
|
|
14151
14198
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
14152
14199
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14153
14200
|
])
|
|
@@ -14196,7 +14243,7 @@ function digestsMatch(computed, stored) {
|
|
|
14196
14243
|
__name(digestsMatch, "digestsMatch");
|
|
14197
14244
|
|
|
14198
14245
|
// src/server/services/api-key-verifier.service.ts
|
|
14199
|
-
function
|
|
14246
|
+
function _ts_decorate56(decorators, target, key, desc) {
|
|
14200
14247
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14201
14248
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14202
14249
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14209,19 +14256,19 @@ function _ts_decorate53(decorators, target, key, desc) {
|
|
|
14209
14256
|
}
|
|
14210
14257
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14211
14258
|
}
|
|
14212
|
-
__name(
|
|
14213
|
-
function
|
|
14259
|
+
__name(_ts_decorate56, "_ts_decorate");
|
|
14260
|
+
function _ts_metadata55(metadataKey, metadataValue) {
|
|
14214
14261
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14215
14262
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14216
14263
|
}
|
|
14217
14264
|
}
|
|
14218
|
-
__name(
|
|
14219
|
-
function
|
|
14265
|
+
__name(_ts_metadata55, "_ts_metadata");
|
|
14266
|
+
function _ts_param34(paramIndex, decorator) {
|
|
14220
14267
|
return function(target, key) {
|
|
14221
14268
|
decorator(target, key, paramIndex);
|
|
14222
14269
|
};
|
|
14223
14270
|
}
|
|
14224
|
-
__name(
|
|
14271
|
+
__name(_ts_param34, "_ts_param");
|
|
14225
14272
|
var ApiKeyVerifierService = class {
|
|
14226
14273
|
static {
|
|
14227
14274
|
__name(this, "ApiKeyVerifierService");
|
|
@@ -14281,14 +14328,14 @@ var ApiKeyVerifierService = class {
|
|
|
14281
14328
|
return null;
|
|
14282
14329
|
}
|
|
14283
14330
|
};
|
|
14284
|
-
ApiKeyVerifierService =
|
|
14285
|
-
Injectable(),
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14331
|
+
ApiKeyVerifierService = _ts_decorate56([
|
|
14332
|
+
Injectable(),
|
|
14333
|
+
_ts_param34(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
14334
|
+
_ts_param34(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
14335
|
+
_ts_param34(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14336
|
+
_ts_param34(3, Inject(ApiKeyLastUsedService)),
|
|
14337
|
+
_ts_metadata55("design:type", Function),
|
|
14338
|
+
_ts_metadata55("design:paramtypes", [
|
|
14292
14339
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
14293
14340
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
14294
14341
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -14297,7 +14344,7 @@ ApiKeyVerifierService = _ts_decorate53([
|
|
|
14297
14344
|
], ApiKeyVerifierService);
|
|
14298
14345
|
|
|
14299
14346
|
// src/server/guards/api-key.guard.ts
|
|
14300
|
-
function
|
|
14347
|
+
function _ts_decorate57(decorators, target, key, desc) {
|
|
14301
14348
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14302
14349
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14303
14350
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14310,19 +14357,19 @@ function _ts_decorate54(decorators, target, key, desc) {
|
|
|
14310
14357
|
}
|
|
14311
14358
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14312
14359
|
}
|
|
14313
|
-
__name(
|
|
14314
|
-
function
|
|
14360
|
+
__name(_ts_decorate57, "_ts_decorate");
|
|
14361
|
+
function _ts_metadata56(metadataKey, metadataValue) {
|
|
14315
14362
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14316
14363
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14317
14364
|
}
|
|
14318
14365
|
}
|
|
14319
|
-
__name(
|
|
14320
|
-
function
|
|
14366
|
+
__name(_ts_metadata56, "_ts_metadata");
|
|
14367
|
+
function _ts_param35(paramIndex, decorator) {
|
|
14321
14368
|
return function(target, key) {
|
|
14322
14369
|
decorator(target, key, paramIndex);
|
|
14323
14370
|
};
|
|
14324
14371
|
}
|
|
14325
|
-
__name(
|
|
14372
|
+
__name(_ts_param35, "_ts_param");
|
|
14326
14373
|
var ApiKeyGuard = class _ApiKeyGuard {
|
|
14327
14374
|
static {
|
|
14328
14375
|
__name(this, "ApiKeyGuard");
|
|
@@ -14462,15 +14509,15 @@ var ApiKeyGuard = class _ApiKeyGuard {
|
|
|
14462
14509
|
};
|
|
14463
14510
|
}
|
|
14464
14511
|
};
|
|
14465
|
-
ApiKeyGuard =
|
|
14512
|
+
ApiKeyGuard = _ts_decorate57([
|
|
14466
14513
|
Injectable(),
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14514
|
+
_ts_param35(0, Inject(Reflector)),
|
|
14515
|
+
_ts_param35(1, Inject(ApiKeyVerifierService)),
|
|
14516
|
+
_ts_param35(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14517
|
+
_ts_param35(3, Inject(BYMAX_AUTH_HOOKS)),
|
|
14518
|
+
_ts_param35(3, Optional()),
|
|
14519
|
+
_ts_metadata56("design:type", Function),
|
|
14520
|
+
_ts_metadata56("design:paramtypes", [
|
|
14474
14521
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
14475
14522
|
typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
|
|
14476
14523
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -14482,7 +14529,7 @@ function routePattern(request) {
|
|
|
14482
14529
|
return typeof path === "string" ? path : "";
|
|
14483
14530
|
}
|
|
14484
14531
|
__name(routePattern, "routePattern");
|
|
14485
|
-
function
|
|
14532
|
+
function _ts_decorate58(decorators, target, key, desc) {
|
|
14486
14533
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14487
14534
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14488
14535
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14495,19 +14542,19 @@ function _ts_decorate55(decorators, target, key, desc) {
|
|
|
14495
14542
|
}
|
|
14496
14543
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14497
14544
|
}
|
|
14498
|
-
__name(
|
|
14499
|
-
function
|
|
14545
|
+
__name(_ts_decorate58, "_ts_decorate");
|
|
14546
|
+
function _ts_metadata57(metadataKey, metadataValue) {
|
|
14500
14547
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14501
14548
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14502
14549
|
}
|
|
14503
14550
|
}
|
|
14504
|
-
__name(
|
|
14505
|
-
function
|
|
14551
|
+
__name(_ts_metadata57, "_ts_metadata");
|
|
14552
|
+
function _ts_param36(paramIndex, decorator) {
|
|
14506
14553
|
return function(target, key) {
|
|
14507
14554
|
decorator(target, key, paramIndex);
|
|
14508
14555
|
};
|
|
14509
14556
|
}
|
|
14510
|
-
__name(
|
|
14557
|
+
__name(_ts_param36, "_ts_param");
|
|
14511
14558
|
var MfaRequiredGuard = class {
|
|
14512
14559
|
static {
|
|
14513
14560
|
__name(this, "MfaRequiredGuard");
|
|
@@ -14534,11 +14581,11 @@ var MfaRequiredGuard = class {
|
|
|
14534
14581
|
return true;
|
|
14535
14582
|
}
|
|
14536
14583
|
};
|
|
14537
|
-
MfaRequiredGuard =
|
|
14584
|
+
MfaRequiredGuard = _ts_decorate58([
|
|
14538
14585
|
Injectable(),
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14586
|
+
_ts_param36(0, Inject(Reflector)),
|
|
14587
|
+
_ts_metadata57("design:type", Function),
|
|
14588
|
+
_ts_metadata57("design:paramtypes", [
|
|
14542
14589
|
typeof Reflector === "undefined" ? Object : Reflector
|
|
14543
14590
|
])
|
|
14544
14591
|
], MfaRequiredGuard);
|
|
@@ -14546,7 +14593,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
14546
14593
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
14547
14594
|
|
|
14548
14595
|
// src/server/guards/platform-roles.guard.ts
|
|
14549
|
-
function
|
|
14596
|
+
function _ts_decorate59(decorators, target, key, desc) {
|
|
14550
14597
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14551
14598
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14552
14599
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14559,19 +14606,19 @@ function _ts_decorate56(decorators, target, key, desc) {
|
|
|
14559
14606
|
}
|
|
14560
14607
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14561
14608
|
}
|
|
14562
|
-
__name(
|
|
14563
|
-
function
|
|
14609
|
+
__name(_ts_decorate59, "_ts_decorate");
|
|
14610
|
+
function _ts_metadata58(metadataKey, metadataValue) {
|
|
14564
14611
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14565
14612
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14566
14613
|
}
|
|
14567
14614
|
}
|
|
14568
|
-
__name(
|
|
14569
|
-
function
|
|
14615
|
+
__name(_ts_metadata58, "_ts_metadata");
|
|
14616
|
+
function _ts_param37(paramIndex, decorator) {
|
|
14570
14617
|
return function(target, key) {
|
|
14571
14618
|
decorator(target, key, paramIndex);
|
|
14572
14619
|
};
|
|
14573
14620
|
}
|
|
14574
|
-
__name(
|
|
14621
|
+
__name(_ts_param37, "_ts_param");
|
|
14575
14622
|
var PlatformRolesGuard = class {
|
|
14576
14623
|
static {
|
|
14577
14624
|
__name(this, "PlatformRolesGuard");
|
|
@@ -14605,12 +14652,12 @@ var PlatformRolesGuard = class {
|
|
|
14605
14652
|
return true;
|
|
14606
14653
|
}
|
|
14607
14654
|
};
|
|
14608
|
-
PlatformRolesGuard =
|
|
14655
|
+
PlatformRolesGuard = _ts_decorate59([
|
|
14609
14656
|
Injectable(),
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14657
|
+
_ts_param37(0, Inject(Reflector)),
|
|
14658
|
+
_ts_param37(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14659
|
+
_ts_metadata58("design:type", Function),
|
|
14660
|
+
_ts_metadata58("design:paramtypes", [
|
|
14614
14661
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
14615
14662
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14616
14663
|
])
|
|
@@ -14619,7 +14666,7 @@ var ROLES_KEY = "roles";
|
|
|
14619
14666
|
var Roles = /* @__PURE__ */ __name((...roles) => SetMetadata(ROLES_KEY, roles), "Roles");
|
|
14620
14667
|
|
|
14621
14668
|
// src/server/guards/roles.guard.ts
|
|
14622
|
-
function
|
|
14669
|
+
function _ts_decorate60(decorators, target, key, desc) {
|
|
14623
14670
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14624
14671
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14625
14672
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14632,19 +14679,19 @@ function _ts_decorate57(decorators, target, key, desc) {
|
|
|
14632
14679
|
}
|
|
14633
14680
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14634
14681
|
}
|
|
14635
|
-
__name(
|
|
14636
|
-
function
|
|
14682
|
+
__name(_ts_decorate60, "_ts_decorate");
|
|
14683
|
+
function _ts_metadata59(metadataKey, metadataValue) {
|
|
14637
14684
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14638
14685
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14639
14686
|
}
|
|
14640
14687
|
}
|
|
14641
|
-
__name(
|
|
14642
|
-
function
|
|
14688
|
+
__name(_ts_metadata59, "_ts_metadata");
|
|
14689
|
+
function _ts_param38(paramIndex, decorator) {
|
|
14643
14690
|
return function(target, key) {
|
|
14644
14691
|
decorator(target, key, paramIndex);
|
|
14645
14692
|
};
|
|
14646
14693
|
}
|
|
14647
|
-
__name(
|
|
14694
|
+
__name(_ts_param38, "_ts_param");
|
|
14648
14695
|
var RolesGuard = class {
|
|
14649
14696
|
static {
|
|
14650
14697
|
__name(this, "RolesGuard");
|
|
@@ -14674,17 +14721,17 @@ var RolesGuard = class {
|
|
|
14674
14721
|
return true;
|
|
14675
14722
|
}
|
|
14676
14723
|
};
|
|
14677
|
-
RolesGuard =
|
|
14724
|
+
RolesGuard = _ts_decorate60([
|
|
14678
14725
|
Injectable(),
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
|
|
14726
|
+
_ts_param38(0, Inject(Reflector)),
|
|
14727
|
+
_ts_param38(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14728
|
+
_ts_metadata59("design:type", Function),
|
|
14729
|
+
_ts_metadata59("design:paramtypes", [
|
|
14683
14730
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
14684
14731
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14685
14732
|
])
|
|
14686
14733
|
], RolesGuard);
|
|
14687
|
-
function
|
|
14734
|
+
function _ts_decorate61(decorators, target, key, desc) {
|
|
14688
14735
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14689
14736
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14690
14737
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14697,7 +14744,7 @@ function _ts_decorate58(decorators, target, key, desc) {
|
|
|
14697
14744
|
}
|
|
14698
14745
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14699
14746
|
}
|
|
14700
|
-
__name(
|
|
14747
|
+
__name(_ts_decorate61, "_ts_decorate");
|
|
14701
14748
|
var NoOpAuthHooks = class {
|
|
14702
14749
|
static {
|
|
14703
14750
|
__name(this, "NoOpAuthHooks");
|
|
@@ -14746,7 +14793,7 @@ var NoOpAuthHooks = class {
|
|
|
14746
14793
|
};
|
|
14747
14794
|
}
|
|
14748
14795
|
};
|
|
14749
|
-
NoOpAuthHooks =
|
|
14796
|
+
NoOpAuthHooks = _ts_decorate61([
|
|
14750
14797
|
Injectable()
|
|
14751
14798
|
], NoOpAuthHooks);
|
|
14752
14799
|
|
|
@@ -14759,7 +14806,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
|
14759
14806
|
var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
|
|
14760
14807
|
|
|
14761
14808
|
// src/server/oauth/oauth.service.ts
|
|
14762
|
-
function
|
|
14809
|
+
function _ts_decorate62(decorators, target, key, desc) {
|
|
14763
14810
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14764
14811
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14765
14812
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14772,19 +14819,19 @@ function _ts_decorate59(decorators, target, key, desc) {
|
|
|
14772
14819
|
}
|
|
14773
14820
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14774
14821
|
}
|
|
14775
|
-
__name(
|
|
14776
|
-
function
|
|
14822
|
+
__name(_ts_decorate62, "_ts_decorate");
|
|
14823
|
+
function _ts_metadata60(metadataKey, metadataValue) {
|
|
14777
14824
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14778
14825
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14779
14826
|
}
|
|
14780
14827
|
}
|
|
14781
|
-
__name(
|
|
14782
|
-
function
|
|
14828
|
+
__name(_ts_metadata60, "_ts_metadata");
|
|
14829
|
+
function _ts_param39(paramIndex, decorator) {
|
|
14783
14830
|
return function(target, key) {
|
|
14784
14831
|
decorator(target, key, paramIndex);
|
|
14785
14832
|
};
|
|
14786
14833
|
}
|
|
14787
|
-
__name(
|
|
14834
|
+
__name(_ts_param39, "_ts_param");
|
|
14788
14835
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
14789
14836
|
function isStoredOAuthState(value) {
|
|
14790
14837
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -14799,11 +14846,11 @@ function base64url(input) {
|
|
|
14799
14846
|
return input.toString("base64url");
|
|
14800
14847
|
}
|
|
14801
14848
|
__name(base64url, "base64url");
|
|
14802
|
-
function
|
|
14849
|
+
function toSafeUser5(user) {
|
|
14803
14850
|
const { passwordHash: _ph, mfaSecret: _ms, mfaRecoveryCodes: _mrc, ...safe } = user;
|
|
14804
14851
|
return safe;
|
|
14805
14852
|
}
|
|
14806
|
-
__name(
|
|
14853
|
+
__name(toSafeUser5, "toSafeUser");
|
|
14807
14854
|
var OAuthService = class _OAuthService {
|
|
14808
14855
|
static {
|
|
14809
14856
|
__name(this, "OAuthService");
|
|
@@ -14952,7 +14999,7 @@ var OAuthService = class _OAuthService {
|
|
|
14952
14999
|
providerId: profile.providerId,
|
|
14953
15000
|
tenantId
|
|
14954
15001
|
});
|
|
14955
|
-
const existingUser = existingAuthUser ?
|
|
15002
|
+
const existingUser = existingAuthUser ? toSafeUser5(existingAuthUser) : null;
|
|
14956
15003
|
const hookContext = {
|
|
14957
15004
|
plane: "dashboard",
|
|
14958
15005
|
tenantId,
|
|
@@ -15027,7 +15074,7 @@ var OAuthService = class _OAuthService {
|
|
|
15027
15074
|
mfaTempToken
|
|
15028
15075
|
};
|
|
15029
15076
|
}
|
|
15030
|
-
const safeUser =
|
|
15077
|
+
const safeUser = toSafeUser5(authUser);
|
|
15031
15078
|
const result = await this.tokenManager.issueTokens(safeUser, ip, userAgent);
|
|
15032
15079
|
if (this.options.sessions.enabled) {
|
|
15033
15080
|
await this.sessionService.createSession({
|
|
@@ -15078,18 +15125,18 @@ var OAuthService = class _OAuthService {
|
|
|
15078
15125
|
return plugin;
|
|
15079
15126
|
}
|
|
15080
15127
|
};
|
|
15081
|
-
OAuthService =
|
|
15128
|
+
OAuthService = _ts_decorate62([
|
|
15082
15129
|
Injectable(),
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
15087
|
-
|
|
15088
|
-
|
|
15089
|
-
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15130
|
+
_ts_param39(0, Inject(OAUTH_PLUGINS)),
|
|
15131
|
+
_ts_param39(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
15132
|
+
_ts_param39(2, Inject(BYMAX_AUTH_HOOKS)),
|
|
15133
|
+
_ts_param39(2, Optional()),
|
|
15134
|
+
_ts_param39(3, Inject(AuthRedisService)),
|
|
15135
|
+
_ts_param39(4, Inject(TokenManagerService)),
|
|
15136
|
+
_ts_param39(5, Inject(SessionService)),
|
|
15137
|
+
_ts_param39(6, Inject(BYMAX_AUTH_OPTIONS)),
|
|
15138
|
+
_ts_metadata60("design:type", Function),
|
|
15139
|
+
_ts_metadata60("design:paramtypes", [
|
|
15093
15140
|
Array,
|
|
15094
15141
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
15095
15142
|
Object,
|
|
@@ -15099,7 +15146,7 @@ OAuthService = _ts_decorate59([
|
|
|
15099
15146
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
15100
15147
|
])
|
|
15101
15148
|
], OAuthService);
|
|
15102
|
-
function
|
|
15149
|
+
function _ts_decorate63(decorators, target, key, desc) {
|
|
15103
15150
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15104
15151
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15105
15152
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15112,13 +15159,13 @@ function _ts_decorate60(decorators, target, key, desc) {
|
|
|
15112
15159
|
}
|
|
15113
15160
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15114
15161
|
}
|
|
15115
|
-
__name(
|
|
15116
|
-
function
|
|
15162
|
+
__name(_ts_decorate63, "_ts_decorate");
|
|
15163
|
+
function _ts_metadata61(metadataKey, metadataValue) {
|
|
15117
15164
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15118
15165
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15119
15166
|
}
|
|
15120
15167
|
}
|
|
15121
|
-
__name(
|
|
15168
|
+
__name(_ts_metadata61, "_ts_metadata");
|
|
15122
15169
|
var OAuthCallbackQueryDto = class {
|
|
15123
15170
|
static {
|
|
15124
15171
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -15217,69 +15264,69 @@ var OAuthCallbackQueryDto = class {
|
|
|
15217
15264
|
*/
|
|
15218
15265
|
hd;
|
|
15219
15266
|
};
|
|
15220
|
-
|
|
15267
|
+
_ts_decorate63([
|
|
15221
15268
|
ValidateIf((query) => query.error === void 0 || query.error === null),
|
|
15222
15269
|
IsOptional(),
|
|
15223
15270
|
IsString(),
|
|
15224
15271
|
IsNotEmpty(),
|
|
15225
15272
|
MaxLength(2048),
|
|
15226
|
-
|
|
15273
|
+
_ts_metadata61("design:type", String)
|
|
15227
15274
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
15228
|
-
|
|
15275
|
+
_ts_decorate63([
|
|
15229
15276
|
IsOptional(),
|
|
15230
15277
|
IsString(),
|
|
15231
15278
|
MaxLength(128),
|
|
15232
|
-
|
|
15279
|
+
_ts_metadata61("design:type", String)
|
|
15233
15280
|
], OAuthCallbackQueryDto.prototype, "error", void 0);
|
|
15234
|
-
|
|
15281
|
+
_ts_decorate63([
|
|
15235
15282
|
IsOptional(),
|
|
15236
15283
|
IsString(),
|
|
15237
15284
|
MaxLength(512),
|
|
15238
|
-
|
|
15285
|
+
_ts_metadata61("design:type", String)
|
|
15239
15286
|
], OAuthCallbackQueryDto.prototype, "error_description", void 0);
|
|
15240
|
-
|
|
15287
|
+
_ts_decorate63([
|
|
15241
15288
|
IsOptional(),
|
|
15242
15289
|
IsString(),
|
|
15243
15290
|
MaxLength(512),
|
|
15244
|
-
|
|
15291
|
+
_ts_metadata61("design:type", String)
|
|
15245
15292
|
], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
|
|
15246
|
-
|
|
15293
|
+
_ts_decorate63([
|
|
15247
15294
|
IsString(),
|
|
15248
15295
|
IsNotEmpty(),
|
|
15249
15296
|
MaxLength(128),
|
|
15250
|
-
|
|
15297
|
+
_ts_metadata61("design:type", String)
|
|
15251
15298
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
15252
|
-
|
|
15299
|
+
_ts_decorate63([
|
|
15253
15300
|
IsOptional(),
|
|
15254
15301
|
IsString(),
|
|
15255
15302
|
MaxLength(512),
|
|
15256
|
-
|
|
15303
|
+
_ts_metadata61("design:type", String)
|
|
15257
15304
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
15258
|
-
|
|
15305
|
+
_ts_decorate63([
|
|
15259
15306
|
IsOptional(),
|
|
15260
15307
|
IsString(),
|
|
15261
15308
|
MaxLength(2048),
|
|
15262
|
-
|
|
15309
|
+
_ts_metadata61("design:type", String)
|
|
15263
15310
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
15264
|
-
|
|
15311
|
+
_ts_decorate63([
|
|
15265
15312
|
IsOptional(),
|
|
15266
15313
|
IsString(),
|
|
15267
15314
|
MaxLength(16),
|
|
15268
|
-
|
|
15315
|
+
_ts_metadata61("design:type", String)
|
|
15269
15316
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
15270
|
-
|
|
15317
|
+
_ts_decorate63([
|
|
15271
15318
|
IsOptional(),
|
|
15272
15319
|
IsString(),
|
|
15273
15320
|
MaxLength(64),
|
|
15274
|
-
|
|
15321
|
+
_ts_metadata61("design:type", String)
|
|
15275
15322
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
15276
|
-
|
|
15323
|
+
_ts_decorate63([
|
|
15277
15324
|
IsOptional(),
|
|
15278
15325
|
IsString(),
|
|
15279
15326
|
MaxLength(253),
|
|
15280
|
-
|
|
15327
|
+
_ts_metadata61("design:type", String)
|
|
15281
15328
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
15282
|
-
function
|
|
15329
|
+
function _ts_decorate64(decorators, target, key, desc) {
|
|
15283
15330
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15284
15331
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15285
15332
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15292,13 +15339,13 @@ function _ts_decorate61(decorators, target, key, desc) {
|
|
|
15292
15339
|
}
|
|
15293
15340
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15294
15341
|
}
|
|
15295
|
-
__name(
|
|
15296
|
-
function
|
|
15342
|
+
__name(_ts_decorate64, "_ts_decorate");
|
|
15343
|
+
function _ts_metadata62(metadataKey, metadataValue) {
|
|
15297
15344
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15298
15345
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15299
15346
|
}
|
|
15300
15347
|
}
|
|
15301
|
-
__name(
|
|
15348
|
+
__name(_ts_metadata62, "_ts_metadata");
|
|
15302
15349
|
var OAuthInitiateQueryDto = class {
|
|
15303
15350
|
static {
|
|
15304
15351
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -15315,7 +15362,7 @@ var OAuthInitiateQueryDto = class {
|
|
|
15315
15362
|
*/
|
|
15316
15363
|
tenantId;
|
|
15317
15364
|
};
|
|
15318
|
-
|
|
15365
|
+
_ts_decorate64([
|
|
15319
15366
|
IsOptional(),
|
|
15320
15367
|
IsString(),
|
|
15321
15368
|
IsNotEmpty(),
|
|
@@ -15323,11 +15370,11 @@ _ts_decorate61([
|
|
|
15323
15370
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
15324
15371
|
message: "tenantId must not contain control characters"
|
|
15325
15372
|
}),
|
|
15326
|
-
|
|
15373
|
+
_ts_metadata62("design:type", String)
|
|
15327
15374
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
15328
15375
|
|
|
15329
15376
|
// src/server/oauth/oauth.controller.ts
|
|
15330
|
-
function
|
|
15377
|
+
function _ts_decorate65(decorators, target, key, desc) {
|
|
15331
15378
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15332
15379
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15333
15380
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15340,19 +15387,19 @@ function _ts_decorate62(decorators, target, key, desc) {
|
|
|
15340
15387
|
}
|
|
15341
15388
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15342
15389
|
}
|
|
15343
|
-
__name(
|
|
15344
|
-
function
|
|
15390
|
+
__name(_ts_decorate65, "_ts_decorate");
|
|
15391
|
+
function _ts_metadata63(metadataKey, metadataValue) {
|
|
15345
15392
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15346
15393
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15347
15394
|
}
|
|
15348
15395
|
}
|
|
15349
|
-
__name(
|
|
15350
|
-
function
|
|
15396
|
+
__name(_ts_metadata63, "_ts_metadata");
|
|
15397
|
+
function _ts_param40(paramIndex, decorator) {
|
|
15351
15398
|
return function(target, key) {
|
|
15352
15399
|
decorator(target, key, paramIndex);
|
|
15353
15400
|
};
|
|
15354
15401
|
}
|
|
15355
|
-
__name(
|
|
15402
|
+
__name(_ts_param40, "_ts_param");
|
|
15356
15403
|
function isOAuthMfaChallenge(result) {
|
|
15357
15404
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
15358
15405
|
}
|
|
@@ -15570,46 +15617,46 @@ var OAuthController = class _OAuthController {
|
|
|
15570
15617
|
});
|
|
15571
15618
|
}
|
|
15572
15619
|
};
|
|
15573
|
-
|
|
15620
|
+
_ts_decorate65([
|
|
15574
15621
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
15575
15622
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
15576
15623
|
Get(":provider"),
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15624
|
+
_ts_param40(0, Param("provider")),
|
|
15625
|
+
_ts_param40(1, Query()),
|
|
15626
|
+
_ts_param40(2, Req()),
|
|
15627
|
+
_ts_param40(3, Res({
|
|
15581
15628
|
passthrough: true
|
|
15582
15629
|
})),
|
|
15583
|
-
|
|
15584
|
-
|
|
15630
|
+
_ts_metadata63("design:type", Function),
|
|
15631
|
+
_ts_metadata63("design:paramtypes", [
|
|
15585
15632
|
String,
|
|
15586
15633
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
15587
15634
|
typeof Request === "undefined" ? Object : Request,
|
|
15588
15635
|
typeof Response === "undefined" ? Object : Response
|
|
15589
15636
|
]),
|
|
15590
|
-
|
|
15637
|
+
_ts_metadata63("design:returntype", Promise)
|
|
15591
15638
|
], OAuthController.prototype, "initiate", null);
|
|
15592
|
-
|
|
15639
|
+
_ts_decorate65([
|
|
15593
15640
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
15594
15641
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
15595
15642
|
HttpCode(HttpStatus.OK),
|
|
15596
15643
|
Get(":provider/callback"),
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15644
|
+
_ts_param40(0, Param("provider")),
|
|
15645
|
+
_ts_param40(1, Query()),
|
|
15646
|
+
_ts_param40(2, Req()),
|
|
15647
|
+
_ts_param40(3, Res({
|
|
15601
15648
|
passthrough: true
|
|
15602
15649
|
})),
|
|
15603
|
-
|
|
15604
|
-
|
|
15650
|
+
_ts_metadata63("design:type", Function),
|
|
15651
|
+
_ts_metadata63("design:paramtypes", [
|
|
15605
15652
|
String,
|
|
15606
15653
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
15607
15654
|
typeof Request === "undefined" ? Object : Request,
|
|
15608
15655
|
typeof Response === "undefined" ? Object : Response
|
|
15609
15656
|
]),
|
|
15610
|
-
|
|
15657
|
+
_ts_metadata63("design:returntype", Promise)
|
|
15611
15658
|
], OAuthController.prototype, "callback", null);
|
|
15612
|
-
OAuthController =
|
|
15659
|
+
OAuthController = _ts_decorate65([
|
|
15613
15660
|
Public(),
|
|
15614
15661
|
SkipMfa(),
|
|
15615
15662
|
UseInterceptors(NoStoreInterceptor),
|
|
@@ -15618,11 +15665,11 @@ OAuthController = _ts_decorate62([
|
|
|
15618
15665
|
UsePipes(createAuthValidationPipe({
|
|
15619
15666
|
forbidUnknownValues: true
|
|
15620
15667
|
})),
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15668
|
+
_ts_param40(0, Inject(OAuthService)),
|
|
15669
|
+
_ts_param40(1, Inject(TokenDeliveryService)),
|
|
15670
|
+
_ts_param40(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
15671
|
+
_ts_metadata63("design:type", Function),
|
|
15672
|
+
_ts_metadata63("design:paramtypes", [
|
|
15626
15673
|
typeof OAuthService === "undefined" ? Object : OAuthService,
|
|
15627
15674
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
15628
15675
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -15761,7 +15808,7 @@ var GoogleOAuthPlugin = class {
|
|
|
15761
15808
|
};
|
|
15762
15809
|
|
|
15763
15810
|
// src/server/oauth/oauth.module.ts
|
|
15764
|
-
function
|
|
15811
|
+
function _ts_decorate66(decorators, target, key, desc) {
|
|
15765
15812
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15766
15813
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15767
15814
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15774,7 +15821,7 @@ function _ts_decorate63(decorators, target, key, desc) {
|
|
|
15774
15821
|
}
|
|
15775
15822
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15776
15823
|
}
|
|
15777
|
-
__name(
|
|
15824
|
+
__name(_ts_decorate66, "_ts_decorate");
|
|
15778
15825
|
function buildOAuthPlugins(options) {
|
|
15779
15826
|
const plugins = [];
|
|
15780
15827
|
if (options.oauth?.google) {
|
|
@@ -15844,7 +15891,7 @@ var OAuthModule = class _OAuthModule {
|
|
|
15844
15891
|
};
|
|
15845
15892
|
}
|
|
15846
15893
|
};
|
|
15847
|
-
OAuthModule =
|
|
15894
|
+
OAuthModule = _ts_decorate66([
|
|
15848
15895
|
Module({})
|
|
15849
15896
|
], OAuthModule);
|
|
15850
15897
|
|
|
@@ -16739,7 +16786,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
|
|
|
16739
16786
|
__name(schemesFor, "schemesFor");
|
|
16740
16787
|
|
|
16741
16788
|
// src/server/openapi/auth-openapi.contributor.ts
|
|
16742
|
-
function
|
|
16789
|
+
function _ts_decorate67(decorators, target, key, desc) {
|
|
16743
16790
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16744
16791
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16745
16792
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16752,19 +16799,19 @@ function _ts_decorate64(decorators, target, key, desc) {
|
|
|
16752
16799
|
}
|
|
16753
16800
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16754
16801
|
}
|
|
16755
|
-
__name(
|
|
16756
|
-
function
|
|
16802
|
+
__name(_ts_decorate67, "_ts_decorate");
|
|
16803
|
+
function _ts_metadata64(metadataKey, metadataValue) {
|
|
16757
16804
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16758
16805
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16759
16806
|
}
|
|
16760
16807
|
}
|
|
16761
|
-
__name(
|
|
16762
|
-
function
|
|
16808
|
+
__name(_ts_metadata64, "_ts_metadata");
|
|
16809
|
+
function _ts_param41(paramIndex, decorator) {
|
|
16763
16810
|
return function(target, key) {
|
|
16764
16811
|
decorator(target, key, paramIndex);
|
|
16765
16812
|
};
|
|
16766
16813
|
}
|
|
16767
|
-
__name(
|
|
16814
|
+
__name(_ts_param41, "_ts_param");
|
|
16768
16815
|
var AuthOpenApiContributor = class {
|
|
16769
16816
|
static {
|
|
16770
16817
|
__name(this, "AuthOpenApiContributor");
|
|
@@ -16784,18 +16831,18 @@ var AuthOpenApiContributor = class {
|
|
|
16784
16831
|
return buildAuthOpenApiFragment(this.options, this.registered);
|
|
16785
16832
|
}
|
|
16786
16833
|
};
|
|
16787
|
-
AuthOpenApiContributor =
|
|
16834
|
+
AuthOpenApiContributor = _ts_decorate67([
|
|
16788
16835
|
Injectable(),
|
|
16789
16836
|
SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
|
|
16790
|
-
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
|
|
16837
|
+
_ts_param41(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
16838
|
+
_ts_param41(1, Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
|
|
16839
|
+
_ts_metadata64("design:type", Function),
|
|
16840
|
+
_ts_metadata64("design:paramtypes", [
|
|
16794
16841
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
16795
16842
|
typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
|
|
16796
16843
|
])
|
|
16797
16844
|
], AuthOpenApiContributor);
|
|
16798
|
-
function
|
|
16845
|
+
function _ts_decorate68(decorators, target, key, desc) {
|
|
16799
16846
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16800
16847
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16801
16848
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16808,19 +16855,19 @@ function _ts_decorate65(decorators, target, key, desc) {
|
|
|
16808
16855
|
}
|
|
16809
16856
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16810
16857
|
}
|
|
16811
|
-
__name(
|
|
16812
|
-
function
|
|
16858
|
+
__name(_ts_decorate68, "_ts_decorate");
|
|
16859
|
+
function _ts_metadata65(metadataKey, metadataValue) {
|
|
16813
16860
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16814
16861
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16815
16862
|
}
|
|
16816
16863
|
}
|
|
16817
|
-
__name(
|
|
16818
|
-
function
|
|
16864
|
+
__name(_ts_metadata65, "_ts_metadata");
|
|
16865
|
+
function _ts_param42(paramIndex, decorator) {
|
|
16819
16866
|
return function(target, key) {
|
|
16820
16867
|
decorator(target, key, paramIndex);
|
|
16821
16868
|
};
|
|
16822
16869
|
}
|
|
16823
|
-
__name(
|
|
16870
|
+
__name(_ts_param42, "_ts_param");
|
|
16824
16871
|
var COMMON_BASE_WORDS = [
|
|
16825
16872
|
// The perennial top of every published list.
|
|
16826
16873
|
"password",
|
|
@@ -17126,16 +17173,16 @@ var CommonPasswordChecker = class {
|
|
|
17126
17173
|
return false;
|
|
17127
17174
|
}
|
|
17128
17175
|
};
|
|
17129
|
-
CommonPasswordChecker =
|
|
17176
|
+
CommonPasswordChecker = _ts_decorate68([
|
|
17130
17177
|
Injectable(),
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17178
|
+
_ts_param42(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
17179
|
+
_ts_param42(0, Optional()),
|
|
17180
|
+
_ts_metadata65("design:type", Function),
|
|
17181
|
+
_ts_metadata65("design:paramtypes", [
|
|
17135
17182
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
17136
17183
|
])
|
|
17137
17184
|
], CommonPasswordChecker);
|
|
17138
|
-
function
|
|
17185
|
+
function _ts_decorate69(decorators, target, key, desc) {
|
|
17139
17186
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17140
17187
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17141
17188
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17148,7 +17195,7 @@ function _ts_decorate66(decorators, target, key, desc) {
|
|
|
17148
17195
|
}
|
|
17149
17196
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17150
17197
|
}
|
|
17151
|
-
__name(
|
|
17198
|
+
__name(_ts_decorate69, "_ts_decorate");
|
|
17152
17199
|
var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
17153
17200
|
static {
|
|
17154
17201
|
__name(this, "NoOpEmailProvider");
|
|
@@ -17183,7 +17230,7 @@ var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
17183
17230
|
this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
|
|
17184
17231
|
}
|
|
17185
17232
|
};
|
|
17186
|
-
NoOpEmailProvider =
|
|
17233
|
+
NoOpEmailProvider = _ts_decorate69([
|
|
17187
17234
|
Injectable()
|
|
17188
17235
|
], NoOpEmailProvider);
|
|
17189
17236
|
|
|
@@ -17197,7 +17244,7 @@ var SystemApiKeyClock = class {
|
|
|
17197
17244
|
return /* @__PURE__ */ new Date();
|
|
17198
17245
|
}
|
|
17199
17246
|
};
|
|
17200
|
-
function
|
|
17247
|
+
function _ts_decorate70(decorators, target, key, desc) {
|
|
17201
17248
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17202
17249
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17203
17250
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17210,19 +17257,19 @@ function _ts_decorate67(decorators, target, key, desc) {
|
|
|
17210
17257
|
}
|
|
17211
17258
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17212
17259
|
}
|
|
17213
|
-
__name(
|
|
17214
|
-
function
|
|
17260
|
+
__name(_ts_decorate70, "_ts_decorate");
|
|
17261
|
+
function _ts_metadata66(metadataKey, metadataValue) {
|
|
17215
17262
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17216
17263
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17217
17264
|
}
|
|
17218
17265
|
}
|
|
17219
|
-
__name(
|
|
17220
|
-
function
|
|
17266
|
+
__name(_ts_metadata66, "_ts_metadata");
|
|
17267
|
+
function _ts_param43(paramIndex, decorator) {
|
|
17221
17268
|
return function(target, key) {
|
|
17222
17269
|
decorator(target, key, paramIndex);
|
|
17223
17270
|
};
|
|
17224
17271
|
}
|
|
17225
|
-
__name(
|
|
17272
|
+
__name(_ts_param43, "_ts_param");
|
|
17226
17273
|
var ApiKeyScopeAuditService = class {
|
|
17227
17274
|
static {
|
|
17228
17275
|
__name(this, "ApiKeyScopeAuditService");
|
|
@@ -17265,21 +17312,21 @@ var ApiKeyScopeAuditService = class {
|
|
|
17265
17312
|
}
|
|
17266
17313
|
}
|
|
17267
17314
|
};
|
|
17268
|
-
ApiKeyScopeAuditService =
|
|
17315
|
+
ApiKeyScopeAuditService = _ts_decorate70([
|
|
17269
17316
|
Injectable(),
|
|
17270
|
-
|
|
17271
|
-
|
|
17272
|
-
|
|
17273
|
-
|
|
17274
|
-
|
|
17275
|
-
|
|
17317
|
+
_ts_param43(0, Inject(DiscoveryService)),
|
|
17318
|
+
_ts_param43(1, Inject(MetadataScanner)),
|
|
17319
|
+
_ts_param43(2, Inject(Reflector)),
|
|
17320
|
+
_ts_param43(3, Inject(BYMAX_AUTH_OPTIONS)),
|
|
17321
|
+
_ts_metadata66("design:type", Function),
|
|
17322
|
+
_ts_metadata66("design:paramtypes", [
|
|
17276
17323
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
17277
17324
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
17278
17325
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
17279
17326
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
17280
17327
|
])
|
|
17281
17328
|
], ApiKeyScopeAuditService);
|
|
17282
|
-
function
|
|
17329
|
+
function _ts_decorate71(decorators, target, key, desc) {
|
|
17283
17330
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17284
17331
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17285
17332
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17292,19 +17339,19 @@ function _ts_decorate68(decorators, target, key, desc) {
|
|
|
17292
17339
|
}
|
|
17293
17340
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17294
17341
|
}
|
|
17295
|
-
__name(
|
|
17296
|
-
function
|
|
17342
|
+
__name(_ts_decorate71, "_ts_decorate");
|
|
17343
|
+
function _ts_metadata67(metadataKey, metadataValue) {
|
|
17297
17344
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17298
17345
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17299
17346
|
}
|
|
17300
17347
|
}
|
|
17301
|
-
__name(
|
|
17302
|
-
function
|
|
17348
|
+
__name(_ts_metadata67, "_ts_metadata");
|
|
17349
|
+
function _ts_param44(paramIndex, decorator) {
|
|
17303
17350
|
return function(target, key) {
|
|
17304
17351
|
decorator(target, key, paramIndex);
|
|
17305
17352
|
};
|
|
17306
17353
|
}
|
|
17307
|
-
__name(
|
|
17354
|
+
__name(_ts_param44, "_ts_param");
|
|
17308
17355
|
var API_KEY_MAX_LABEL_LENGTH = 128;
|
|
17309
17356
|
var API_KEY_MAX_OVERLAP_SECONDS = 2592e3;
|
|
17310
17357
|
var CONTROL_CHARACTERS = /[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u;
|
|
@@ -17365,6 +17412,11 @@ var ApiKeyService = class {
|
|
|
17365
17412
|
* The new key is issued first and the old one retired second, so a failure between the two
|
|
17366
17413
|
* leaves both valid — the safe direction — rather than neither.
|
|
17367
17414
|
*
|
|
17415
|
+
* With an overlap the old key's deadline is lowered through the repository's optional
|
|
17416
|
+
* `limitExpiry`, an atomic minimum, so concurrent rotations of one key cannot push a shorter
|
|
17417
|
+
* deadline back. A repository without it gets a read followed by `setExpiry`, which two
|
|
17418
|
+
* rotations of the same key can interleave; such a host must serialize rotation per key.
|
|
17419
|
+
*
|
|
17368
17420
|
* @param id - The active key to replace.
|
|
17369
17421
|
* @param input - The overlap and an optional expiry for the new key.
|
|
17370
17422
|
* @returns The new key, plaintext once.
|
|
@@ -17394,11 +17446,15 @@ var ApiKeyService = class {
|
|
|
17394
17446
|
await this.repository.markRevoked(old.id, now);
|
|
17395
17447
|
} else {
|
|
17396
17448
|
const retireAt = new Date(now.getTime() + overlap * 1e3);
|
|
17397
|
-
|
|
17398
|
-
|
|
17399
|
-
|
|
17400
|
-
|
|
17401
|
-
|
|
17449
|
+
if (this.repository.limitExpiry !== void 0) {
|
|
17450
|
+
await this.repository.limitExpiry(old.id, retireAt);
|
|
17451
|
+
} else {
|
|
17452
|
+
const sooner = (
|
|
17453
|
+
// Stryker disable next-line EqualityOperator: at equal instants both arms yield a Date of the same time, so `<` and `<=` store the same expiry
|
|
17454
|
+
old.expiresAt !== null && old.expiresAt.getTime() < retireAt.getTime() ? old.expiresAt : retireAt
|
|
17455
|
+
);
|
|
17456
|
+
await this.repository.setExpiry(old.id, sooner);
|
|
17457
|
+
}
|
|
17402
17458
|
}
|
|
17403
17459
|
return issued;
|
|
17404
17460
|
}
|
|
@@ -17433,13 +17489,13 @@ var ApiKeyService = class {
|
|
|
17433
17489
|
return value;
|
|
17434
17490
|
}
|
|
17435
17491
|
};
|
|
17436
|
-
ApiKeyService =
|
|
17492
|
+
ApiKeyService = _ts_decorate71([
|
|
17437
17493
|
Injectable(),
|
|
17438
|
-
|
|
17439
|
-
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
|
|
17494
|
+
_ts_param44(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
17495
|
+
_ts_param44(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
17496
|
+
_ts_param44(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
17497
|
+
_ts_metadata67("design:type", Function),
|
|
17498
|
+
_ts_metadata67("design:paramtypes", [
|
|
17443
17499
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
17444
17500
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
17445
17501
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -17521,7 +17577,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
|
|
|
17521
17577
|
__name(assertTenantBinding, "assertTenantBinding");
|
|
17522
17578
|
|
|
17523
17579
|
// src/server/services/auth-token-verifier.service.ts
|
|
17524
|
-
function
|
|
17580
|
+
function _ts_decorate72(decorators, target, key, desc) {
|
|
17525
17581
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17526
17582
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17527
17583
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17534,19 +17590,19 @@ function _ts_decorate69(decorators, target, key, desc) {
|
|
|
17534
17590
|
}
|
|
17535
17591
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17536
17592
|
}
|
|
17537
|
-
__name(
|
|
17538
|
-
function
|
|
17593
|
+
__name(_ts_decorate72, "_ts_decorate");
|
|
17594
|
+
function _ts_metadata68(metadataKey, metadataValue) {
|
|
17539
17595
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17540
17596
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17541
17597
|
}
|
|
17542
17598
|
}
|
|
17543
|
-
__name(
|
|
17544
|
-
function
|
|
17599
|
+
__name(_ts_metadata68, "_ts_metadata");
|
|
17600
|
+
function _ts_param45(paramIndex, decorator) {
|
|
17545
17601
|
return function(target, key) {
|
|
17546
17602
|
decorator(target, key, paramIndex);
|
|
17547
17603
|
};
|
|
17548
17604
|
}
|
|
17549
|
-
__name(
|
|
17605
|
+
__name(_ts_param45, "_ts_param");
|
|
17550
17606
|
var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
17551
17607
|
static {
|
|
17552
17608
|
__name(this, "AuthTokenVerifierService");
|
|
@@ -17730,14 +17786,14 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
17730
17786
|
}
|
|
17731
17787
|
}
|
|
17732
17788
|
};
|
|
17733
|
-
AuthTokenVerifierService =
|
|
17789
|
+
AuthTokenVerifierService = _ts_decorate72([
|
|
17734
17790
|
Injectable(),
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17791
|
+
_ts_param45(0, Inject(JwtService)),
|
|
17792
|
+
_ts_param45(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
17793
|
+
_ts_param45(2, Inject(AuthRevocationService)),
|
|
17794
|
+
_ts_param45(3, Inject(AccountStatusService)),
|
|
17795
|
+
_ts_metadata68("design:type", Function),
|
|
17796
|
+
_ts_metadata68("design:paramtypes", [
|
|
17741
17797
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
17742
17798
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
17743
17799
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
@@ -17746,7 +17802,7 @@ AuthTokenVerifierService = _ts_decorate69([
|
|
|
17746
17802
|
], AuthTokenVerifierService);
|
|
17747
17803
|
|
|
17748
17804
|
// src/server/bymax-auth.module.ts
|
|
17749
|
-
function
|
|
17805
|
+
function _ts_decorate73(decorators, target, key, desc) {
|
|
17750
17806
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17751
17807
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17752
17808
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17759,7 +17815,7 @@ function _ts_decorate70(decorators, target, key, desc) {
|
|
|
17759
17815
|
}
|
|
17760
17816
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17761
17817
|
}
|
|
17762
|
-
__name(
|
|
17818
|
+
__name(_ts_decorate73, "_ts_decorate");
|
|
17763
17819
|
function hasProviderToken(providers, token) {
|
|
17764
17820
|
return providers.some((p) => {
|
|
17765
17821
|
if (typeof p === "function") return false;
|
|
@@ -18010,6 +18066,11 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
18010
18066
|
TokenDeliveryService,
|
|
18011
18067
|
WsTicketService,
|
|
18012
18068
|
BruteForceService,
|
|
18069
|
+
// Registered unconditionally: it depends only on services that are always present, and
|
|
18070
|
+
// it is the one place a caller re-proves the password before a sensitive change.
|
|
18071
|
+
MfaFlowLockoutService,
|
|
18072
|
+
MfaRecordService,
|
|
18073
|
+
ReauthenticationService,
|
|
18013
18074
|
OtpService,
|
|
18014
18075
|
// SessionService is always registered (not gated on includeSessions) because
|
|
18015
18076
|
// AuthService.login() and AuthService.refresh() call session methods. Registering
|
|
@@ -18063,6 +18124,9 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
18063
18124
|
// Host-app modules that extend the auth flow (e.g. custom logout logic) can
|
|
18064
18125
|
// inject SessionService without re-registering it.
|
|
18065
18126
|
SessionService,
|
|
18127
|
+
// Export ReauthenticationService so a host module can guard its own destructive routes
|
|
18128
|
+
// with the same password check and lockout counter the library uses.
|
|
18129
|
+
ReauthenticationService,
|
|
18066
18130
|
// Export MFA components when enabled — allows host-app modules to inject
|
|
18067
18131
|
// MfaService and apply MfaRequiredGuard without re-registering them.
|
|
18068
18132
|
// Spreads mfaProviders directly so providers and exports always stay in sync.
|
|
@@ -18151,7 +18215,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
18151
18215
|
};
|
|
18152
18216
|
}
|
|
18153
18217
|
};
|
|
18154
|
-
BymaxAuthModule =
|
|
18218
|
+
BymaxAuthModule = _ts_decorate73([
|
|
18155
18219
|
Module({})
|
|
18156
18220
|
], BymaxAuthModule);
|
|
18157
18221
|
|
|
@@ -18479,7 +18543,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
18479
18543
|
}
|
|
18480
18544
|
}
|
|
18481
18545
|
};
|
|
18482
|
-
function
|
|
18546
|
+
function _ts_decorate74(decorators, target, key, desc) {
|
|
18483
18547
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18484
18548
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18485
18549
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18492,13 +18556,13 @@ function _ts_decorate71(decorators, target, key, desc) {
|
|
|
18492
18556
|
}
|
|
18493
18557
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18494
18558
|
}
|
|
18495
|
-
__name(
|
|
18496
|
-
function
|
|
18559
|
+
__name(_ts_decorate74, "_ts_decorate");
|
|
18560
|
+
function _ts_metadata69(metadataKey, metadataValue) {
|
|
18497
18561
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18498
18562
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18499
18563
|
}
|
|
18500
18564
|
}
|
|
18501
|
-
__name(
|
|
18565
|
+
__name(_ts_metadata69, "_ts_metadata");
|
|
18502
18566
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
18503
18567
|
var PREFIX_LENGTH = 5;
|
|
18504
18568
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -18555,10 +18619,10 @@ var HibpBreachChecker = class _HibpBreachChecker {
|
|
|
18555
18619
|
}
|
|
18556
18620
|
}
|
|
18557
18621
|
};
|
|
18558
|
-
HibpBreachChecker =
|
|
18622
|
+
HibpBreachChecker = _ts_decorate74([
|
|
18559
18623
|
Injectable(),
|
|
18560
|
-
|
|
18561
|
-
|
|
18624
|
+
_ts_metadata69("design:type", Function),
|
|
18625
|
+
_ts_metadata69("design:paramtypes", [
|
|
18562
18626
|
Number
|
|
18563
18627
|
])
|
|
18564
18628
|
], HibpBreachChecker);
|
|
@@ -18571,10 +18635,10 @@ var AllowAllBreachChecker = class {
|
|
|
18571
18635
|
return false;
|
|
18572
18636
|
}
|
|
18573
18637
|
};
|
|
18574
|
-
AllowAllBreachChecker =
|
|
18638
|
+
AllowAllBreachChecker = _ts_decorate74([
|
|
18575
18639
|
Injectable()
|
|
18576
18640
|
], AllowAllBreachChecker);
|
|
18577
|
-
function
|
|
18641
|
+
function _ts_decorate75(decorators, target, key, desc) {
|
|
18578
18642
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18579
18643
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18580
18644
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18587,7 +18651,7 @@ function _ts_decorate72(decorators, target, key, desc) {
|
|
|
18587
18651
|
}
|
|
18588
18652
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18589
18653
|
}
|
|
18590
|
-
__name(
|
|
18654
|
+
__name(_ts_decorate75, "_ts_decorate");
|
|
18591
18655
|
var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
18592
18656
|
static {
|
|
18593
18657
|
__name(this, "OptionalAuthGuard");
|
|
@@ -18602,10 +18666,10 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
|
18602
18666
|
return super.canActivate(context);
|
|
18603
18667
|
}
|
|
18604
18668
|
};
|
|
18605
|
-
OptionalAuthGuard =
|
|
18669
|
+
OptionalAuthGuard = _ts_decorate75([
|
|
18606
18670
|
Injectable()
|
|
18607
18671
|
], OptionalAuthGuard);
|
|
18608
|
-
function
|
|
18672
|
+
function _ts_decorate76(decorators, target, key, desc) {
|
|
18609
18673
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18610
18674
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18611
18675
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18618,19 +18682,19 @@ function _ts_decorate73(decorators, target, key, desc) {
|
|
|
18618
18682
|
}
|
|
18619
18683
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18620
18684
|
}
|
|
18621
|
-
__name(
|
|
18622
|
-
function
|
|
18685
|
+
__name(_ts_decorate76, "_ts_decorate");
|
|
18686
|
+
function _ts_metadata70(metadataKey, metadataValue) {
|
|
18623
18687
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18624
18688
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18625
18689
|
}
|
|
18626
18690
|
}
|
|
18627
|
-
__name(
|
|
18628
|
-
function
|
|
18691
|
+
__name(_ts_metadata70, "_ts_metadata");
|
|
18692
|
+
function _ts_param46(paramIndex, decorator) {
|
|
18629
18693
|
return function(target, key) {
|
|
18630
18694
|
decorator(target, key, paramIndex);
|
|
18631
18695
|
};
|
|
18632
18696
|
}
|
|
18633
|
-
__name(
|
|
18697
|
+
__name(_ts_param46, "_ts_param");
|
|
18634
18698
|
var SelfOrAdminGuard = class {
|
|
18635
18699
|
static {
|
|
18636
18700
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -18644,6 +18708,9 @@ var SelfOrAdminGuard = class {
|
|
|
18644
18708
|
if (request.user == null) {
|
|
18645
18709
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
18646
18710
|
}
|
|
18711
|
+
if (!capturesOnlyTokenTenant(request.params, request.user.tenantId)) {
|
|
18712
|
+
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
18713
|
+
}
|
|
18647
18714
|
const rawParam = request.params["userId"] ?? request.params["id"];
|
|
18648
18715
|
if (rawParam === void 0) {
|
|
18649
18716
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
@@ -18652,6 +18719,9 @@ var SelfOrAdminGuard = class {
|
|
|
18652
18719
|
if (paramValue === void 0) {
|
|
18653
18720
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
18654
18721
|
}
|
|
18722
|
+
if (paramValue === "" || paramValue.includes("/")) {
|
|
18723
|
+
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
18724
|
+
}
|
|
18655
18725
|
if (isHexLooking(paramValue) && !STRICT_SHA256_RE.test(paramValue)) {
|
|
18656
18726
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
18657
18727
|
}
|
|
@@ -18660,14 +18730,23 @@ var SelfOrAdminGuard = class {
|
|
|
18660
18730
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
18661
18731
|
}
|
|
18662
18732
|
};
|
|
18663
|
-
SelfOrAdminGuard =
|
|
18733
|
+
SelfOrAdminGuard = _ts_decorate76([
|
|
18664
18734
|
Injectable(),
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18735
|
+
_ts_param46(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
18736
|
+
_ts_metadata70("design:type", Function),
|
|
18737
|
+
_ts_metadata70("design:paramtypes", [
|
|
18668
18738
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
18669
18739
|
])
|
|
18670
18740
|
], SelfOrAdminGuard);
|
|
18741
|
+
function capturesOnlyTokenTenant(params, tokenTenant) {
|
|
18742
|
+
const captures = [
|
|
18743
|
+
params.tenantId,
|
|
18744
|
+
params.tenant_id,
|
|
18745
|
+
params.tenant
|
|
18746
|
+
];
|
|
18747
|
+
return captures.every((captured) => captured === void 0 || captured !== "" && captured === tokenTenant);
|
|
18748
|
+
}
|
|
18749
|
+
__name(capturesOnlyTokenTenant, "capturesOnlyTokenTenant");
|
|
18671
18750
|
var STRICT_SHA256_RE = /^[a-f0-9]{64}$/;
|
|
18672
18751
|
function resolveParamString(param) {
|
|
18673
18752
|
return typeof param === "string" ? param : void 0;
|
|
@@ -18677,7 +18756,7 @@ function isHexLooking(value) {
|
|
|
18677
18756
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
18678
18757
|
}
|
|
18679
18758
|
__name(isHexLooking, "isHexLooking");
|
|
18680
|
-
function
|
|
18759
|
+
function _ts_decorate77(decorators, target, key, desc) {
|
|
18681
18760
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18682
18761
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18683
18762
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18690,19 +18769,19 @@ function _ts_decorate74(decorators, target, key, desc) {
|
|
|
18690
18769
|
}
|
|
18691
18770
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18692
18771
|
}
|
|
18693
|
-
__name(
|
|
18694
|
-
function
|
|
18772
|
+
__name(_ts_decorate77, "_ts_decorate");
|
|
18773
|
+
function _ts_metadata71(metadataKey, metadataValue) {
|
|
18695
18774
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18696
18775
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18697
18776
|
}
|
|
18698
18777
|
}
|
|
18699
|
-
__name(
|
|
18700
|
-
function
|
|
18778
|
+
__name(_ts_metadata71, "_ts_metadata");
|
|
18779
|
+
function _ts_param47(paramIndex, decorator) {
|
|
18701
18780
|
return function(target, key) {
|
|
18702
18781
|
decorator(target, key, paramIndex);
|
|
18703
18782
|
};
|
|
18704
18783
|
}
|
|
18705
|
-
__name(
|
|
18784
|
+
__name(_ts_param47, "_ts_param");
|
|
18706
18785
|
var WsJwtGuard = class {
|
|
18707
18786
|
static {
|
|
18708
18787
|
__name(this, "WsJwtGuard");
|
|
@@ -18766,14 +18845,14 @@ var WsJwtGuard = class {
|
|
|
18766
18845
|
return true;
|
|
18767
18846
|
}
|
|
18768
18847
|
};
|
|
18769
|
-
WsJwtGuard =
|
|
18848
|
+
WsJwtGuard = _ts_decorate77([
|
|
18770
18849
|
Injectable(),
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18850
|
+
_ts_param47(0, Inject(JwtService)),
|
|
18851
|
+
_ts_param47(1, Inject(AuthRevocationService)),
|
|
18852
|
+
_ts_param47(2, Inject(WsTicketService)),
|
|
18853
|
+
_ts_param47(3, Inject(BYMAX_AUTH_OPTIONS)),
|
|
18854
|
+
_ts_metadata71("design:type", Function),
|
|
18855
|
+
_ts_metadata71("design:paramtypes", [
|
|
18777
18856
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
18778
18857
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
18779
18858
|
typeof WsTicketService === "undefined" ? Object : WsTicketService,
|
|
@@ -18813,7 +18892,7 @@ function bindingInput(handshake) {
|
|
|
18813
18892
|
};
|
|
18814
18893
|
}
|
|
18815
18894
|
__name(bindingInput, "bindingInput");
|
|
18816
|
-
function
|
|
18895
|
+
function _ts_decorate78(decorators, target, key, desc) {
|
|
18817
18896
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18818
18897
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18819
18898
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18826,7 +18905,7 @@ function _ts_decorate75(decorators, target, key, desc) {
|
|
|
18826
18905
|
}
|
|
18827
18906
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18828
18907
|
}
|
|
18829
|
-
__name(
|
|
18908
|
+
__name(_ts_decorate78, "_ts_decorate");
|
|
18830
18909
|
function isAuthEnvelope(body) {
|
|
18831
18910
|
if (typeof body !== "object" || body === null) return false;
|
|
18832
18911
|
const error = body.error;
|
|
@@ -18945,10 +19024,10 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
18945
19024
|
});
|
|
18946
19025
|
}
|
|
18947
19026
|
};
|
|
18948
|
-
AuthExceptionFilter =
|
|
19027
|
+
AuthExceptionFilter = _ts_decorate78([
|
|
18949
19028
|
Catch()
|
|
18950
19029
|
], AuthExceptionFilter);
|
|
18951
|
-
function
|
|
19030
|
+
function _ts_decorate79(decorators, target, key, desc) {
|
|
18952
19031
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18953
19032
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18954
19033
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18961,7 +19040,7 @@ function _ts_decorate76(decorators, target, key, desc) {
|
|
|
18961
19040
|
}
|
|
18962
19041
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18963
19042
|
}
|
|
18964
|
-
__name(
|
|
19043
|
+
__name(_ts_decorate79, "_ts_decorate");
|
|
18965
19044
|
function isEmittingClient(client) {
|
|
18966
19045
|
return typeof client?.emit === "function";
|
|
18967
19046
|
}
|
|
@@ -19005,10 +19084,10 @@ var WsAuthExceptionFilter = class _WsAuthExceptionFilter {
|
|
|
19005
19084
|
this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
|
|
19006
19085
|
}
|
|
19007
19086
|
};
|
|
19008
|
-
WsAuthExceptionFilter =
|
|
19087
|
+
WsAuthExceptionFilter = _ts_decorate79([
|
|
19009
19088
|
Catch(AuthException)
|
|
19010
19089
|
], WsAuthExceptionFilter);
|
|
19011
19090
|
var ServiceKey = /* @__PURE__ */ __name((...scopes) => applyDecorators(SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), UseGuards(ApiKeyGuard)), "ServiceKey");
|
|
19012
19091
|
var CurrentApiKey = createParamDecorator((_data, ctx) => ctx.switchToHttp().getRequest().apiKey);
|
|
19013
19092
|
|
|
19014
|
-
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
19093
|
+
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|