@bymax-one/nest-auth 1.2.0 → 1.3.1
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 +124 -1
- package/README.md +72 -35
- package/dist/server/index.cjs +1275 -1001
- package/dist/server/index.d.cts +311 -41
- package/dist/server/index.d.ts +311 -41
- package/dist/server/index.mjs +1276 -1003
- package/package.json +2 -2
package/dist/server/index.cjs
CHANGED
|
@@ -1186,6 +1186,7 @@ _ts_decorate([
|
|
|
1186
1186
|
_ts_metadata("design:type", String)
|
|
1187
1187
|
], LoginDto.prototype, "password", void 0);
|
|
1188
1188
|
_ts_decorate([
|
|
1189
|
+
classValidator.IsOptional(),
|
|
1189
1190
|
classValidator.IsString(),
|
|
1190
1191
|
classValidator.IsNotEmpty(),
|
|
1191
1192
|
classValidator.MaxLength(128),
|
|
@@ -1267,6 +1268,7 @@ _ts_decorate2([
|
|
|
1267
1268
|
_ts_metadata2("design:type", String)
|
|
1268
1269
|
], RegisterDto.prototype, "name", void 0);
|
|
1269
1270
|
_ts_decorate2([
|
|
1271
|
+
classValidator.IsOptional(),
|
|
1270
1272
|
classValidator.IsString(),
|
|
1271
1273
|
classValidator.IsNotEmpty(),
|
|
1272
1274
|
classValidator.MaxLength(128),
|
|
@@ -1307,6 +1309,7 @@ _ts_decorate3([
|
|
|
1307
1309
|
_ts_metadata3("design:type", String)
|
|
1308
1310
|
], ResendVerificationDto.prototype, "email", void 0);
|
|
1309
1311
|
_ts_decorate3([
|
|
1312
|
+
classValidator.IsOptional(),
|
|
1310
1313
|
classValidator.IsString(),
|
|
1311
1314
|
classValidator.IsNotEmpty(),
|
|
1312
1315
|
classValidator.MaxLength(128),
|
|
@@ -1358,6 +1361,7 @@ _ts_decorate4([
|
|
|
1358
1361
|
_ts_metadata4("design:type", String)
|
|
1359
1362
|
], VerifyEmailDto.prototype, "otp", void 0);
|
|
1360
1363
|
_ts_decorate4([
|
|
1364
|
+
classValidator.IsOptional(),
|
|
1361
1365
|
classValidator.IsString(),
|
|
1362
1366
|
classValidator.IsNotEmpty(),
|
|
1363
1367
|
classValidator.MaxLength(128),
|
|
@@ -2684,6 +2688,100 @@ exports.AuthRateLimitGuard = _ts_decorate6([
|
|
|
2684
2688
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
2685
2689
|
])
|
|
2686
2690
|
], exports.AuthRateLimitGuard);
|
|
2691
|
+
|
|
2692
|
+
// src/server/utils/assert-not-blocked.ts
|
|
2693
|
+
var BLOCKED_STATUS_CODES = /* @__PURE__ */ new Map([
|
|
2694
|
+
[
|
|
2695
|
+
"banned",
|
|
2696
|
+
AUTH_ERROR_CODES.ACCOUNT_BANNED
|
|
2697
|
+
],
|
|
2698
|
+
[
|
|
2699
|
+
"suspended",
|
|
2700
|
+
AUTH_ERROR_CODES.ACCOUNT_SUSPENDED
|
|
2701
|
+
],
|
|
2702
|
+
[
|
|
2703
|
+
"pending",
|
|
2704
|
+
AUTH_ERROR_CODES.PENDING_APPROVAL
|
|
2705
|
+
],
|
|
2706
|
+
[
|
|
2707
|
+
"pending_approval",
|
|
2708
|
+
AUTH_ERROR_CODES.PENDING_APPROVAL
|
|
2709
|
+
]
|
|
2710
|
+
]);
|
|
2711
|
+
function assertNotBlocked(status, blockedStatuses) {
|
|
2712
|
+
const canonical = status.toLowerCase();
|
|
2713
|
+
if (!blockedStatuses.some((blocked) => blocked.toLowerCase() === canonical)) {
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
throw new AuthException(BLOCKED_STATUS_CODES.get(canonical) ?? AUTH_ERROR_CODES.ACCOUNT_INACTIVE, 403);
|
|
2717
|
+
}
|
|
2718
|
+
__name(assertNotBlocked, "assertNotBlocked");
|
|
2719
|
+
|
|
2720
|
+
// src/server/utils/stamped-epoch.ts
|
|
2721
|
+
function readStampedEpoch(payload) {
|
|
2722
|
+
const { epoch } = payload;
|
|
2723
|
+
return typeof epoch === "number" && Number.isInteger(epoch) ? Math.max(0, epoch) : 0;
|
|
2724
|
+
}
|
|
2725
|
+
__name(readStampedEpoch, "readStampedEpoch");
|
|
2726
|
+
|
|
2727
|
+
// src/server/utils/sanitize-headers.ts
|
|
2728
|
+
var BLOCKED_HEADERS = /* @__PURE__ */ new Set([
|
|
2729
|
+
"authorization",
|
|
2730
|
+
"cookie",
|
|
2731
|
+
"proxy-authorization",
|
|
2732
|
+
"www-authenticate",
|
|
2733
|
+
// Stryker disable next-line StringLiteral: 'x-api-key' is also matched by SENSITIVE_HEADER_PATTERN (ends with -key), so removing it from the Set does not change the filter result
|
|
2734
|
+
"x-api-key",
|
|
2735
|
+
// Stryker disable next-line StringLiteral: 'x-auth-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
|
|
2736
|
+
"x-auth-token",
|
|
2737
|
+
// Stryker disable next-line StringLiteral: 'x-csrf-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
|
|
2738
|
+
"x-csrf-token",
|
|
2739
|
+
"x-session-id",
|
|
2740
|
+
"x-forwarded-for",
|
|
2741
|
+
"x-forwarded-host",
|
|
2742
|
+
"x-real-ip",
|
|
2743
|
+
"x-original-forwarded-for",
|
|
2744
|
+
"cf-connecting-ip",
|
|
2745
|
+
"true-client-ip",
|
|
2746
|
+
"x-cluster-client-ip"
|
|
2747
|
+
]);
|
|
2748
|
+
var SENSITIVE_HEADER_PATTERN = /^x-.*-(token|secret|key|password|credential|auth|bearer|signature|hmac)$/i;
|
|
2749
|
+
function sanitizeHeaders(headers) {
|
|
2750
|
+
return Object.fromEntries(Object.entries(headers).map(([key, value]) => [
|
|
2751
|
+
key.toLowerCase(),
|
|
2752
|
+
value
|
|
2753
|
+
]).filter(([key]) => !BLOCKED_HEADERS.has(key) && !SENSITIVE_HEADER_PATTERN.test(key)));
|
|
2754
|
+
}
|
|
2755
|
+
__name(sanitizeHeaders, "sanitizeHeaders");
|
|
2756
|
+
function createEmptyHookContext() {
|
|
2757
|
+
return {
|
|
2758
|
+
ip: "",
|
|
2759
|
+
userAgent: "",
|
|
2760
|
+
sanitizedHeaders: {}
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
__name(createEmptyHookContext, "createEmptyHookContext");
|
|
2764
|
+
|
|
2765
|
+
// src/server/utils/sleep.ts
|
|
2766
|
+
var MAX_SLEEP_MS = 1e4;
|
|
2767
|
+
function sleep(ms) {
|
|
2768
|
+
const clamped = Math.min(Math.max(0, ms), MAX_SLEEP_MS);
|
|
2769
|
+
return new Promise((resolve) => {
|
|
2770
|
+
setTimeout(resolve, clamped);
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
__name(sleep, "sleep");
|
|
2774
|
+
|
|
2775
|
+
// src/server/utils/roles.util.ts
|
|
2776
|
+
function hasRole(userRole, requiredRole, hierarchy) {
|
|
2777
|
+
if (userRole === requiredRole) return true;
|
|
2778
|
+
if (!Object.hasOwn(hierarchy, userRole)) return false;
|
|
2779
|
+
const inherited = hierarchy[userRole];
|
|
2780
|
+
return inherited !== void 0 && inherited.includes(requiredRole);
|
|
2781
|
+
}
|
|
2782
|
+
__name(hasRole, "hasRole");
|
|
2783
|
+
|
|
2784
|
+
// src/server/services/auth-revocation.service.ts
|
|
2687
2785
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
2688
2786
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2689
2787
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2701,6 +2799,58 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
2701
2799
|
};
|
|
2702
2800
|
}
|
|
2703
2801
|
__name(_ts_param3, "_ts_param");
|
|
2802
|
+
exports.AuthRevocationService = class AuthRevocationService {
|
|
2803
|
+
static {
|
|
2804
|
+
__name(this, "AuthRevocationService");
|
|
2805
|
+
}
|
|
2806
|
+
redis;
|
|
2807
|
+
/**
|
|
2808
|
+
* @param redis - The auth module's Redis service, holding both revocation channels.
|
|
2809
|
+
*/
|
|
2810
|
+
constructor(redis) {
|
|
2811
|
+
this.redis = redis;
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Whether a verified access token has been revoked.
|
|
2815
|
+
*
|
|
2816
|
+
* @param payload - The verified token's `jti`, `sub` and stamped `epoch`.
|
|
2817
|
+
* @param kind - Which plane the token belongs to; selects the epoch namespace, defaulting to the
|
|
2818
|
+
* dashboard plane an ordinary user token uses. The per-token blacklist is shared across planes.
|
|
2819
|
+
* @returns `true` when the token is on the blacklist or predates the user's current epoch.
|
|
2820
|
+
*/
|
|
2821
|
+
async isAccessTokenRevoked(payload, kind = "dashboard") {
|
|
2822
|
+
if (await this.redis.get(`rv:${payload.jti}`) !== null) {
|
|
2823
|
+
return true;
|
|
2824
|
+
}
|
|
2825
|
+
const epoch = await this.redis.getUserTokenEpoch(payload.sub, kind);
|
|
2826
|
+
return readStampedEpoch(payload) < epoch;
|
|
2827
|
+
}
|
|
2828
|
+
};
|
|
2829
|
+
exports.AuthRevocationService = _ts_decorate7([
|
|
2830
|
+
common.Injectable(),
|
|
2831
|
+
_ts_param3(0, common.Inject(AuthRedisService)),
|
|
2832
|
+
_ts_metadata7("design:type", Function),
|
|
2833
|
+
_ts_metadata7("design:paramtypes", [
|
|
2834
|
+
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
2835
|
+
])
|
|
2836
|
+
], exports.AuthRevocationService);
|
|
2837
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
2838
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2839
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2840
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2841
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2842
|
+
}
|
|
2843
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
2844
|
+
function _ts_metadata8(k, v) {
|
|
2845
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2846
|
+
}
|
|
2847
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
2848
|
+
function _ts_param4(paramIndex, decorator) {
|
|
2849
|
+
return function(target, key) {
|
|
2850
|
+
decorator(target, key, paramIndex);
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
__name(_ts_param4, "_ts_param");
|
|
2704
2854
|
var HOSTNAME_RE = /^[a-z0-9.-]+$/i;
|
|
2705
2855
|
exports.TokenDeliveryService = class TokenDeliveryService {
|
|
2706
2856
|
static {
|
|
@@ -2989,107 +3139,15 @@ exports.TokenDeliveryService = class TokenDeliveryService {
|
|
|
2989
3139
|
return typeof value === "string" ? value : void 0;
|
|
2990
3140
|
}
|
|
2991
3141
|
};
|
|
2992
|
-
exports.TokenDeliveryService =
|
|
3142
|
+
exports.TokenDeliveryService = _ts_decorate8([
|
|
2993
3143
|
common.Injectable(),
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
3144
|
+
_ts_param4(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3145
|
+
_ts_metadata8("design:type", Function),
|
|
3146
|
+
_ts_metadata8("design:paramtypes", [
|
|
2997
3147
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
2998
3148
|
])
|
|
2999
3149
|
], exports.TokenDeliveryService);
|
|
3000
3150
|
|
|
3001
|
-
// src/server/utils/assert-not-blocked.ts
|
|
3002
|
-
var BLOCKED_STATUS_CODES = /* @__PURE__ */ new Map([
|
|
3003
|
-
[
|
|
3004
|
-
"banned",
|
|
3005
|
-
AUTH_ERROR_CODES.ACCOUNT_BANNED
|
|
3006
|
-
],
|
|
3007
|
-
[
|
|
3008
|
-
"suspended",
|
|
3009
|
-
AUTH_ERROR_CODES.ACCOUNT_SUSPENDED
|
|
3010
|
-
],
|
|
3011
|
-
[
|
|
3012
|
-
"pending",
|
|
3013
|
-
AUTH_ERROR_CODES.PENDING_APPROVAL
|
|
3014
|
-
],
|
|
3015
|
-
[
|
|
3016
|
-
"pending_approval",
|
|
3017
|
-
AUTH_ERROR_CODES.PENDING_APPROVAL
|
|
3018
|
-
]
|
|
3019
|
-
]);
|
|
3020
|
-
function assertNotBlocked(status, blockedStatuses) {
|
|
3021
|
-
const canonical = status.toLowerCase();
|
|
3022
|
-
if (!blockedStatuses.some((blocked) => blocked.toLowerCase() === canonical)) {
|
|
3023
|
-
return;
|
|
3024
|
-
}
|
|
3025
|
-
throw new AuthException(BLOCKED_STATUS_CODES.get(canonical) ?? AUTH_ERROR_CODES.ACCOUNT_INACTIVE, 403);
|
|
3026
|
-
}
|
|
3027
|
-
__name(assertNotBlocked, "assertNotBlocked");
|
|
3028
|
-
|
|
3029
|
-
// src/server/utils/stamped-epoch.ts
|
|
3030
|
-
function readStampedEpoch(payload) {
|
|
3031
|
-
const { epoch } = payload;
|
|
3032
|
-
return typeof epoch === "number" && Number.isInteger(epoch) ? Math.max(0, epoch) : 0;
|
|
3033
|
-
}
|
|
3034
|
-
__name(readStampedEpoch, "readStampedEpoch");
|
|
3035
|
-
|
|
3036
|
-
// src/server/utils/sanitize-headers.ts
|
|
3037
|
-
var BLOCKED_HEADERS = /* @__PURE__ */ new Set([
|
|
3038
|
-
"authorization",
|
|
3039
|
-
"cookie",
|
|
3040
|
-
"proxy-authorization",
|
|
3041
|
-
"www-authenticate",
|
|
3042
|
-
// Stryker disable next-line StringLiteral: 'x-api-key' is also matched by SENSITIVE_HEADER_PATTERN (ends with -key), so removing it from the Set does not change the filter result
|
|
3043
|
-
"x-api-key",
|
|
3044
|
-
// Stryker disable next-line StringLiteral: 'x-auth-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
|
|
3045
|
-
"x-auth-token",
|
|
3046
|
-
// Stryker disable next-line StringLiteral: 'x-csrf-token' is also matched by SENSITIVE_HEADER_PATTERN (ends with -token), so removing it from the Set does not change the filter result
|
|
3047
|
-
"x-csrf-token",
|
|
3048
|
-
"x-session-id",
|
|
3049
|
-
"x-forwarded-for",
|
|
3050
|
-
"x-forwarded-host",
|
|
3051
|
-
"x-real-ip",
|
|
3052
|
-
"x-original-forwarded-for",
|
|
3053
|
-
"cf-connecting-ip",
|
|
3054
|
-
"true-client-ip",
|
|
3055
|
-
"x-cluster-client-ip"
|
|
3056
|
-
]);
|
|
3057
|
-
var SENSITIVE_HEADER_PATTERN = /^x-.*-(token|secret|key|password|credential|auth|bearer|signature|hmac)$/i;
|
|
3058
|
-
function sanitizeHeaders(headers) {
|
|
3059
|
-
return Object.fromEntries(Object.entries(headers).map(([key, value]) => [
|
|
3060
|
-
key.toLowerCase(),
|
|
3061
|
-
value
|
|
3062
|
-
]).filter(([key]) => !BLOCKED_HEADERS.has(key) && !SENSITIVE_HEADER_PATTERN.test(key)));
|
|
3063
|
-
}
|
|
3064
|
-
__name(sanitizeHeaders, "sanitizeHeaders");
|
|
3065
|
-
function createEmptyHookContext() {
|
|
3066
|
-
return {
|
|
3067
|
-
ip: "",
|
|
3068
|
-
userAgent: "",
|
|
3069
|
-
sanitizedHeaders: {}
|
|
3070
|
-
};
|
|
3071
|
-
}
|
|
3072
|
-
__name(createEmptyHookContext, "createEmptyHookContext");
|
|
3073
|
-
|
|
3074
|
-
// src/server/utils/sleep.ts
|
|
3075
|
-
var MAX_SLEEP_MS = 1e4;
|
|
3076
|
-
function sleep(ms) {
|
|
3077
|
-
const clamped = Math.min(Math.max(0, ms), MAX_SLEEP_MS);
|
|
3078
|
-
return new Promise((resolve) => {
|
|
3079
|
-
setTimeout(resolve, clamped);
|
|
3080
|
-
});
|
|
3081
|
-
}
|
|
3082
|
-
__name(sleep, "sleep");
|
|
3083
|
-
|
|
3084
|
-
// src/server/utils/roles.util.ts
|
|
3085
|
-
function hasRole(userRole, requiredRole, hierarchy) {
|
|
3086
|
-
if (userRole === requiredRole) return true;
|
|
3087
|
-
if (!Object.hasOwn(hierarchy, userRole)) return false;
|
|
3088
|
-
const inherited = hierarchy[userRole];
|
|
3089
|
-
return inherited !== void 0 && inherited.includes(requiredRole);
|
|
3090
|
-
}
|
|
3091
|
-
__name(hasRole, "hasRole");
|
|
3092
|
-
|
|
3093
3151
|
// src/server/utils/verify-with-rotation.ts
|
|
3094
3152
|
function verifyWithRotation(jwtService, options, token, { ignoreExpiration = false } = {}) {
|
|
3095
3153
|
const algorithms = [
|
|
@@ -3143,36 +3201,36 @@ function assertValidSub(sub) {
|
|
|
3143
3201
|
__name(assertValidSub, "assertValidSub");
|
|
3144
3202
|
|
|
3145
3203
|
// src/server/guards/jwt-auth.guard.ts
|
|
3146
|
-
function
|
|
3204
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
3147
3205
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3148
3206
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3149
3207
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3150
3208
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3151
3209
|
}
|
|
3152
|
-
__name(
|
|
3153
|
-
function
|
|
3210
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
3211
|
+
function _ts_metadata9(k, v) {
|
|
3154
3212
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3155
3213
|
}
|
|
3156
|
-
__name(
|
|
3157
|
-
function
|
|
3214
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
3215
|
+
function _ts_param5(paramIndex, decorator) {
|
|
3158
3216
|
return function(target, key) {
|
|
3159
3217
|
decorator(target, key, paramIndex);
|
|
3160
3218
|
};
|
|
3161
3219
|
}
|
|
3162
|
-
__name(
|
|
3220
|
+
__name(_ts_param5, "_ts_param");
|
|
3163
3221
|
exports.JwtAuthGuard = class JwtAuthGuard {
|
|
3164
3222
|
static {
|
|
3165
3223
|
__name(this, "JwtAuthGuard");
|
|
3166
3224
|
}
|
|
3167
3225
|
jwtService;
|
|
3168
3226
|
tokenDelivery;
|
|
3169
|
-
|
|
3227
|
+
revocation;
|
|
3170
3228
|
reflector;
|
|
3171
3229
|
options;
|
|
3172
|
-
constructor(jwtService, tokenDelivery,
|
|
3230
|
+
constructor(jwtService, tokenDelivery, revocation, reflector, options) {
|
|
3173
3231
|
this.jwtService = jwtService;
|
|
3174
3232
|
this.tokenDelivery = tokenDelivery;
|
|
3175
|
-
this.
|
|
3233
|
+
this.revocation = revocation;
|
|
3176
3234
|
this.reflector = reflector;
|
|
3177
3235
|
this.options = options;
|
|
3178
3236
|
}
|
|
@@ -3196,51 +3254,46 @@ exports.JwtAuthGuard = class JwtAuthGuard {
|
|
|
3196
3254
|
assertValidJti(payload.jti);
|
|
3197
3255
|
assertValidSub(payload.sub);
|
|
3198
3256
|
assertTokenType(payload, "dashboard");
|
|
3199
|
-
|
|
3200
|
-
if (revoked !== null) {
|
|
3201
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3202
|
-
}
|
|
3203
|
-
const epoch = await this.redis.getUserTokenEpoch(payload.sub);
|
|
3204
|
-
if (readStampedEpoch(payload) < epoch) {
|
|
3257
|
+
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
3205
3258
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3206
3259
|
}
|
|
3207
3260
|
request.user = payload;
|
|
3208
3261
|
return true;
|
|
3209
3262
|
}
|
|
3210
3263
|
};
|
|
3211
|
-
exports.JwtAuthGuard =
|
|
3264
|
+
exports.JwtAuthGuard = _ts_decorate9([
|
|
3212
3265
|
common.Injectable(),
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3266
|
+
_ts_param5(0, common.Inject(jwt.JwtService)),
|
|
3267
|
+
_ts_param5(1, common.Inject(exports.TokenDeliveryService)),
|
|
3268
|
+
_ts_param5(2, common.Inject(exports.AuthRevocationService)),
|
|
3269
|
+
_ts_param5(3, common.Inject(core.Reflector)),
|
|
3270
|
+
_ts_param5(4, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3271
|
+
_ts_metadata9("design:type", Function),
|
|
3272
|
+
_ts_metadata9("design:paramtypes", [
|
|
3220
3273
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
3221
3274
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
3222
|
-
typeof
|
|
3275
|
+
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
3223
3276
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
3224
3277
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3225
3278
|
])
|
|
3226
3279
|
], exports.JwtAuthGuard);
|
|
3227
|
-
function
|
|
3280
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
3228
3281
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3229
3282
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3230
3283
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3231
3284
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3232
3285
|
}
|
|
3233
|
-
__name(
|
|
3234
|
-
function
|
|
3235
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3286
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
3287
|
+
function _ts_metadata10(k, v) {
|
|
3288
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3236
3289
|
}
|
|
3237
|
-
__name(
|
|
3238
|
-
function
|
|
3290
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
3291
|
+
function _ts_param6(paramIndex, decorator) {
|
|
3239
3292
|
return function(target, key) {
|
|
3240
3293
|
decorator(target, key, paramIndex);
|
|
3241
3294
|
};
|
|
3242
3295
|
}
|
|
3243
|
-
__name(
|
|
3296
|
+
__name(_ts_param6, "_ts_param");
|
|
3244
3297
|
var SAFE_METHODS = /* @__PURE__ */ new Set([
|
|
3245
3298
|
"GET",
|
|
3246
3299
|
"HEAD",
|
|
@@ -3278,31 +3331,31 @@ exports.TrustedOriginGuard = class TrustedOriginGuard {
|
|
|
3278
3331
|
return true;
|
|
3279
3332
|
}
|
|
3280
3333
|
};
|
|
3281
|
-
exports.TrustedOriginGuard =
|
|
3334
|
+
exports.TrustedOriginGuard = _ts_decorate10([
|
|
3282
3335
|
common.Injectable(),
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3336
|
+
_ts_param6(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3337
|
+
_ts_metadata10("design:type", Function),
|
|
3338
|
+
_ts_metadata10("design:paramtypes", [
|
|
3286
3339
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3287
3340
|
])
|
|
3288
3341
|
], exports.TrustedOriginGuard);
|
|
3289
|
-
function
|
|
3342
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
3290
3343
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3291
3344
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3292
3345
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3293
3346
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3294
3347
|
}
|
|
3295
|
-
__name(
|
|
3296
|
-
function
|
|
3348
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
3349
|
+
function _ts_metadata11(k, v) {
|
|
3297
3350
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3298
3351
|
}
|
|
3299
|
-
__name(
|
|
3300
|
-
function
|
|
3352
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
3353
|
+
function _ts_param7(paramIndex, decorator) {
|
|
3301
3354
|
return function(target, key) {
|
|
3302
3355
|
decorator(target, key, paramIndex);
|
|
3303
3356
|
};
|
|
3304
3357
|
}
|
|
3305
|
-
__name(
|
|
3358
|
+
__name(_ts_param7, "_ts_param");
|
|
3306
3359
|
exports.UserStatusGuard = class UserStatusGuard {
|
|
3307
3360
|
static {
|
|
3308
3361
|
__name(this, "UserStatusGuard");
|
|
@@ -3335,25 +3388,25 @@ exports.UserStatusGuard = class UserStatusGuard {
|
|
|
3335
3388
|
return true;
|
|
3336
3389
|
}
|
|
3337
3390
|
};
|
|
3338
|
-
exports.UserStatusGuard =
|
|
3391
|
+
exports.UserStatusGuard = _ts_decorate11([
|
|
3339
3392
|
common.Injectable(),
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3393
|
+
_ts_param7(0, common.Inject(AuthRedisService)),
|
|
3394
|
+
_ts_param7(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
3395
|
+
_ts_param7(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3396
|
+
_ts_metadata11("design:type", Function),
|
|
3397
|
+
_ts_metadata11("design:paramtypes", [
|
|
3345
3398
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
3346
3399
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
3347
3400
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3348
3401
|
])
|
|
3349
3402
|
], exports.UserStatusGuard);
|
|
3350
|
-
function
|
|
3403
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
3351
3404
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3352
3405
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3353
3406
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3354
3407
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3355
3408
|
}
|
|
3356
|
-
__name(
|
|
3409
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
3357
3410
|
var NoStoreInterceptor = class {
|
|
3358
3411
|
static {
|
|
3359
3412
|
__name(this, "NoStoreInterceptor");
|
|
@@ -3368,7 +3421,7 @@ var NoStoreInterceptor = class {
|
|
|
3368
3421
|
return next.handle();
|
|
3369
3422
|
}
|
|
3370
3423
|
};
|
|
3371
|
-
NoStoreInterceptor =
|
|
3424
|
+
NoStoreInterceptor = _ts_decorate12([
|
|
3372
3425
|
common.Injectable()
|
|
3373
3426
|
], NoStoreInterceptor);
|
|
3374
3427
|
function flattenValidationErrors(errors, parentPath = "") {
|
|
@@ -3397,23 +3450,23 @@ function createAuthValidationPipe(options = {}) {
|
|
|
3397
3450
|
});
|
|
3398
3451
|
}
|
|
3399
3452
|
__name(createAuthValidationPipe, "createAuthValidationPipe");
|
|
3400
|
-
function
|
|
3453
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
3401
3454
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3402
3455
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3403
3456
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3404
3457
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3405
3458
|
}
|
|
3406
|
-
__name(
|
|
3407
|
-
function
|
|
3459
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
3460
|
+
function _ts_metadata12(k, v) {
|
|
3408
3461
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3409
3462
|
}
|
|
3410
|
-
__name(
|
|
3411
|
-
function
|
|
3463
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
3464
|
+
function _ts_param8(paramIndex, decorator) {
|
|
3412
3465
|
return function(target, key) {
|
|
3413
3466
|
decorator(target, key, paramIndex);
|
|
3414
3467
|
};
|
|
3415
3468
|
}
|
|
3416
|
-
__name(
|
|
3469
|
+
__name(_ts_param8, "_ts_param");
|
|
3417
3470
|
var LOCKOUT_PREFIX = "lf:";
|
|
3418
3471
|
var MAX_IDENTIFIER_LENGTH = 512;
|
|
3419
3472
|
exports.BruteForceService = class _BruteForceService {
|
|
@@ -3503,33 +3556,33 @@ exports.BruteForceService = class _BruteForceService {
|
|
|
3503
3556
|
}
|
|
3504
3557
|
}
|
|
3505
3558
|
};
|
|
3506
|
-
exports.BruteForceService =
|
|
3559
|
+
exports.BruteForceService = _ts_decorate13([
|
|
3507
3560
|
common.Injectable(),
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3561
|
+
_ts_param8(0, common.Inject(AuthRedisService)),
|
|
3562
|
+
_ts_param8(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3563
|
+
_ts_metadata12("design:type", Function),
|
|
3564
|
+
_ts_metadata12("design:paramtypes", [
|
|
3512
3565
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
3513
3566
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3514
3567
|
])
|
|
3515
3568
|
], exports.BruteForceService);
|
|
3516
|
-
function
|
|
3569
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
3517
3570
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3518
3571
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3519
3572
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3520
3573
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3521
3574
|
}
|
|
3522
|
-
__name(
|
|
3523
|
-
function
|
|
3575
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
3576
|
+
function _ts_metadata13(k, v) {
|
|
3524
3577
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3525
3578
|
}
|
|
3526
|
-
__name(
|
|
3527
|
-
function
|
|
3579
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
3580
|
+
function _ts_param9(paramIndex, decorator) {
|
|
3528
3581
|
return function(target, key) {
|
|
3529
3582
|
decorator(target, key, paramIndex);
|
|
3530
3583
|
};
|
|
3531
3584
|
}
|
|
3532
|
-
__name(
|
|
3585
|
+
__name(_ts_param9, "_ts_param");
|
|
3533
3586
|
var MAX_ATTEMPTS = 5;
|
|
3534
3587
|
var MIN_VERIFY_MS = 100;
|
|
3535
3588
|
var OTP_STORE_LUA = `
|
|
@@ -3666,31 +3719,31 @@ exports.OtpService = class OtpService {
|
|
|
3666
3719
|
await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
|
|
3667
3720
|
}
|
|
3668
3721
|
};
|
|
3669
|
-
exports.OtpService =
|
|
3722
|
+
exports.OtpService = _ts_decorate14([
|
|
3670
3723
|
common.Injectable(),
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3724
|
+
_ts_param9(0, common.Inject(AuthRedisService)),
|
|
3725
|
+
_ts_metadata13("design:type", Function),
|
|
3726
|
+
_ts_metadata13("design:paramtypes", [
|
|
3674
3727
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
3675
3728
|
])
|
|
3676
3729
|
], exports.OtpService);
|
|
3677
|
-
function
|
|
3730
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
3678
3731
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3679
3732
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3680
3733
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3681
3734
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3682
3735
|
}
|
|
3683
|
-
__name(
|
|
3684
|
-
function
|
|
3736
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
3737
|
+
function _ts_metadata14(k, v) {
|
|
3685
3738
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3686
3739
|
}
|
|
3687
|
-
__name(
|
|
3688
|
-
function
|
|
3740
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
3741
|
+
function _ts_param10(paramIndex, decorator) {
|
|
3689
3742
|
return function(target, key) {
|
|
3690
3743
|
decorator(target, key, paramIndex);
|
|
3691
3744
|
};
|
|
3692
3745
|
}
|
|
3693
|
-
__name(
|
|
3746
|
+
__name(_ts_param10, "_ts_param");
|
|
3694
3747
|
var scrypt = util.promisify(crypto.scrypt);
|
|
3695
3748
|
var SCRYPT_KEY_LEN = 64;
|
|
3696
3749
|
var SALT_BYTES = 16;
|
|
@@ -3974,33 +4027,33 @@ var PasswordService = class _PasswordService {
|
|
|
3974
4027
|
return crypto.timingSafeEqual(candidate, DUMMY_EXPECTED);
|
|
3975
4028
|
}
|
|
3976
4029
|
};
|
|
3977
|
-
PasswordService =
|
|
4030
|
+
PasswordService = _ts_decorate15([
|
|
3978
4031
|
common.Injectable(),
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
4032
|
+
_ts_param10(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
4033
|
+
_ts_param10(1, common.Inject(BYMAX_AUTH_BREACH_CHECKER)),
|
|
4034
|
+
_ts_metadata14("design:type", Function),
|
|
4035
|
+
_ts_metadata14("design:paramtypes", [
|
|
3983
4036
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
3984
4037
|
typeof IPasswordBreachChecker === "undefined" ? Object : IPasswordBreachChecker
|
|
3985
4038
|
])
|
|
3986
4039
|
], PasswordService);
|
|
3987
|
-
function
|
|
4040
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
3988
4041
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3989
4042
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3990
4043
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3991
4044
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3992
4045
|
}
|
|
3993
|
-
__name(
|
|
3994
|
-
function
|
|
4046
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
4047
|
+
function _ts_metadata15(k, v) {
|
|
3995
4048
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3996
4049
|
}
|
|
3997
|
-
__name(
|
|
3998
|
-
function
|
|
4050
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
4051
|
+
function _ts_param11(paramIndex, decorator) {
|
|
3999
4052
|
return function(target, key) {
|
|
4000
4053
|
decorator(target, key, paramIndex);
|
|
4001
4054
|
};
|
|
4002
4055
|
}
|
|
4003
|
-
__name(
|
|
4056
|
+
__name(_ts_param11, "_ts_param");
|
|
4004
4057
|
var MAX_IP_LENGTH = 45;
|
|
4005
4058
|
var SESSION_HASH_RE = /^[a-f0-9]{64}$/;
|
|
4006
4059
|
var REVOKE_SESSION_LUA = `
|
|
@@ -4506,15 +4559,15 @@ exports.SessionService = class _SessionService {
|
|
|
4506
4559
|
}
|
|
4507
4560
|
}
|
|
4508
4561
|
};
|
|
4509
|
-
exports.SessionService =
|
|
4562
|
+
exports.SessionService = _ts_decorate16([
|
|
4510
4563
|
common.Injectable(),
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4564
|
+
_ts_param11(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
4565
|
+
_ts_param11(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
4566
|
+
_ts_param11(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
4567
|
+
_ts_param11(2, common.Optional()),
|
|
4568
|
+
_ts_param11(3, common.Inject(AuthRedisService)),
|
|
4569
|
+
_ts_metadata15("design:type", Function),
|
|
4570
|
+
_ts_metadata15("design:paramtypes", [
|
|
4518
4571
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
4519
4572
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
4520
4573
|
Object,
|
|
@@ -4537,23 +4590,23 @@ function logSafe(value) {
|
|
|
4537
4590
|
__name(logSafe, "logSafe");
|
|
4538
4591
|
|
|
4539
4592
|
// src/server/services/token-manager.service.ts
|
|
4540
|
-
function
|
|
4593
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4541
4594
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4542
4595
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4543
4596
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4544
4597
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4545
4598
|
}
|
|
4546
|
-
__name(
|
|
4547
|
-
function
|
|
4599
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
4600
|
+
function _ts_metadata16(k, v) {
|
|
4548
4601
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4549
4602
|
}
|
|
4550
|
-
__name(
|
|
4551
|
-
function
|
|
4603
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
4604
|
+
function _ts_param12(paramIndex, decorator) {
|
|
4552
4605
|
return function(target, key) {
|
|
4553
4606
|
decorator(target, key, paramIndex);
|
|
4554
4607
|
};
|
|
4555
4608
|
}
|
|
4556
|
-
__name(
|
|
4609
|
+
__name(_ts_param12, "_ts_param");
|
|
4557
4610
|
var MFA_TEMP_TOKEN_TTL_SECONDS = 300;
|
|
4558
4611
|
var MAX_SESSION_FIELD_LENGTH = 45;
|
|
4559
4612
|
var TokenManagerService = class _TokenManagerService {
|
|
@@ -5349,15 +5402,15 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
5349
5402
|
return await this.redis.del(`mfa:${sha256(jti)}`);
|
|
5350
5403
|
}
|
|
5351
5404
|
};
|
|
5352
|
-
TokenManagerService =
|
|
5405
|
+
TokenManagerService = _ts_decorate17([
|
|
5353
5406
|
common.Injectable(),
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5407
|
+
_ts_param12(0, common.Inject(jwt.JwtService)),
|
|
5408
|
+
_ts_param12(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
5409
|
+
_ts_param12(2, common.Inject(AuthRedisService)),
|
|
5410
|
+
_ts_param12(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
5411
|
+
_ts_param12(3, common.Optional()),
|
|
5412
|
+
_ts_metadata16("design:type", Function),
|
|
5413
|
+
_ts_metadata16("design:paramtypes", [
|
|
5361
5414
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
5362
5415
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
5363
5416
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -5378,12 +5431,18 @@ function normalizeEmail(email) {
|
|
|
5378
5431
|
return email.trim().toLowerCase();
|
|
5379
5432
|
}
|
|
5380
5433
|
__name(normalizeEmail, "normalizeEmail");
|
|
5381
|
-
|
|
5382
|
-
// src/server/utils/resolve-tenant-id.ts
|
|
5383
5434
|
async function resolveTenantId(dtoTenantId, req, resolver) {
|
|
5384
5435
|
if (resolver) {
|
|
5385
5436
|
return await resolver(req);
|
|
5386
5437
|
}
|
|
5438
|
+
if (dtoTenantId === void 0 || dtoTenantId === null) {
|
|
5439
|
+
throw new AuthException(AUTH_ERROR_CODES.VALIDATION, common.HttpStatus.BAD_REQUEST, [
|
|
5440
|
+
{
|
|
5441
|
+
field: "tenantId",
|
|
5442
|
+
message: "tenantId is required unless the deployment configures tenantIdResolver"
|
|
5443
|
+
}
|
|
5444
|
+
]);
|
|
5445
|
+
}
|
|
5387
5446
|
return dtoTenantId;
|
|
5388
5447
|
}
|
|
5389
5448
|
__name(resolveTenantId, "resolveTenantId");
|
|
@@ -5396,23 +5455,23 @@ function tenantScoped(user, tenantId) {
|
|
|
5396
5455
|
__name(tenantScoped, "tenantScoped");
|
|
5397
5456
|
|
|
5398
5457
|
// src/server/services/auth.service.ts
|
|
5399
|
-
function
|
|
5458
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
5400
5459
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5401
5460
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5402
5461
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5403
5462
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5404
5463
|
}
|
|
5405
|
-
__name(
|
|
5406
|
-
function
|
|
5464
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
5465
|
+
function _ts_metadata17(k, v) {
|
|
5407
5466
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5408
5467
|
}
|
|
5409
|
-
__name(
|
|
5410
|
-
function
|
|
5468
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
5469
|
+
function _ts_param13(paramIndex, decorator) {
|
|
5411
5470
|
return function(target, key) {
|
|
5412
5471
|
decorator(target, key, paramIndex);
|
|
5413
5472
|
};
|
|
5414
5473
|
}
|
|
5415
|
-
__name(
|
|
5474
|
+
__name(_ts_param13, "_ts_param");
|
|
5416
5475
|
var ANTI_ENUM_MIN_MS = 300;
|
|
5417
5476
|
exports.AuthService = class _AuthService {
|
|
5418
5477
|
static {
|
|
@@ -6141,27 +6200,27 @@ exports.AuthService = class _AuthService {
|
|
|
6141
6200
|
const ttl = this.options.emailVerification.otpTtlSeconds;
|
|
6142
6201
|
const otp = this.otpService.generate(length);
|
|
6143
6202
|
await this.otpService.store("email_verification", identifier, otp, ttl);
|
|
6144
|
-
void this.emailProvider.sendEmailVerificationOtp(email, otp).catch((err) => {
|
|
6203
|
+
void this.emailProvider.sendEmailVerificationOtp(tenantId, email, otp).catch((err) => {
|
|
6145
6204
|
this.logger.error(`sendEmailVerificationOtp failed for user ${userId}`, err);
|
|
6146
6205
|
});
|
|
6147
6206
|
}
|
|
6148
6207
|
};
|
|
6149
|
-
exports.AuthService =
|
|
6208
|
+
exports.AuthService = _ts_decorate18([
|
|
6150
6209
|
common.Injectable(),
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6210
|
+
_ts_param13(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
6211
|
+
_ts_param13(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
6212
|
+
_ts_param13(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
6213
|
+
_ts_param13(2, common.Optional()),
|
|
6214
|
+
_ts_param13(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
6215
|
+
_ts_param13(3, common.Optional()),
|
|
6216
|
+
_ts_param13(4, common.Inject(PasswordService)),
|
|
6217
|
+
_ts_param13(5, common.Inject(TokenManagerService)),
|
|
6218
|
+
_ts_param13(6, common.Inject(exports.BruteForceService)),
|
|
6219
|
+
_ts_param13(7, common.Inject(AuthRedisService)),
|
|
6220
|
+
_ts_param13(8, common.Inject(exports.OtpService)),
|
|
6221
|
+
_ts_param13(9, common.Inject(exports.SessionService)),
|
|
6222
|
+
_ts_metadata17("design:type", Function),
|
|
6223
|
+
_ts_metadata17("design:paramtypes", [
|
|
6165
6224
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6166
6225
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6167
6226
|
Object,
|
|
@@ -6184,23 +6243,23 @@ __name(toSafeUser2, "toSafeUser");
|
|
|
6184
6243
|
var WS_TICKET_TTL_SECONDS = 30;
|
|
6185
6244
|
|
|
6186
6245
|
// src/server/services/ws-ticket.service.ts
|
|
6187
|
-
function
|
|
6246
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
6188
6247
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6189
6248
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6190
6249
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6191
6250
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6192
6251
|
}
|
|
6193
|
-
__name(
|
|
6194
|
-
function
|
|
6252
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
6253
|
+
function _ts_metadata18(k, v) {
|
|
6195
6254
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6196
6255
|
}
|
|
6197
|
-
__name(
|
|
6198
|
-
function
|
|
6256
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
6257
|
+
function _ts_param14(paramIndex, decorator) {
|
|
6199
6258
|
return function(target, key) {
|
|
6200
6259
|
decorator(target, key, paramIndex);
|
|
6201
6260
|
};
|
|
6202
6261
|
}
|
|
6203
|
-
__name(
|
|
6262
|
+
__name(_ts_param14, "_ts_param");
|
|
6204
6263
|
exports.WsTicketService = class _WsTicketService {
|
|
6205
6264
|
static {
|
|
6206
6265
|
__name(this, "WsTicketService");
|
|
@@ -6268,13 +6327,13 @@ exports.WsTicketService = class _WsTicketService {
|
|
|
6268
6327
|
return snapshot;
|
|
6269
6328
|
}
|
|
6270
6329
|
};
|
|
6271
|
-
exports.WsTicketService =
|
|
6330
|
+
exports.WsTicketService = _ts_decorate19([
|
|
6272
6331
|
common.Injectable(),
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6332
|
+
_ts_param14(0, common.Inject(AuthRedisService)),
|
|
6333
|
+
_ts_param14(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
6334
|
+
_ts_param14(2, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
6335
|
+
_ts_metadata18("design:type", Function),
|
|
6336
|
+
_ts_metadata18("design:paramtypes", [
|
|
6278
6337
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
6279
6338
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6280
6339
|
typeof IUserRepository === "undefined" ? Object : IUserRepository
|
|
@@ -6282,23 +6341,23 @@ exports.WsTicketService = _ts_decorate18([
|
|
|
6282
6341
|
], exports.WsTicketService);
|
|
6283
6342
|
|
|
6284
6343
|
// src/server/controllers/auth.controller.ts
|
|
6285
|
-
function
|
|
6344
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
6286
6345
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6287
6346
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6288
6347
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6289
6348
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6290
6349
|
}
|
|
6291
|
-
__name(
|
|
6292
|
-
function
|
|
6350
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
6351
|
+
function _ts_metadata19(k, v) {
|
|
6293
6352
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6294
6353
|
}
|
|
6295
|
-
__name(
|
|
6296
|
-
function
|
|
6354
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
6355
|
+
function _ts_param15(paramIndex, decorator) {
|
|
6297
6356
|
return function(target, key) {
|
|
6298
6357
|
decorator(target, key, paramIndex);
|
|
6299
6358
|
};
|
|
6300
6359
|
}
|
|
6301
|
-
__name(
|
|
6360
|
+
__name(_ts_param15, "_ts_param");
|
|
6302
6361
|
function isMfaChallenge(result) {
|
|
6303
6362
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
6304
6363
|
}
|
|
@@ -6440,156 +6499,156 @@ var AuthController = class {
|
|
|
6440
6499
|
await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
|
|
6441
6500
|
}
|
|
6442
6501
|
};
|
|
6443
|
-
|
|
6502
|
+
_ts_decorate20([
|
|
6444
6503
|
Public(),
|
|
6445
6504
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.register),
|
|
6446
6505
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
|
|
6447
6506
|
common.Post("register"),
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6507
|
+
_ts_param15(0, common.Body()),
|
|
6508
|
+
_ts_param15(1, common.Req()),
|
|
6509
|
+
_ts_param15(2, common.Res({
|
|
6451
6510
|
passthrough: true
|
|
6452
6511
|
})),
|
|
6453
|
-
|
|
6454
|
-
|
|
6512
|
+
_ts_metadata19("design:type", Function),
|
|
6513
|
+
_ts_metadata19("design:paramtypes", [
|
|
6455
6514
|
typeof RegisterDto === "undefined" ? Object : RegisterDto,
|
|
6456
6515
|
typeof Request === "undefined" ? Object : Request,
|
|
6457
6516
|
typeof Response === "undefined" ? Object : Response
|
|
6458
6517
|
]),
|
|
6459
|
-
|
|
6518
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6460
6519
|
], AuthController.prototype, "register", null);
|
|
6461
|
-
|
|
6520
|
+
_ts_decorate20([
|
|
6462
6521
|
Public(),
|
|
6463
6522
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.login),
|
|
6464
6523
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
|
|
6465
6524
|
common.HttpCode(common.HttpStatus.OK),
|
|
6466
6525
|
common.Post("login"),
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6526
|
+
_ts_param15(0, common.Body()),
|
|
6527
|
+
_ts_param15(1, common.Req()),
|
|
6528
|
+
_ts_param15(2, common.Res({
|
|
6470
6529
|
passthrough: true
|
|
6471
6530
|
})),
|
|
6472
|
-
|
|
6473
|
-
|
|
6531
|
+
_ts_metadata19("design:type", Function),
|
|
6532
|
+
_ts_metadata19("design:paramtypes", [
|
|
6474
6533
|
typeof LoginDto === "undefined" ? Object : LoginDto,
|
|
6475
6534
|
typeof Request === "undefined" ? Object : Request,
|
|
6476
6535
|
typeof Response === "undefined" ? Object : Response
|
|
6477
6536
|
]),
|
|
6478
|
-
|
|
6537
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6479
6538
|
], AuthController.prototype, "login", null);
|
|
6480
|
-
|
|
6539
|
+
_ts_decorate20([
|
|
6481
6540
|
Public(),
|
|
6482
6541
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
6483
6542
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
6484
6543
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6485
6544
|
common.Post("logout"),
|
|
6486
|
-
|
|
6487
|
-
|
|
6545
|
+
_ts_param15(0, common.Req()),
|
|
6546
|
+
_ts_param15(1, common.Res({
|
|
6488
6547
|
passthrough: true
|
|
6489
6548
|
})),
|
|
6490
|
-
|
|
6491
|
-
|
|
6549
|
+
_ts_metadata19("design:type", Function),
|
|
6550
|
+
_ts_metadata19("design:paramtypes", [
|
|
6492
6551
|
typeof Request === "undefined" ? Object : Request,
|
|
6493
6552
|
typeof Response === "undefined" ? Object : Response
|
|
6494
6553
|
]),
|
|
6495
|
-
|
|
6554
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6496
6555
|
], AuthController.prototype, "logout", null);
|
|
6497
|
-
|
|
6556
|
+
_ts_decorate20([
|
|
6498
6557
|
Public(),
|
|
6499
6558
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6500
6559
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6501
6560
|
common.HttpCode(common.HttpStatus.OK),
|
|
6502
6561
|
common.Post("refresh"),
|
|
6503
|
-
|
|
6504
|
-
|
|
6562
|
+
_ts_param15(0, common.Req()),
|
|
6563
|
+
_ts_param15(1, common.Res({
|
|
6505
6564
|
passthrough: true
|
|
6506
6565
|
})),
|
|
6507
|
-
|
|
6508
|
-
|
|
6566
|
+
_ts_metadata19("design:type", Function),
|
|
6567
|
+
_ts_metadata19("design:paramtypes", [
|
|
6509
6568
|
typeof Request === "undefined" ? Object : Request,
|
|
6510
6569
|
typeof Response === "undefined" ? Object : Response
|
|
6511
6570
|
]),
|
|
6512
|
-
|
|
6571
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6513
6572
|
], AuthController.prototype, "refresh", null);
|
|
6514
|
-
|
|
6573
|
+
_ts_decorate20([
|
|
6515
6574
|
common.UseGuards(exports.JwtAuthGuard),
|
|
6516
6575
|
common.Get("me"),
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6576
|
+
_ts_param15(0, CurrentUser()),
|
|
6577
|
+
_ts_metadata19("design:type", Function),
|
|
6578
|
+
_ts_metadata19("design:paramtypes", [
|
|
6520
6579
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
6521
6580
|
]),
|
|
6522
|
-
|
|
6581
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6523
6582
|
], AuthController.prototype, "me", null);
|
|
6524
|
-
|
|
6583
|
+
_ts_decorate20([
|
|
6525
6584
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
6526
6585
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
|
|
6527
6586
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
|
|
6528
6587
|
common.Post("ws-ticket"),
|
|
6529
6588
|
common.HttpCode(common.HttpStatus.OK),
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6589
|
+
_ts_param15(0, CurrentUser()),
|
|
6590
|
+
_ts_metadata19("design:type", Function),
|
|
6591
|
+
_ts_metadata19("design:paramtypes", [
|
|
6533
6592
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
6534
6593
|
]),
|
|
6535
|
-
|
|
6594
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6536
6595
|
], AuthController.prototype, "wsTicket", null);
|
|
6537
|
-
|
|
6596
|
+
_ts_decorate20([
|
|
6538
6597
|
Public(),
|
|
6539
6598
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
|
|
6540
6599
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
|
|
6541
6600
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6542
6601
|
common.Post("verify-email"),
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6602
|
+
_ts_param15(0, common.Body()),
|
|
6603
|
+
_ts_param15(1, common.Req()),
|
|
6604
|
+
_ts_metadata19("design:type", Function),
|
|
6605
|
+
_ts_metadata19("design:paramtypes", [
|
|
6547
6606
|
typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
|
|
6548
6607
|
typeof Request === "undefined" ? Object : Request
|
|
6549
6608
|
]),
|
|
6550
|
-
|
|
6609
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6551
6610
|
], AuthController.prototype, "verifyEmail", null);
|
|
6552
|
-
|
|
6611
|
+
_ts_decorate20([
|
|
6553
6612
|
Public(),
|
|
6554
6613
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
|
|
6555
6614
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
|
|
6556
6615
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6557
6616
|
common.Post("resend-verification"),
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6617
|
+
_ts_param15(0, common.Body()),
|
|
6618
|
+
_ts_param15(1, common.Req()),
|
|
6619
|
+
_ts_metadata19("design:type", Function),
|
|
6620
|
+
_ts_metadata19("design:paramtypes", [
|
|
6562
6621
|
typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
|
|
6563
6622
|
typeof Request === "undefined" ? Object : Request
|
|
6564
6623
|
]),
|
|
6565
|
-
|
|
6624
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6566
6625
|
], AuthController.prototype, "resendVerification", null);
|
|
6567
|
-
AuthController =
|
|
6626
|
+
AuthController = _ts_decorate20([
|
|
6568
6627
|
common.UseInterceptors(NoStoreInterceptor),
|
|
6569
6628
|
common.Controller(),
|
|
6570
6629
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
6571
6630
|
common.UsePipes(createAuthValidationPipe()),
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6631
|
+
_ts_param15(0, common.Inject(exports.AuthService)),
|
|
6632
|
+
_ts_param15(1, common.Inject(exports.TokenDeliveryService)),
|
|
6633
|
+
_ts_param15(2, common.Inject(exports.WsTicketService)),
|
|
6634
|
+
_ts_metadata19("design:type", Function),
|
|
6635
|
+
_ts_metadata19("design:paramtypes", [
|
|
6577
6636
|
typeof exports.AuthService === "undefined" ? Object : exports.AuthService,
|
|
6578
6637
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
6579
6638
|
typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService
|
|
6580
6639
|
])
|
|
6581
6640
|
], AuthController);
|
|
6582
|
-
function
|
|
6641
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
6583
6642
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6584
6643
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6585
6644
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6586
6645
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6587
6646
|
}
|
|
6588
|
-
__name(
|
|
6589
|
-
function
|
|
6647
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
6648
|
+
function _ts_metadata20(k, v) {
|
|
6590
6649
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6591
6650
|
}
|
|
6592
|
-
__name(
|
|
6651
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
6593
6652
|
var ChangeEmailDto = class {
|
|
6594
6653
|
static {
|
|
6595
6654
|
__name(this, "ChangeEmailDto");
|
|
@@ -6609,30 +6668,30 @@ var ChangeEmailDto = class {
|
|
|
6609
6668
|
*/
|
|
6610
6669
|
currentPassword;
|
|
6611
6670
|
};
|
|
6612
|
-
|
|
6671
|
+
_ts_decorate21([
|
|
6613
6672
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
6614
6673
|
classValidator.IsEmail(),
|
|
6615
6674
|
classValidator.IsNotEmpty(),
|
|
6616
6675
|
classValidator.MaxLength(255),
|
|
6617
|
-
|
|
6676
|
+
_ts_metadata20("design:type", String)
|
|
6618
6677
|
], ChangeEmailDto.prototype, "newEmail", void 0);
|
|
6619
|
-
|
|
6678
|
+
_ts_decorate21([
|
|
6620
6679
|
classValidator.IsString(),
|
|
6621
6680
|
classValidator.MinLength(1),
|
|
6622
6681
|
classValidator.MaxLength(128),
|
|
6623
|
-
|
|
6682
|
+
_ts_metadata20("design:type", String)
|
|
6624
6683
|
], ChangeEmailDto.prototype, "currentPassword", void 0);
|
|
6625
|
-
function
|
|
6684
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
6626
6685
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6627
6686
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6628
6687
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6629
6688
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6630
6689
|
}
|
|
6631
|
-
__name(
|
|
6632
|
-
function
|
|
6690
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
6691
|
+
function _ts_metadata21(k, v) {
|
|
6633
6692
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6634
6693
|
}
|
|
6635
|
-
__name(
|
|
6694
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
6636
6695
|
var ConfirmEmailChangeDto = class {
|
|
6637
6696
|
static {
|
|
6638
6697
|
__name(this, "ConfirmEmailChangeDto");
|
|
@@ -6645,29 +6704,29 @@ var ConfirmEmailChangeDto = class {
|
|
|
6645
6704
|
*/
|
|
6646
6705
|
token;
|
|
6647
6706
|
};
|
|
6648
|
-
|
|
6707
|
+
_ts_decorate22([
|
|
6649
6708
|
classValidator.IsString(),
|
|
6650
6709
|
classValidator.IsNotEmpty(),
|
|
6651
6710
|
classValidator.Length(64, 64),
|
|
6652
|
-
|
|
6711
|
+
_ts_metadata21("design:type", String)
|
|
6653
6712
|
], ConfirmEmailChangeDto.prototype, "token", void 0);
|
|
6654
|
-
function
|
|
6713
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
6655
6714
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6656
6715
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6657
6716
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6658
6717
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6659
6718
|
}
|
|
6660
|
-
__name(
|
|
6661
|
-
function
|
|
6719
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
6720
|
+
function _ts_metadata22(k, v) {
|
|
6662
6721
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6663
6722
|
}
|
|
6664
|
-
__name(
|
|
6665
|
-
function
|
|
6723
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
6724
|
+
function _ts_param16(paramIndex, decorator) {
|
|
6666
6725
|
return function(target, key) {
|
|
6667
6726
|
decorator(target, key, paramIndex);
|
|
6668
6727
|
};
|
|
6669
6728
|
}
|
|
6670
|
-
__name(
|
|
6729
|
+
__name(_ts_param16, "_ts_param");
|
|
6671
6730
|
var EMAIL_CHANGE_TOKEN_BYTES = 32;
|
|
6672
6731
|
function isEmailChangeContext(value) {
|
|
6673
6732
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -6757,7 +6816,7 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
6757
6816
|
passwordFingerprint: sha256(user.passwordHash)
|
|
6758
6817
|
};
|
|
6759
6818
|
await this.redis.set(`ec:${sha256(rawToken)}`, JSON.stringify(context), this.options.emailChange.tokenTtlSeconds);
|
|
6760
|
-
await this.emailProvider.sendEmailChangeVerification?.(newEmail, rawToken);
|
|
6819
|
+
await this.emailProvider.sendEmailChangeVerification?.(user.tenantId, newEmail, rawToken);
|
|
6761
6820
|
this.logger.log(`requestChange: verification sent userId=${userId} newEmail=${maskEmail(newEmail)}`);
|
|
6762
6821
|
}
|
|
6763
6822
|
// ---------------------------------------------------------------------------
|
|
@@ -6791,7 +6850,7 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
6791
6850
|
const oldEmail = user.email;
|
|
6792
6851
|
await this.userRepo.updateEmail(context.userId, context.newEmail);
|
|
6793
6852
|
this.logger.log(`confirmChange: address changed userId=${context.userId} from=${maskEmail(oldEmail)} to=${maskEmail(context.newEmail)}`);
|
|
6794
|
-
await this.notifyOldAddress(oldEmail, context.newEmail);
|
|
6853
|
+
await this.notifyOldAddress(user.tenantId, oldEmail, context.newEmail);
|
|
6795
6854
|
}
|
|
6796
6855
|
// ---------------------------------------------------------------------------
|
|
6797
6856
|
// Private helpers
|
|
@@ -6871,25 +6930,25 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
6871
6930
|
* @param oldEmail - The address the account is leaving.
|
|
6872
6931
|
* @param newEmail - The address it moved to.
|
|
6873
6932
|
*/
|
|
6874
|
-
async notifyOldAddress(oldEmail, newEmail) {
|
|
6933
|
+
async notifyOldAddress(tenantId, oldEmail, newEmail) {
|
|
6875
6934
|
if (!this.emailProvider.sendEmailChangedNotification) return;
|
|
6876
6935
|
try {
|
|
6877
|
-
await this.emailProvider.sendEmailChangedNotification(oldEmail, newEmail);
|
|
6936
|
+
await this.emailProvider.sendEmailChangedNotification(tenantId, oldEmail, newEmail);
|
|
6878
6937
|
} catch (err) {
|
|
6879
6938
|
this.logger.error("confirmChange: notification to the previous address failed", err);
|
|
6880
6939
|
}
|
|
6881
6940
|
}
|
|
6882
6941
|
};
|
|
6883
|
-
exports.EmailChangeService =
|
|
6942
|
+
exports.EmailChangeService = _ts_decorate23([
|
|
6884
6943
|
common.Injectable(),
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6944
|
+
_ts_param16(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
6945
|
+
_ts_param16(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
6946
|
+
_ts_param16(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
6947
|
+
_ts_param16(3, common.Inject(PasswordService)),
|
|
6948
|
+
_ts_param16(4, common.Inject(AuthRedisService)),
|
|
6949
|
+
_ts_param16(5, common.Inject(exports.BruteForceService)),
|
|
6950
|
+
_ts_metadata22("design:type", Function),
|
|
6951
|
+
_ts_metadata22("design:paramtypes", [
|
|
6893
6952
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6894
6953
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6895
6954
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
@@ -6900,23 +6959,23 @@ exports.EmailChangeService = _ts_decorate22([
|
|
|
6900
6959
|
], exports.EmailChangeService);
|
|
6901
6960
|
|
|
6902
6961
|
// src/server/controllers/email-change.controller.ts
|
|
6903
|
-
function
|
|
6962
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
6904
6963
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6905
6964
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6906
6965
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6907
6966
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6908
6967
|
}
|
|
6909
|
-
__name(
|
|
6910
|
-
function
|
|
6968
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
6969
|
+
function _ts_metadata23(k, v) {
|
|
6911
6970
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6912
6971
|
}
|
|
6913
|
-
__name(
|
|
6914
|
-
function
|
|
6972
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
6973
|
+
function _ts_param17(paramIndex, decorator) {
|
|
6915
6974
|
return function(target, key) {
|
|
6916
6975
|
decorator(target, key, paramIndex);
|
|
6917
6976
|
};
|
|
6918
6977
|
}
|
|
6919
|
-
__name(
|
|
6978
|
+
__name(_ts_param17, "_ts_param");
|
|
6920
6979
|
var EmailChangeController = class {
|
|
6921
6980
|
static {
|
|
6922
6981
|
__name(this, "EmailChangeController");
|
|
@@ -6963,56 +7022,56 @@ var EmailChangeController = class {
|
|
|
6963
7022
|
await this.emailChangeService.confirmChange(dto);
|
|
6964
7023
|
}
|
|
6965
7024
|
};
|
|
6966
|
-
|
|
7025
|
+
_ts_decorate24([
|
|
6967
7026
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
6968
7027
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
|
|
6969
7028
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
|
|
6970
7029
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6971
7030
|
common.Post("change"),
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
7031
|
+
_ts_param17(0, common.Body()),
|
|
7032
|
+
_ts_param17(1, CurrentUser()),
|
|
7033
|
+
_ts_metadata23("design:type", Function),
|
|
7034
|
+
_ts_metadata23("design:paramtypes", [
|
|
6976
7035
|
typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
|
|
6977
7036
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
6978
7037
|
]),
|
|
6979
|
-
|
|
7038
|
+
_ts_metadata23("design:returntype", Promise)
|
|
6980
7039
|
], EmailChangeController.prototype, "requestChange", null);
|
|
6981
|
-
|
|
7040
|
+
_ts_decorate24([
|
|
6982
7041
|
Public(),
|
|
6983
7042
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
|
|
6984
7043
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
|
|
6985
7044
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6986
7045
|
common.Post("change/confirm"),
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
7046
|
+
_ts_param17(0, common.Body()),
|
|
7047
|
+
_ts_metadata23("design:type", Function),
|
|
7048
|
+
_ts_metadata23("design:paramtypes", [
|
|
6990
7049
|
typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
|
|
6991
7050
|
]),
|
|
6992
|
-
|
|
7051
|
+
_ts_metadata23("design:returntype", Promise)
|
|
6993
7052
|
], EmailChangeController.prototype, "confirmChange", null);
|
|
6994
|
-
EmailChangeController =
|
|
7053
|
+
EmailChangeController = _ts_decorate24([
|
|
6995
7054
|
common.UseInterceptors(NoStoreInterceptor),
|
|
6996
7055
|
common.Controller("email"),
|
|
6997
7056
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
6998
7057
|
common.UsePipes(createAuthValidationPipe()),
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7058
|
+
_ts_param17(0, common.Inject(exports.EmailChangeService)),
|
|
7059
|
+
_ts_metadata23("design:type", Function),
|
|
7060
|
+
_ts_metadata23("design:paramtypes", [
|
|
7002
7061
|
typeof exports.EmailChangeService === "undefined" ? Object : exports.EmailChangeService
|
|
7003
7062
|
])
|
|
7004
7063
|
], EmailChangeController);
|
|
7005
|
-
function
|
|
7064
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
7006
7065
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7007
7066
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7008
7067
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7009
7068
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7010
7069
|
}
|
|
7011
|
-
__name(
|
|
7012
|
-
function
|
|
7070
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
7071
|
+
function _ts_metadata24(k, v) {
|
|
7013
7072
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7014
7073
|
}
|
|
7015
|
-
__name(
|
|
7074
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
7016
7075
|
var AcceptInvitationDto = class {
|
|
7017
7076
|
static {
|
|
7018
7077
|
__name(this, "AcceptInvitationDto");
|
|
@@ -7050,34 +7109,34 @@ var AcceptInvitationDto = class {
|
|
|
7050
7109
|
*/
|
|
7051
7110
|
password;
|
|
7052
7111
|
};
|
|
7053
|
-
|
|
7112
|
+
_ts_decorate25([
|
|
7054
7113
|
classValidator.IsString(),
|
|
7055
7114
|
classValidator.IsNotEmpty(),
|
|
7056
7115
|
classValidator.Length(64, 64),
|
|
7057
|
-
|
|
7116
|
+
_ts_metadata24("design:type", String)
|
|
7058
7117
|
], AcceptInvitationDto.prototype, "token", void 0);
|
|
7059
|
-
|
|
7118
|
+
_ts_decorate25([
|
|
7060
7119
|
classValidator.IsString(),
|
|
7061
7120
|
classValidator.IsNotEmpty(),
|
|
7062
7121
|
classValidator.Length(2, 100),
|
|
7063
|
-
|
|
7122
|
+
_ts_metadata24("design:type", String)
|
|
7064
7123
|
], AcceptInvitationDto.prototype, "name", void 0);
|
|
7065
|
-
|
|
7124
|
+
_ts_decorate25([
|
|
7066
7125
|
classValidator.IsString(),
|
|
7067
7126
|
classValidator.Length(8, 128),
|
|
7068
|
-
|
|
7127
|
+
_ts_metadata24("design:type", String)
|
|
7069
7128
|
], AcceptInvitationDto.prototype, "password", void 0);
|
|
7070
|
-
function
|
|
7129
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
7071
7130
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7072
7131
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7073
7132
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7074
7133
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7075
7134
|
}
|
|
7076
|
-
__name(
|
|
7077
|
-
function
|
|
7135
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
7136
|
+
function _ts_metadata25(k, v) {
|
|
7078
7137
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7079
7138
|
}
|
|
7080
|
-
__name(
|
|
7139
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
7081
7140
|
var CreateInvitationDto = class {
|
|
7082
7141
|
static {
|
|
7083
7142
|
__name(this, "CreateInvitationDto");
|
|
@@ -7108,37 +7167,37 @@ var CreateInvitationDto = class {
|
|
|
7108
7167
|
*/
|
|
7109
7168
|
tenantName;
|
|
7110
7169
|
};
|
|
7111
|
-
|
|
7170
|
+
_ts_decorate26([
|
|
7112
7171
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
7113
7172
|
classValidator.IsEmail(),
|
|
7114
7173
|
classValidator.IsNotEmpty(),
|
|
7115
7174
|
classValidator.MaxLength(255),
|
|
7116
|
-
|
|
7175
|
+
_ts_metadata25("design:type", String)
|
|
7117
7176
|
], CreateInvitationDto.prototype, "email", void 0);
|
|
7118
|
-
|
|
7177
|
+
_ts_decorate26([
|
|
7119
7178
|
classValidator.IsString(),
|
|
7120
7179
|
classValidator.IsNotEmpty(),
|
|
7121
7180
|
classValidator.MaxLength(64),
|
|
7122
|
-
|
|
7181
|
+
_ts_metadata25("design:type", String)
|
|
7123
7182
|
], CreateInvitationDto.prototype, "role", void 0);
|
|
7124
|
-
|
|
7183
|
+
_ts_decorate26([
|
|
7125
7184
|
classValidator.IsOptional(),
|
|
7126
7185
|
classValidator.IsString(),
|
|
7127
7186
|
classValidator.IsNotEmpty(),
|
|
7128
7187
|
classValidator.MaxLength(128),
|
|
7129
|
-
|
|
7188
|
+
_ts_metadata25("design:type", String)
|
|
7130
7189
|
], CreateInvitationDto.prototype, "tenantName", void 0);
|
|
7131
|
-
function
|
|
7190
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
7132
7191
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7133
7192
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7134
7193
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7135
7194
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7136
7195
|
}
|
|
7137
|
-
__name(
|
|
7138
|
-
function
|
|
7196
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
7197
|
+
function _ts_metadata26(k, v) {
|
|
7139
7198
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7140
7199
|
}
|
|
7141
|
-
__name(
|
|
7200
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
7142
7201
|
var RevokeInvitationDto = class {
|
|
7143
7202
|
static {
|
|
7144
7203
|
__name(this, "RevokeInvitationDto");
|
|
@@ -7150,30 +7209,30 @@ var RevokeInvitationDto = class {
|
|
|
7150
7209
|
*/
|
|
7151
7210
|
email;
|
|
7152
7211
|
};
|
|
7153
|
-
|
|
7212
|
+
_ts_decorate27([
|
|
7154
7213
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
7155
7214
|
classValidator.IsEmail(),
|
|
7156
7215
|
classValidator.IsNotEmpty(),
|
|
7157
7216
|
classValidator.MaxLength(255),
|
|
7158
|
-
|
|
7217
|
+
_ts_metadata26("design:type", String)
|
|
7159
7218
|
], RevokeInvitationDto.prototype, "email", void 0);
|
|
7160
|
-
function
|
|
7219
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
7161
7220
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7162
7221
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7163
7222
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7164
7223
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7165
7224
|
}
|
|
7166
|
-
__name(
|
|
7167
|
-
function
|
|
7225
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
7226
|
+
function _ts_metadata27(k, v) {
|
|
7168
7227
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7169
7228
|
}
|
|
7170
|
-
__name(
|
|
7171
|
-
function
|
|
7229
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
7230
|
+
function _ts_param18(paramIndex, decorator) {
|
|
7172
7231
|
return function(target, key) {
|
|
7173
7232
|
decorator(target, key, paramIndex);
|
|
7174
7233
|
};
|
|
7175
7234
|
}
|
|
7176
|
-
__name(
|
|
7235
|
+
__name(_ts_param18, "_ts_param");
|
|
7177
7236
|
function isStoredInvitation(value) {
|
|
7178
7237
|
if (typeof value !== "object" || value === null) return false;
|
|
7179
7238
|
const v = value;
|
|
@@ -7264,7 +7323,7 @@ exports.InvitationService = class _InvitationService {
|
|
|
7264
7323
|
await this.redis.set(tokenKey, JSON.stringify(stored), ttl);
|
|
7265
7324
|
const displayTenantName = tenantName ?? tenantId;
|
|
7266
7325
|
const expiresAt = new Date(Date.now() + ttl * 1e3);
|
|
7267
|
-
await this.emailProvider.sendInvitation(normalizedEmail, {
|
|
7326
|
+
await this.emailProvider.sendInvitation(tenantId, normalizedEmail, {
|
|
7268
7327
|
inviterName: inviter.name,
|
|
7269
7328
|
tenantName: displayTenantName,
|
|
7270
7329
|
inviteToken: rawToken,
|
|
@@ -7600,18 +7659,18 @@ exports.InvitationService = class _InvitationService {
|
|
|
7600
7659
|
return result;
|
|
7601
7660
|
}
|
|
7602
7661
|
};
|
|
7603
|
-
exports.InvitationService =
|
|
7662
|
+
exports.InvitationService = _ts_decorate28([
|
|
7604
7663
|
common.Injectable(),
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7664
|
+
_ts_param18(0, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
7665
|
+
_ts_param18(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
7666
|
+
_ts_param18(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
7667
|
+
_ts_param18(3, common.Inject(AuthRedisService)),
|
|
7668
|
+
_ts_param18(4, common.Inject(PasswordService)),
|
|
7669
|
+
_ts_param18(5, common.Inject(exports.SessionService)),
|
|
7670
|
+
_ts_param18(6, common.Inject(TokenManagerService)),
|
|
7671
|
+
_ts_param18(7, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
7672
|
+
_ts_metadata27("design:type", Function),
|
|
7673
|
+
_ts_metadata27("design:paramtypes", [
|
|
7615
7674
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
7616
7675
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
7617
7676
|
typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
|
|
@@ -7624,23 +7683,23 @@ exports.InvitationService = _ts_decorate27([
|
|
|
7624
7683
|
], exports.InvitationService);
|
|
7625
7684
|
|
|
7626
7685
|
// src/server/controllers/invitation.controller.ts
|
|
7627
|
-
function
|
|
7686
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
7628
7687
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7629
7688
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7630
7689
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7631
7690
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7632
7691
|
}
|
|
7633
|
-
__name(
|
|
7634
|
-
function
|
|
7692
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
7693
|
+
function _ts_metadata28(k, v) {
|
|
7635
7694
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7636
7695
|
}
|
|
7637
|
-
__name(
|
|
7638
|
-
function
|
|
7696
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
7697
|
+
function _ts_param19(paramIndex, decorator) {
|
|
7639
7698
|
return function(target, key) {
|
|
7640
7699
|
decorator(target, key, paramIndex);
|
|
7641
7700
|
};
|
|
7642
7701
|
}
|
|
7643
|
-
__name(
|
|
7702
|
+
__name(_ts_param19, "_ts_param");
|
|
7644
7703
|
var InvitationController = class {
|
|
7645
7704
|
static {
|
|
7646
7705
|
__name(this, "InvitationController");
|
|
@@ -7716,64 +7775,64 @@ var InvitationController = class {
|
|
|
7716
7775
|
return this.tokenDelivery.deliverAuthResponse(res, result, req);
|
|
7717
7776
|
}
|
|
7718
7777
|
};
|
|
7719
|
-
|
|
7778
|
+
_ts_decorate29([
|
|
7720
7779
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
7721
7780
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
|
|
7722
7781
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
|
|
7723
7782
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
7724
7783
|
common.Post(),
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7784
|
+
_ts_param19(0, common.Body()),
|
|
7785
|
+
_ts_param19(1, CurrentUser()),
|
|
7786
|
+
_ts_metadata28("design:type", Function),
|
|
7787
|
+
_ts_metadata28("design:paramtypes", [
|
|
7729
7788
|
typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
|
|
7730
7789
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
7731
7790
|
]),
|
|
7732
|
-
|
|
7791
|
+
_ts_metadata28("design:returntype", Promise)
|
|
7733
7792
|
], InvitationController.prototype, "invite", null);
|
|
7734
|
-
|
|
7793
|
+
_ts_decorate29([
|
|
7735
7794
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
7736
7795
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
|
|
7737
7796
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
|
|
7738
7797
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
7739
7798
|
common.Post("revoke"),
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7799
|
+
_ts_param19(0, common.Body()),
|
|
7800
|
+
_ts_param19(1, CurrentUser()),
|
|
7801
|
+
_ts_metadata28("design:type", Function),
|
|
7802
|
+
_ts_metadata28("design:paramtypes", [
|
|
7744
7803
|
typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
|
|
7745
7804
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
7746
7805
|
]),
|
|
7747
|
-
|
|
7806
|
+
_ts_metadata28("design:returntype", Promise)
|
|
7748
7807
|
], InvitationController.prototype, "revoke", null);
|
|
7749
|
-
|
|
7808
|
+
_ts_decorate29([
|
|
7750
7809
|
Public(),
|
|
7751
7810
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
|
|
7752
7811
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
|
|
7753
7812
|
common.HttpCode(common.HttpStatus.CREATED),
|
|
7754
7813
|
common.Post("accept"),
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7814
|
+
_ts_param19(0, common.Body()),
|
|
7815
|
+
_ts_param19(1, common.Req()),
|
|
7816
|
+
_ts_param19(2, common.Res({
|
|
7758
7817
|
passthrough: true
|
|
7759
7818
|
})),
|
|
7760
|
-
|
|
7761
|
-
|
|
7819
|
+
_ts_metadata28("design:type", Function),
|
|
7820
|
+
_ts_metadata28("design:paramtypes", [
|
|
7762
7821
|
typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
|
|
7763
7822
|
typeof Request === "undefined" ? Object : Request,
|
|
7764
7823
|
typeof Response === "undefined" ? Object : Response
|
|
7765
7824
|
]),
|
|
7766
|
-
|
|
7825
|
+
_ts_metadata28("design:returntype", Promise)
|
|
7767
7826
|
], InvitationController.prototype, "accept", null);
|
|
7768
|
-
InvitationController =
|
|
7827
|
+
InvitationController = _ts_decorate29([
|
|
7769
7828
|
common.UseInterceptors(NoStoreInterceptor),
|
|
7770
7829
|
common.Controller("invitations"),
|
|
7771
7830
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
7772
7831
|
common.UsePipes(createAuthValidationPipe()),
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7832
|
+
_ts_param19(0, common.Inject(exports.InvitationService)),
|
|
7833
|
+
_ts_param19(1, common.Inject(exports.TokenDeliveryService)),
|
|
7834
|
+
_ts_metadata28("design:type", Function),
|
|
7835
|
+
_ts_metadata28("design:paramtypes", [
|
|
7777
7836
|
typeof exports.InvitationService === "undefined" ? Object : exports.InvitationService,
|
|
7778
7837
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
7779
7838
|
])
|
|
@@ -7784,17 +7843,17 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
|
|
|
7784
7843
|
var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
|
|
7785
7844
|
var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
|
|
7786
7845
|
var SkipMfa = /* @__PURE__ */ __name(() => common.SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
|
|
7787
|
-
function
|
|
7846
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
7788
7847
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7789
7848
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7790
7849
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7791
7850
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7792
7851
|
}
|
|
7793
|
-
__name(
|
|
7794
|
-
function
|
|
7852
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
7853
|
+
function _ts_metadata29(k, v) {
|
|
7795
7854
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7796
7855
|
}
|
|
7797
|
-
__name(
|
|
7856
|
+
__name(_ts_metadata29, "_ts_metadata");
|
|
7798
7857
|
var MfaChallengeDto = class {
|
|
7799
7858
|
static {
|
|
7800
7859
|
__name(this, "MfaChallengeDto");
|
|
@@ -7830,33 +7889,33 @@ var MfaChallengeDto = class {
|
|
|
7830
7889
|
*/
|
|
7831
7890
|
code;
|
|
7832
7891
|
};
|
|
7833
|
-
|
|
7892
|
+
_ts_decorate30([
|
|
7834
7893
|
classValidator.IsOptional(),
|
|
7835
7894
|
classValidator.IsString(),
|
|
7836
7895
|
classValidator.IsNotEmpty(),
|
|
7837
7896
|
classValidator.MaxLength(512),
|
|
7838
|
-
|
|
7897
|
+
_ts_metadata29("design:type", String)
|
|
7839
7898
|
], MfaChallengeDto.prototype, "mfaTempToken", void 0);
|
|
7840
|
-
|
|
7899
|
+
_ts_decorate30([
|
|
7841
7900
|
classValidator.Matches(/^(\d{6}|[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4})$/, {
|
|
7842
7901
|
message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
|
|
7843
7902
|
}),
|
|
7844
7903
|
classValidator.IsString(),
|
|
7845
7904
|
classValidator.IsNotEmpty(),
|
|
7846
7905
|
classValidator.MaxLength(29),
|
|
7847
|
-
|
|
7906
|
+
_ts_metadata29("design:type", String)
|
|
7848
7907
|
], MfaChallengeDto.prototype, "code", void 0);
|
|
7849
|
-
function
|
|
7908
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
7850
7909
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7851
7910
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7852
7911
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7853
7912
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7854
7913
|
}
|
|
7855
|
-
__name(
|
|
7856
|
-
function
|
|
7914
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
7915
|
+
function _ts_metadata30(k, v) {
|
|
7857
7916
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7858
7917
|
}
|
|
7859
|
-
__name(
|
|
7918
|
+
__name(_ts_metadata30, "_ts_metadata");
|
|
7860
7919
|
var MfaDisableDto = class {
|
|
7861
7920
|
static {
|
|
7862
7921
|
__name(this, "MfaDisableDto");
|
|
@@ -7870,26 +7929,26 @@ var MfaDisableDto = class {
|
|
|
7870
7929
|
*/
|
|
7871
7930
|
code;
|
|
7872
7931
|
};
|
|
7873
|
-
|
|
7932
|
+
_ts_decorate31([
|
|
7874
7933
|
classValidator.MaxLength(6),
|
|
7875
7934
|
classValidator.Matches(/^\d{6}$/, {
|
|
7876
7935
|
message: "code must be exactly 6 digits"
|
|
7877
7936
|
}),
|
|
7878
7937
|
classValidator.IsString(),
|
|
7879
7938
|
classValidator.IsNotEmpty(),
|
|
7880
|
-
|
|
7939
|
+
_ts_metadata30("design:type", String)
|
|
7881
7940
|
], MfaDisableDto.prototype, "code", void 0);
|
|
7882
|
-
function
|
|
7941
|
+
function _ts_decorate32(decorators, target, key, desc) {
|
|
7883
7942
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7884
7943
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7885
7944
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7886
7945
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7887
7946
|
}
|
|
7888
|
-
__name(
|
|
7889
|
-
function
|
|
7947
|
+
__name(_ts_decorate32, "_ts_decorate");
|
|
7948
|
+
function _ts_metadata31(k, v) {
|
|
7890
7949
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7891
7950
|
}
|
|
7892
|
-
__name(
|
|
7951
|
+
__name(_ts_metadata31, "_ts_metadata");
|
|
7893
7952
|
var MfaRegenerateRecoveryCodesDto = class {
|
|
7894
7953
|
static {
|
|
7895
7954
|
__name(this, "MfaRegenerateRecoveryCodesDto");
|
|
@@ -7903,26 +7962,26 @@ var MfaRegenerateRecoveryCodesDto = class {
|
|
|
7903
7962
|
*/
|
|
7904
7963
|
code;
|
|
7905
7964
|
};
|
|
7906
|
-
|
|
7965
|
+
_ts_decorate32([
|
|
7907
7966
|
classValidator.MaxLength(6),
|
|
7908
7967
|
classValidator.Matches(/^\d{6}$/, {
|
|
7909
7968
|
message: "code must be exactly 6 digits"
|
|
7910
7969
|
}),
|
|
7911
7970
|
classValidator.IsString(),
|
|
7912
7971
|
classValidator.IsNotEmpty(),
|
|
7913
|
-
|
|
7972
|
+
_ts_metadata31("design:type", String)
|
|
7914
7973
|
], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
|
|
7915
|
-
function
|
|
7974
|
+
function _ts_decorate33(decorators, target, key, desc) {
|
|
7916
7975
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7917
7976
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7918
7977
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7919
7978
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7920
7979
|
}
|
|
7921
|
-
__name(
|
|
7922
|
-
function
|
|
7980
|
+
__name(_ts_decorate33, "_ts_decorate");
|
|
7981
|
+
function _ts_metadata32(k, v) {
|
|
7923
7982
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7924
7983
|
}
|
|
7925
|
-
__name(
|
|
7984
|
+
__name(_ts_metadata32, "_ts_metadata");
|
|
7926
7985
|
var MfaSetupDto = class {
|
|
7927
7986
|
static {
|
|
7928
7987
|
__name(this, "MfaSetupDto");
|
|
@@ -7946,24 +8005,24 @@ var MfaSetupDto = class {
|
|
|
7946
8005
|
*/
|
|
7947
8006
|
password;
|
|
7948
8007
|
};
|
|
7949
|
-
|
|
8008
|
+
_ts_decorate33([
|
|
7950
8009
|
classValidator.IsOptional(),
|
|
7951
8010
|
classValidator.IsString(),
|
|
7952
8011
|
classValidator.MinLength(1),
|
|
7953
8012
|
classValidator.MaxLength(128),
|
|
7954
|
-
|
|
8013
|
+
_ts_metadata32("design:type", String)
|
|
7955
8014
|
], MfaSetupDto.prototype, "password", void 0);
|
|
7956
|
-
function
|
|
8015
|
+
function _ts_decorate34(decorators, target, key, desc) {
|
|
7957
8016
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7958
8017
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7959
8018
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7960
8019
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7961
8020
|
}
|
|
7962
|
-
__name(
|
|
7963
|
-
function
|
|
8021
|
+
__name(_ts_decorate34, "_ts_decorate");
|
|
8022
|
+
function _ts_metadata33(k, v) {
|
|
7964
8023
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7965
8024
|
}
|
|
7966
|
-
__name(
|
|
8025
|
+
__name(_ts_metadata33, "_ts_metadata");
|
|
7967
8026
|
var MfaVerifyDto = class {
|
|
7968
8027
|
static {
|
|
7969
8028
|
__name(this, "MfaVerifyDto");
|
|
@@ -7976,14 +8035,14 @@ var MfaVerifyDto = class {
|
|
|
7976
8035
|
*/
|
|
7977
8036
|
code;
|
|
7978
8037
|
};
|
|
7979
|
-
|
|
8038
|
+
_ts_decorate34([
|
|
7980
8039
|
classValidator.MaxLength(6),
|
|
7981
8040
|
classValidator.Matches(/^\d{6}$/, {
|
|
7982
8041
|
message: "code must be exactly 6 digits"
|
|
7983
8042
|
}),
|
|
7984
8043
|
classValidator.IsString(),
|
|
7985
8044
|
classValidator.IsNotEmpty(),
|
|
7986
|
-
|
|
8045
|
+
_ts_metadata33("design:type", String)
|
|
7987
8046
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
7988
8047
|
var IV_LENGTH = 12;
|
|
7989
8048
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
@@ -8035,23 +8094,28 @@ function decrypt(ciphertext, keyBase64) {
|
|
|
8035
8094
|
__name(decrypt, "decrypt");
|
|
8036
8095
|
|
|
8037
8096
|
// src/server/services/mfa.service.ts
|
|
8038
|
-
function
|
|
8097
|
+
function _ts_decorate35(decorators, target, key, desc) {
|
|
8039
8098
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8040
8099
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8041
8100
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8042
8101
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8043
8102
|
}
|
|
8044
|
-
__name(
|
|
8045
|
-
function
|
|
8103
|
+
__name(_ts_decorate35, "_ts_decorate");
|
|
8104
|
+
function _ts_metadata34(k, v) {
|
|
8046
8105
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8047
8106
|
}
|
|
8048
|
-
__name(
|
|
8049
|
-
function
|
|
8107
|
+
__name(_ts_metadata34, "_ts_metadata");
|
|
8108
|
+
function _ts_param20(paramIndex, decorator) {
|
|
8050
8109
|
return function(target, key) {
|
|
8051
8110
|
decorator(target, key, paramIndex);
|
|
8052
8111
|
};
|
|
8053
8112
|
}
|
|
8054
|
-
__name(
|
|
8113
|
+
__name(_ts_param20, "_ts_param");
|
|
8114
|
+
var PLATFORM_EMAIL_TENANT = "platform";
|
|
8115
|
+
function emailTenantOf(user) {
|
|
8116
|
+
return "tenantId" in user ? user.tenantId : PLATFORM_EMAIL_TENANT;
|
|
8117
|
+
}
|
|
8118
|
+
__name(emailTenantOf, "emailTenantOf");
|
|
8055
8119
|
var MFA_SETUP_TTL_SECONDS = 600;
|
|
8056
8120
|
var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
|
|
8057
8121
|
function totpAntiReplayTtlSeconds(window) {
|
|
@@ -8563,7 +8627,7 @@ exports.MfaService = class _MfaService {
|
|
|
8563
8627
|
await this.redis.invalidateUserSessions(userId, context);
|
|
8564
8628
|
await this.redis.bumpUserTokenEpoch(userId, context);
|
|
8565
8629
|
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId} context=${context}`);
|
|
8566
|
-
await this.emailProvider.sendMfaEnabledNotification(user.email);
|
|
8630
|
+
await this.emailProvider.sendMfaEnabledNotification(emailTenantOf(user), user.email);
|
|
8567
8631
|
if (this.hooks.afterMfaEnabled) {
|
|
8568
8632
|
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
8569
8633
|
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
@@ -8740,7 +8804,7 @@ exports.MfaService = class _MfaService {
|
|
|
8740
8804
|
await this.redis.invalidateUserSessions(userId, context);
|
|
8741
8805
|
await this.redis.bumpUserTokenEpoch(userId, context);
|
|
8742
8806
|
this.logger.log(`disable: MFA disabled userId=${userId} context=${context}`);
|
|
8743
|
-
await this.emailProvider.sendMfaDisabledNotification(user.email);
|
|
8807
|
+
await this.emailProvider.sendMfaDisabledNotification(emailTenantOf(user), user.email);
|
|
8744
8808
|
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
8745
8809
|
if (this.hooks.afterMfaDisabled) {
|
|
8746
8810
|
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
@@ -8806,7 +8870,7 @@ exports.MfaService = class _MfaService {
|
|
|
8806
8870
|
await this.redis.invalidateUserSessions(userId, context);
|
|
8807
8871
|
await this.redis.bumpUserTokenEpoch(userId, context);
|
|
8808
8872
|
this.logger.warn(`resetMfa: MFA removed administratively userId=${userId} context=${context}`);
|
|
8809
|
-
await this.emailProvider.sendMfaDisabledNotification(user.email);
|
|
8873
|
+
await this.emailProvider.sendMfaDisabledNotification(emailTenantOf(user), user.email);
|
|
8810
8874
|
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
8811
8875
|
if (this.hooks.afterMfaDisabled) {
|
|
8812
8876
|
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
@@ -9015,21 +9079,21 @@ exports.MfaService = class _MfaService {
|
|
|
9015
9079
|
return admin;
|
|
9016
9080
|
}
|
|
9017
9081
|
};
|
|
9018
|
-
exports.MfaService =
|
|
9082
|
+
exports.MfaService = _ts_decorate35([
|
|
9019
9083
|
common.Injectable(),
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9084
|
+
_ts_param20(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
9085
|
+
_ts_param20(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
9086
|
+
_ts_param20(2, common.Optional()),
|
|
9087
|
+
_ts_param20(2, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
9088
|
+
_ts_param20(3, common.Inject(AuthRedisService)),
|
|
9089
|
+
_ts_param20(4, common.Inject(TokenManagerService)),
|
|
9090
|
+
_ts_param20(5, common.Inject(exports.BruteForceService)),
|
|
9091
|
+
_ts_param20(6, common.Inject(PasswordService)),
|
|
9092
|
+
_ts_param20(7, common.Inject(exports.SessionService)),
|
|
9093
|
+
_ts_param20(8, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
9094
|
+
_ts_param20(9, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
9095
|
+
_ts_metadata34("design:type", Function),
|
|
9096
|
+
_ts_metadata34("design:paramtypes", [
|
|
9033
9097
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
9034
9098
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
9035
9099
|
Object,
|
|
@@ -9044,23 +9108,23 @@ exports.MfaService = _ts_decorate34([
|
|
|
9044
9108
|
], exports.MfaService);
|
|
9045
9109
|
|
|
9046
9110
|
// src/server/controllers/mfa.controller.ts
|
|
9047
|
-
function
|
|
9111
|
+
function _ts_decorate36(decorators, target, key, desc) {
|
|
9048
9112
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9049
9113
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9050
9114
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9051
9115
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9052
9116
|
}
|
|
9053
|
-
__name(
|
|
9054
|
-
function
|
|
9117
|
+
__name(_ts_decorate36, "_ts_decorate");
|
|
9118
|
+
function _ts_metadata35(k, v) {
|
|
9055
9119
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9056
9120
|
}
|
|
9057
|
-
__name(
|
|
9058
|
-
function
|
|
9121
|
+
__name(_ts_metadata35, "_ts_metadata");
|
|
9122
|
+
function _ts_param21(paramIndex, decorator) {
|
|
9059
9123
|
return function(target, key) {
|
|
9060
9124
|
decorator(target, key, paramIndex);
|
|
9061
9125
|
};
|
|
9062
9126
|
}
|
|
9063
|
-
__name(
|
|
9127
|
+
__name(_ts_param21, "_ts_param");
|
|
9064
9128
|
function isPlatformResult(result) {
|
|
9065
9129
|
return "admin" in result;
|
|
9066
9130
|
}
|
|
@@ -9249,120 +9313,120 @@ var MfaController = class {
|
|
|
9249
9313
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard");
|
|
9250
9314
|
}
|
|
9251
9315
|
};
|
|
9252
|
-
|
|
9316
|
+
_ts_decorate36([
|
|
9253
9317
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9254
9318
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
9255
9319
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
9256
9320
|
common.Post("setup"),
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9321
|
+
_ts_param21(0, CurrentUser()),
|
|
9322
|
+
_ts_param21(1, common.Body()),
|
|
9323
|
+
_ts_metadata35("design:type", Function),
|
|
9324
|
+
_ts_metadata35("design:paramtypes", [
|
|
9261
9325
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9262
9326
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
9263
9327
|
]),
|
|
9264
|
-
|
|
9328
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9265
9329
|
], MfaController.prototype, "setup", null);
|
|
9266
|
-
|
|
9330
|
+
_ts_decorate36([
|
|
9267
9331
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9268
9332
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
9269
9333
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
9270
9334
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
9271
9335
|
common.Post("verify-enable"),
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9336
|
+
_ts_param21(0, CurrentUser()),
|
|
9337
|
+
_ts_param21(1, common.Body()),
|
|
9338
|
+
_ts_param21(2, common.Req()),
|
|
9339
|
+
_ts_metadata35("design:type", Function),
|
|
9340
|
+
_ts_metadata35("design:paramtypes", [
|
|
9277
9341
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9278
9342
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
9279
9343
|
typeof Request === "undefined" ? Object : Request
|
|
9280
9344
|
]),
|
|
9281
|
-
|
|
9345
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9282
9346
|
], MfaController.prototype, "verifyEnable", null);
|
|
9283
|
-
|
|
9347
|
+
_ts_decorate36([
|
|
9284
9348
|
Public(),
|
|
9285
9349
|
SkipMfa(),
|
|
9286
9350
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
9287
9351
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
9288
9352
|
common.HttpCode(common.HttpStatus.OK),
|
|
9289
9353
|
common.Post("challenge"),
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9354
|
+
_ts_param21(0, common.Body()),
|
|
9355
|
+
_ts_param21(1, common.Req()),
|
|
9356
|
+
_ts_param21(2, common.Res({
|
|
9293
9357
|
passthrough: true
|
|
9294
9358
|
})),
|
|
9295
|
-
|
|
9296
|
-
|
|
9359
|
+
_ts_metadata35("design:type", Function),
|
|
9360
|
+
_ts_metadata35("design:paramtypes", [
|
|
9297
9361
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
9298
9362
|
typeof Request === "undefined" ? Object : Request,
|
|
9299
9363
|
typeof Response === "undefined" ? Object : Response
|
|
9300
9364
|
]),
|
|
9301
|
-
|
|
9365
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9302
9366
|
], MfaController.prototype, "challenge", null);
|
|
9303
|
-
|
|
9367
|
+
_ts_decorate36([
|
|
9304
9368
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9305
9369
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9306
9370
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9307
9371
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
9308
9372
|
common.Post("disable"),
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9373
|
+
_ts_param21(0, CurrentUser()),
|
|
9374
|
+
_ts_param21(1, common.Body()),
|
|
9375
|
+
_ts_param21(2, common.Req()),
|
|
9376
|
+
_ts_metadata35("design:type", Function),
|
|
9377
|
+
_ts_metadata35("design:paramtypes", [
|
|
9314
9378
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9315
9379
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
9316
9380
|
typeof Request === "undefined" ? Object : Request
|
|
9317
9381
|
]),
|
|
9318
|
-
|
|
9382
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9319
9383
|
], MfaController.prototype, "disable", null);
|
|
9320
|
-
|
|
9384
|
+
_ts_decorate36([
|
|
9321
9385
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9322
9386
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9323
9387
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9324
9388
|
common.HttpCode(common.HttpStatus.OK),
|
|
9325
9389
|
common.Post("recovery-codes"),
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9390
|
+
_ts_param21(0, CurrentUser()),
|
|
9391
|
+
_ts_param21(1, common.Body()),
|
|
9392
|
+
_ts_param21(2, common.Req()),
|
|
9393
|
+
_ts_metadata35("design:type", Function),
|
|
9394
|
+
_ts_metadata35("design:paramtypes", [
|
|
9331
9395
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9332
9396
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
9333
9397
|
typeof Request === "undefined" ? Object : Request
|
|
9334
9398
|
]),
|
|
9335
|
-
|
|
9399
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9336
9400
|
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
9337
|
-
MfaController =
|
|
9401
|
+
MfaController = _ts_decorate36([
|
|
9338
9402
|
common.UseInterceptors(NoStoreInterceptor),
|
|
9339
9403
|
common.Controller("mfa"),
|
|
9340
9404
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
9341
9405
|
common.UsePipes(createAuthValidationPipe({
|
|
9342
9406
|
forbidUnknownValues: true
|
|
9343
9407
|
})),
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9408
|
+
_ts_param21(0, common.Inject(exports.MfaService)),
|
|
9409
|
+
_ts_param21(1, common.Inject(exports.TokenDeliveryService)),
|
|
9410
|
+
_ts_param21(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
9411
|
+
_ts_metadata35("design:type", Function),
|
|
9412
|
+
_ts_metadata35("design:paramtypes", [
|
|
9349
9413
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
9350
9414
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
9351
9415
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
9352
9416
|
])
|
|
9353
9417
|
], MfaController);
|
|
9354
9418
|
var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
|
|
9355
|
-
function
|
|
9419
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
9356
9420
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9357
9421
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9358
9422
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9359
9423
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9360
9424
|
}
|
|
9361
|
-
__name(
|
|
9362
|
-
function
|
|
9425
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
9426
|
+
function _ts_metadata36(k, v) {
|
|
9363
9427
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9364
9428
|
}
|
|
9365
|
-
__name(
|
|
9429
|
+
__name(_ts_metadata36, "_ts_metadata");
|
|
9366
9430
|
var ChangePasswordDto = class {
|
|
9367
9431
|
static {
|
|
9368
9432
|
__name(this, "ChangePasswordDto");
|
|
@@ -9395,29 +9459,29 @@ var ChangePasswordDto = class {
|
|
|
9395
9459
|
*/
|
|
9396
9460
|
newPassword;
|
|
9397
9461
|
};
|
|
9398
|
-
|
|
9462
|
+
_ts_decorate37([
|
|
9399
9463
|
classValidator.IsString(),
|
|
9400
9464
|
classValidator.MinLength(1),
|
|
9401
9465
|
classValidator.MaxLength(128),
|
|
9402
|
-
|
|
9466
|
+
_ts_metadata36("design:type", String)
|
|
9403
9467
|
], ChangePasswordDto.prototype, "currentPassword", void 0);
|
|
9404
|
-
|
|
9468
|
+
_ts_decorate37([
|
|
9405
9469
|
classValidator.IsString(),
|
|
9406
9470
|
classValidator.MinLength(8),
|
|
9407
9471
|
classValidator.MaxLength(128),
|
|
9408
|
-
|
|
9472
|
+
_ts_metadata36("design:type", String)
|
|
9409
9473
|
], ChangePasswordDto.prototype, "newPassword", void 0);
|
|
9410
|
-
function
|
|
9474
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
9411
9475
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9412
9476
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9413
9477
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9414
9478
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9415
9479
|
}
|
|
9416
|
-
__name(
|
|
9417
|
-
function
|
|
9480
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
9481
|
+
function _ts_metadata37(k, v) {
|
|
9418
9482
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9419
9483
|
}
|
|
9420
|
-
__name(
|
|
9484
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
9421
9485
|
var ForgotPasswordDto = class {
|
|
9422
9486
|
static {
|
|
9423
9487
|
__name(this, "ForgotPasswordDto");
|
|
@@ -9433,32 +9497,33 @@ var ForgotPasswordDto = class {
|
|
|
9433
9497
|
*/
|
|
9434
9498
|
tenantId;
|
|
9435
9499
|
};
|
|
9436
|
-
|
|
9500
|
+
_ts_decorate38([
|
|
9437
9501
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9438
9502
|
classValidator.IsEmail(),
|
|
9439
9503
|
classValidator.MaxLength(255),
|
|
9440
|
-
|
|
9504
|
+
_ts_metadata37("design:type", String)
|
|
9441
9505
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
9442
|
-
|
|
9506
|
+
_ts_decorate38([
|
|
9507
|
+
classValidator.IsOptional(),
|
|
9443
9508
|
classValidator.IsString(),
|
|
9444
9509
|
classValidator.IsNotEmpty(),
|
|
9445
9510
|
classValidator.MaxLength(128),
|
|
9446
9511
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9447
9512
|
message: "tenantId must not contain control characters"
|
|
9448
9513
|
}),
|
|
9449
|
-
|
|
9514
|
+
_ts_metadata37("design:type", String)
|
|
9450
9515
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
9451
|
-
function
|
|
9516
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
9452
9517
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9453
9518
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9454
9519
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9455
9520
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9456
9521
|
}
|
|
9457
|
-
__name(
|
|
9458
|
-
function
|
|
9522
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
9523
|
+
function _ts_metadata38(k, v) {
|
|
9459
9524
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9460
9525
|
}
|
|
9461
|
-
__name(
|
|
9526
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
9462
9527
|
var ResendOtpDto = class {
|
|
9463
9528
|
static {
|
|
9464
9529
|
__name(this, "ResendOtpDto");
|
|
@@ -9473,32 +9538,33 @@ var ResendOtpDto = class {
|
|
|
9473
9538
|
*/
|
|
9474
9539
|
tenantId;
|
|
9475
9540
|
};
|
|
9476
|
-
|
|
9541
|
+
_ts_decorate39([
|
|
9477
9542
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9478
9543
|
classValidator.IsEmail(),
|
|
9479
9544
|
classValidator.MaxLength(255),
|
|
9480
|
-
|
|
9545
|
+
_ts_metadata38("design:type", String)
|
|
9481
9546
|
], ResendOtpDto.prototype, "email", void 0);
|
|
9482
|
-
|
|
9547
|
+
_ts_decorate39([
|
|
9548
|
+
classValidator.IsOptional(),
|
|
9483
9549
|
classValidator.IsString(),
|
|
9484
9550
|
classValidator.IsNotEmpty(),
|
|
9485
9551
|
classValidator.MaxLength(128),
|
|
9486
9552
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9487
9553
|
message: "tenantId must not contain control characters"
|
|
9488
9554
|
}),
|
|
9489
|
-
|
|
9555
|
+
_ts_metadata38("design:type", String)
|
|
9490
9556
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
9491
|
-
function
|
|
9557
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
9492
9558
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9493
9559
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9494
9560
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9495
9561
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9496
9562
|
}
|
|
9497
|
-
__name(
|
|
9498
|
-
function
|
|
9563
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
9564
|
+
function _ts_metadata39(k, v) {
|
|
9499
9565
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9500
9566
|
}
|
|
9501
|
-
__name(
|
|
9567
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
9502
9568
|
var ResetPasswordDto = class {
|
|
9503
9569
|
static {
|
|
9504
9570
|
__name(this, "ResetPasswordDto");
|
|
@@ -9545,57 +9611,58 @@ var ResetPasswordDto = class {
|
|
|
9545
9611
|
*/
|
|
9546
9612
|
tenantId;
|
|
9547
9613
|
};
|
|
9548
|
-
|
|
9614
|
+
_ts_decorate40([
|
|
9549
9615
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9550
9616
|
classValidator.IsEmail(),
|
|
9551
9617
|
classValidator.MaxLength(255),
|
|
9552
|
-
|
|
9618
|
+
_ts_metadata39("design:type", String)
|
|
9553
9619
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
9554
|
-
|
|
9620
|
+
_ts_decorate40([
|
|
9555
9621
|
classValidator.IsString(),
|
|
9556
9622
|
classValidator.MinLength(8),
|
|
9557
9623
|
classValidator.MaxLength(128),
|
|
9558
|
-
|
|
9624
|
+
_ts_metadata39("design:type", String)
|
|
9559
9625
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
9560
|
-
|
|
9626
|
+
_ts_decorate40([
|
|
9561
9627
|
classValidator.IsOptional(),
|
|
9562
9628
|
classValidator.IsString(),
|
|
9563
9629
|
classValidator.IsNotEmpty(),
|
|
9564
9630
|
classValidator.MaxLength(2048),
|
|
9565
|
-
|
|
9631
|
+
_ts_metadata39("design:type", String)
|
|
9566
9632
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
9567
|
-
|
|
9633
|
+
_ts_decorate40([
|
|
9568
9634
|
classValidator.IsOptional(),
|
|
9569
9635
|
classValidator.IsString(),
|
|
9570
9636
|
classValidator.Length(4, 8),
|
|
9571
|
-
|
|
9637
|
+
_ts_metadata39("design:type", String)
|
|
9572
9638
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
9573
|
-
|
|
9639
|
+
_ts_decorate40([
|
|
9574
9640
|
classValidator.IsOptional(),
|
|
9575
9641
|
classValidator.IsString(),
|
|
9576
9642
|
classValidator.Length(64, 64),
|
|
9577
|
-
|
|
9643
|
+
_ts_metadata39("design:type", String)
|
|
9578
9644
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
9579
|
-
|
|
9645
|
+
_ts_decorate40([
|
|
9646
|
+
classValidator.IsOptional(),
|
|
9580
9647
|
classValidator.IsString(),
|
|
9581
9648
|
classValidator.IsNotEmpty(),
|
|
9582
9649
|
classValidator.MaxLength(128),
|
|
9583
9650
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9584
9651
|
message: "tenantId must not contain control characters"
|
|
9585
9652
|
}),
|
|
9586
|
-
|
|
9653
|
+
_ts_metadata39("design:type", String)
|
|
9587
9654
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
9588
|
-
function
|
|
9655
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
9589
9656
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9590
9657
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9591
9658
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9592
9659
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9593
9660
|
}
|
|
9594
|
-
__name(
|
|
9595
|
-
function
|
|
9661
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
9662
|
+
function _ts_metadata40(k, v) {
|
|
9596
9663
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9597
9664
|
}
|
|
9598
|
-
__name(
|
|
9665
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
9599
9666
|
var VerifyOtpDto = class {
|
|
9600
9667
|
static {
|
|
9601
9668
|
__name(this, "VerifyOtpDto");
|
|
@@ -9617,43 +9684,44 @@ var VerifyOtpDto = class {
|
|
|
9617
9684
|
*/
|
|
9618
9685
|
tenantId;
|
|
9619
9686
|
};
|
|
9620
|
-
|
|
9687
|
+
_ts_decorate41([
|
|
9621
9688
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9622
9689
|
classValidator.IsEmail(),
|
|
9623
9690
|
classValidator.MaxLength(255),
|
|
9624
|
-
|
|
9691
|
+
_ts_metadata40("design:type", String)
|
|
9625
9692
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
9626
|
-
|
|
9693
|
+
_ts_decorate41([
|
|
9627
9694
|
classValidator.IsString(),
|
|
9628
9695
|
classValidator.Length(4, 8),
|
|
9629
|
-
|
|
9696
|
+
_ts_metadata40("design:type", String)
|
|
9630
9697
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
9631
|
-
|
|
9698
|
+
_ts_decorate41([
|
|
9699
|
+
classValidator.IsOptional(),
|
|
9632
9700
|
classValidator.IsString(),
|
|
9633
9701
|
classValidator.IsNotEmpty(),
|
|
9634
9702
|
classValidator.MaxLength(128),
|
|
9635
9703
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9636
9704
|
message: "tenantId must not contain control characters"
|
|
9637
9705
|
}),
|
|
9638
|
-
|
|
9706
|
+
_ts_metadata40("design:type", String)
|
|
9639
9707
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
9640
|
-
function
|
|
9708
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
9641
9709
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9642
9710
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9643
9711
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9644
9712
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9645
9713
|
}
|
|
9646
|
-
__name(
|
|
9647
|
-
function
|
|
9714
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
9715
|
+
function _ts_metadata41(k, v) {
|
|
9648
9716
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9649
9717
|
}
|
|
9650
|
-
__name(
|
|
9651
|
-
function
|
|
9718
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
9719
|
+
function _ts_param22(paramIndex, decorator) {
|
|
9652
9720
|
return function(target, key) {
|
|
9653
9721
|
decorator(target, key, paramIndex);
|
|
9654
9722
|
};
|
|
9655
9723
|
}
|
|
9656
|
-
__name(
|
|
9724
|
+
__name(_ts_param22, "_ts_param");
|
|
9657
9725
|
var ANTI_ENUM_MIN_MS2 = 300;
|
|
9658
9726
|
var VERIFIED_TOKEN_TTL_SECONDS = 300;
|
|
9659
9727
|
var PASSWORD_RESET_PURPOSE = "password_reset";
|
|
@@ -9714,20 +9782,20 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
9714
9782
|
email: normalizeEmail(dto.email)
|
|
9715
9783
|
};
|
|
9716
9784
|
const start = Date.now();
|
|
9717
|
-
const cooldownKey = `resend:${PASSWORD_RESET_PURPOSE}:${this.otpIdentifier(
|
|
9785
|
+
const cooldownKey = `resend:${PASSWORD_RESET_PURPOSE}:${this.otpIdentifier(tenantId, dto.email)}`;
|
|
9718
9786
|
const wasSet = await this.redis.setnx(cooldownKey, RESEND_COOLDOWN_SECONDS);
|
|
9719
9787
|
if (!wasSet) {
|
|
9720
9788
|
await sleep(Math.max(0, ANTI_ENUM_MIN_MS2 - (Date.now() - start)));
|
|
9721
9789
|
return;
|
|
9722
9790
|
}
|
|
9723
9791
|
try {
|
|
9724
|
-
const user = tenantScoped(await this.userRepo.findByEmail(dto.email,
|
|
9792
|
+
const user = tenantScoped(await this.userRepo.findByEmail(dto.email, tenantId), tenantId);
|
|
9725
9793
|
if (user && !this.isBlocked(user.status)) {
|
|
9726
9794
|
const { method } = this.options.passwordReset;
|
|
9727
9795
|
if (method === "otp") {
|
|
9728
|
-
await this.sendOtp(dto.email,
|
|
9796
|
+
await this.sendOtp(dto.email, tenantId, user.id);
|
|
9729
9797
|
} else {
|
|
9730
|
-
await this.sendToken(dto.email,
|
|
9798
|
+
await this.sendToken(dto.email, tenantId, user.id);
|
|
9731
9799
|
}
|
|
9732
9800
|
}
|
|
9733
9801
|
} catch (err) {
|
|
@@ -9777,18 +9845,18 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
9777
9845
|
if (!dto.token) {
|
|
9778
9846
|
throw new AuthException(AUTH_ERROR_CODES.PASSWORD_RESET_TOKEN_INVALID);
|
|
9779
9847
|
}
|
|
9780
|
-
await this.resetWithToken(dto.email,
|
|
9848
|
+
await this.resetWithToken(dto.email, tenantId, dto.token, dto.newPassword);
|
|
9781
9849
|
return;
|
|
9782
9850
|
}
|
|
9783
9851
|
if (dto.token) {
|
|
9784
9852
|
throw new AuthException(AUTH_ERROR_CODES.PASSWORD_RESET_TOKEN_INVALID);
|
|
9785
9853
|
}
|
|
9786
9854
|
if (dto.verifiedToken) {
|
|
9787
|
-
await this.resetWithVerifiedToken(dto.email,
|
|
9855
|
+
await this.resetWithVerifiedToken(dto.email, tenantId, dto.verifiedToken, dto.newPassword);
|
|
9788
9856
|
return;
|
|
9789
9857
|
}
|
|
9790
9858
|
if (dto.otp) {
|
|
9791
|
-
await this.resetWithOtp(dto.email,
|
|
9859
|
+
await this.resetWithOtp(dto.email, tenantId, dto.otp, dto.newPassword);
|
|
9792
9860
|
return;
|
|
9793
9861
|
}
|
|
9794
9862
|
throw new AuthException(AUTH_ERROR_CODES.PASSWORD_RESET_TOKEN_INVALID);
|
|
@@ -9817,9 +9885,9 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
9817
9885
|
tenantId,
|
|
9818
9886
|
email: normalizeEmail(dto.email)
|
|
9819
9887
|
};
|
|
9820
|
-
const identifier = this.otpIdentifier(
|
|
9888
|
+
const identifier = this.otpIdentifier(tenantId, dto.email);
|
|
9821
9889
|
await this.otpService.verify(PASSWORD_RESET_PURPOSE, identifier, dto.otp);
|
|
9822
|
-
const user = tenantScoped(await this.userRepo.findByEmail(dto.email,
|
|
9890
|
+
const user = tenantScoped(await this.userRepo.findByEmail(dto.email, tenantId), tenantId);
|
|
9823
9891
|
if (!user) {
|
|
9824
9892
|
throw new AuthException(AUTH_ERROR_CODES.PASSWORD_RESET_TOKEN_INVALID);
|
|
9825
9893
|
}
|
|
@@ -9827,7 +9895,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
9827
9895
|
const context = {
|
|
9828
9896
|
userId: user.id,
|
|
9829
9897
|
email: dto.email,
|
|
9830
|
-
tenantId
|
|
9898
|
+
tenantId,
|
|
9831
9899
|
passwordFingerprint: await this.passwordFingerprintOf(user.id)
|
|
9832
9900
|
};
|
|
9833
9901
|
await this.redis.set(`pw_vtok:${sha256(rawVerifiedToken)}`, JSON.stringify(context), VERIFIED_TOKEN_TTL_SECONDS);
|
|
@@ -9852,7 +9920,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
9852
9920
|
email: normalizeEmail(dto.email)
|
|
9853
9921
|
};
|
|
9854
9922
|
const start = Date.now();
|
|
9855
|
-
const identifier = this.otpIdentifier(
|
|
9923
|
+
const identifier = this.otpIdentifier(tenantId, dto.email);
|
|
9856
9924
|
const cooldownKey = `resend:${PASSWORD_RESET_PURPOSE}:${identifier}`;
|
|
9857
9925
|
const wasSet = await this.redis.setnx(cooldownKey, RESEND_COOLDOWN_SECONDS);
|
|
9858
9926
|
if (!wasSet) {
|
|
@@ -9860,9 +9928,9 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
9860
9928
|
return;
|
|
9861
9929
|
}
|
|
9862
9930
|
try {
|
|
9863
|
-
const user = tenantScoped(await this.userRepo.findByEmail(dto.email,
|
|
9931
|
+
const user = tenantScoped(await this.userRepo.findByEmail(dto.email, tenantId), tenantId);
|
|
9864
9932
|
if (user && !this.isBlocked(user.status)) {
|
|
9865
|
-
await this.sendOtp(dto.email,
|
|
9933
|
+
await this.sendOtp(dto.email, tenantId, user.id);
|
|
9866
9934
|
}
|
|
9867
9935
|
} catch (err) {
|
|
9868
9936
|
this.logger.error("resendOtp: unexpected error", err);
|
|
@@ -10015,7 +10083,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10015
10083
|
async notifyPasswordChanged(user) {
|
|
10016
10084
|
const send = this.emailProvider?.sendPasswordChangedNotification;
|
|
10017
10085
|
if (send === void 0) return;
|
|
10018
|
-
void Promise.resolve(send.call(this.emailProvider, user.email)).catch((err) => {
|
|
10086
|
+
void Promise.resolve(send.call(this.emailProvider, user.tenantId, user.email)).catch((err) => {
|
|
10019
10087
|
this.logger.error("notifyPasswordChanged: delivery failed", err);
|
|
10020
10088
|
});
|
|
10021
10089
|
}
|
|
@@ -10086,7 +10154,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10086
10154
|
passwordFingerprint: await this.passwordFingerprintOf(userId)
|
|
10087
10155
|
};
|
|
10088
10156
|
await this.redis.set(tokenKey, JSON.stringify(context), this.options.passwordReset.tokenTtlSeconds);
|
|
10089
|
-
void Promise.resolve(this.emailProvider.sendPasswordResetToken(email, rawToken)).catch((err) => {
|
|
10157
|
+
void Promise.resolve(this.emailProvider.sendPasswordResetToken(tenantId, email, rawToken)).catch((err) => {
|
|
10090
10158
|
this.logger.error(`sendPasswordResetToken failed for user ${userId}`, err);
|
|
10091
10159
|
void this.redis.del(tokenKey).catch((delErr) => {
|
|
10092
10160
|
this.logger.error(`pw_reset rollback delete failed for user ${userId}`, delErr);
|
|
@@ -10106,7 +10174,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10106
10174
|
const identifier = this.otpIdentifier(tenantId, email);
|
|
10107
10175
|
const otp = this.otpService.generate(otpLength);
|
|
10108
10176
|
await this.otpService.store(PASSWORD_RESET_PURPOSE, identifier, otp, otpTtlSeconds);
|
|
10109
|
-
void Promise.resolve(this.emailProvider.sendPasswordResetOtp(email, otp)).catch((err) => {
|
|
10177
|
+
void Promise.resolve(this.emailProvider.sendPasswordResetOtp(tenantId, email, otp)).catch((err) => {
|
|
10110
10178
|
this.logger.error(`sendPasswordResetOtp failed for user ${userId}`, err);
|
|
10111
10179
|
});
|
|
10112
10180
|
}
|
|
@@ -10166,21 +10234,21 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10166
10234
|
};
|
|
10167
10235
|
}
|
|
10168
10236
|
};
|
|
10169
|
-
exports.PasswordResetService =
|
|
10237
|
+
exports.PasswordResetService = _ts_decorate42([
|
|
10170
10238
|
common.Injectable(),
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10239
|
+
_ts_param22(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10240
|
+
_ts_param22(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
10241
|
+
_ts_param22(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
10242
|
+
_ts_param22(2, common.Optional()),
|
|
10243
|
+
_ts_param22(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
10244
|
+
_ts_param22(3, common.Optional()),
|
|
10245
|
+
_ts_param22(4, common.Inject(exports.OtpService)),
|
|
10246
|
+
_ts_param22(5, common.Inject(PasswordService)),
|
|
10247
|
+
_ts_param22(6, common.Inject(AuthRedisService)),
|
|
10248
|
+
_ts_param22(7, common.Inject(exports.SessionService)),
|
|
10249
|
+
_ts_param22(8, common.Inject(exports.BruteForceService)),
|
|
10250
|
+
_ts_metadata41("design:type", Function),
|
|
10251
|
+
_ts_metadata41("design:paramtypes", [
|
|
10184
10252
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
10185
10253
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
10186
10254
|
Object,
|
|
@@ -10199,23 +10267,23 @@ function toSafeUser3(user) {
|
|
|
10199
10267
|
__name(toSafeUser3, "toSafeUser");
|
|
10200
10268
|
|
|
10201
10269
|
// src/server/controllers/password-reset.controller.ts
|
|
10202
|
-
function
|
|
10270
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
10203
10271
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10204
10272
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10205
10273
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10206
10274
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10207
10275
|
}
|
|
10208
|
-
__name(
|
|
10209
|
-
function
|
|
10276
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
10277
|
+
function _ts_metadata42(k, v) {
|
|
10210
10278
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10211
10279
|
}
|
|
10212
|
-
__name(
|
|
10213
|
-
function
|
|
10280
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
10281
|
+
function _ts_param23(paramIndex, decorator) {
|
|
10214
10282
|
return function(target, key) {
|
|
10215
10283
|
decorator(target, key, paramIndex);
|
|
10216
10284
|
};
|
|
10217
10285
|
}
|
|
10218
|
-
__name(
|
|
10286
|
+
__name(_ts_param23, "_ts_param");
|
|
10219
10287
|
var PasswordResetController = class {
|
|
10220
10288
|
static {
|
|
10221
10289
|
__name(this, "PasswordResetController");
|
|
@@ -10326,105 +10394,105 @@ var PasswordResetController = class {
|
|
|
10326
10394
|
await this.passwordResetService.resendOtp(dto, req);
|
|
10327
10395
|
}
|
|
10328
10396
|
};
|
|
10329
|
-
|
|
10397
|
+
_ts_decorate43([
|
|
10330
10398
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
10331
10399
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
10332
10400
|
common.HttpCode(common.HttpStatus.OK),
|
|
10333
10401
|
common.Post("forgot-password"),
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10402
|
+
_ts_param23(0, common.Body()),
|
|
10403
|
+
_ts_param23(1, common.Req()),
|
|
10404
|
+
_ts_metadata42("design:type", Function),
|
|
10405
|
+
_ts_metadata42("design:paramtypes", [
|
|
10338
10406
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
|
|
10339
10407
|
typeof Request === "undefined" ? Object : Request
|
|
10340
10408
|
]),
|
|
10341
|
-
|
|
10409
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10342
10410
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
10343
|
-
|
|
10411
|
+
_ts_decorate43([
|
|
10344
10412
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
10345
10413
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
10346
10414
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
10347
10415
|
common.Post("reset-password"),
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10416
|
+
_ts_param23(0, common.Body()),
|
|
10417
|
+
_ts_param23(1, common.Req()),
|
|
10418
|
+
_ts_metadata42("design:type", Function),
|
|
10419
|
+
_ts_metadata42("design:paramtypes", [
|
|
10352
10420
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
|
|
10353
10421
|
typeof Request === "undefined" ? Object : Request
|
|
10354
10422
|
]),
|
|
10355
|
-
|
|
10423
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10356
10424
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
10357
|
-
|
|
10425
|
+
_ts_decorate43([
|
|
10358
10426
|
Authenticated(),
|
|
10359
10427
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
10360
10428
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
10361
10429
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
10362
10430
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
10363
10431
|
common.Post("change"),
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10432
|
+
_ts_param23(0, CurrentUser()),
|
|
10433
|
+
_ts_param23(1, common.Body()),
|
|
10434
|
+
_ts_param23(2, common.Req()),
|
|
10435
|
+
_ts_metadata42("design:type", Function),
|
|
10436
|
+
_ts_metadata42("design:paramtypes", [
|
|
10369
10437
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
10370
10438
|
typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
|
|
10371
10439
|
typeof Request === "undefined" ? Object : Request
|
|
10372
10440
|
]),
|
|
10373
|
-
|
|
10441
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10374
10442
|
], PasswordResetController.prototype, "changePassword", null);
|
|
10375
|
-
|
|
10443
|
+
_ts_decorate43([
|
|
10376
10444
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
10377
10445
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
10378
10446
|
common.HttpCode(common.HttpStatus.OK),
|
|
10379
10447
|
common.Post("verify-otp"),
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10448
|
+
_ts_param23(0, common.Body()),
|
|
10449
|
+
_ts_param23(1, common.Req()),
|
|
10450
|
+
_ts_metadata42("design:type", Function),
|
|
10451
|
+
_ts_metadata42("design:paramtypes", [
|
|
10384
10452
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
|
|
10385
10453
|
typeof Request === "undefined" ? Object : Request
|
|
10386
10454
|
]),
|
|
10387
|
-
|
|
10455
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10388
10456
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
10389
|
-
|
|
10457
|
+
_ts_decorate43([
|
|
10390
10458
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
10391
10459
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
10392
10460
|
common.HttpCode(common.HttpStatus.OK),
|
|
10393
10461
|
common.Post("resend-otp"),
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10462
|
+
_ts_param23(0, common.Body()),
|
|
10463
|
+
_ts_param23(1, common.Req()),
|
|
10464
|
+
_ts_metadata42("design:type", Function),
|
|
10465
|
+
_ts_metadata42("design:paramtypes", [
|
|
10398
10466
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
|
|
10399
10467
|
typeof Request === "undefined" ? Object : Request
|
|
10400
10468
|
]),
|
|
10401
|
-
|
|
10469
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10402
10470
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
10403
|
-
PasswordResetController =
|
|
10471
|
+
PasswordResetController = _ts_decorate43([
|
|
10404
10472
|
Public(),
|
|
10405
10473
|
common.UseInterceptors(NoStoreInterceptor),
|
|
10406
10474
|
common.Controller("password"),
|
|
10407
10475
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
10408
10476
|
common.UsePipes(createAuthValidationPipe()),
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10477
|
+
_ts_param23(0, common.Inject(exports.PasswordResetService)),
|
|
10478
|
+
_ts_param23(1, common.Inject(exports.TokenDeliveryService)),
|
|
10479
|
+
_ts_metadata42("design:type", Function),
|
|
10480
|
+
_ts_metadata42("design:paramtypes", [
|
|
10413
10481
|
typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
|
|
10414
10482
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
10415
10483
|
])
|
|
10416
10484
|
], PasswordResetController);
|
|
10417
|
-
function
|
|
10485
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
10418
10486
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10419
10487
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10420
10488
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10421
10489
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10422
10490
|
}
|
|
10423
|
-
__name(
|
|
10424
|
-
function
|
|
10491
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
10492
|
+
function _ts_metadata43(k, v) {
|
|
10425
10493
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10426
10494
|
}
|
|
10427
|
-
__name(
|
|
10495
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
10428
10496
|
var PlatformLoginDto = class {
|
|
10429
10497
|
static {
|
|
10430
10498
|
__name(this, "PlatformLoginDto");
|
|
@@ -10452,14 +10520,14 @@ var PlatformLoginDto = class {
|
|
|
10452
10520
|
*/
|
|
10453
10521
|
password;
|
|
10454
10522
|
};
|
|
10455
|
-
|
|
10523
|
+
_ts_decorate44([
|
|
10456
10524
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
10457
10525
|
classValidator.IsEmail(),
|
|
10458
10526
|
classValidator.IsNotEmpty(),
|
|
10459
10527
|
classValidator.MaxLength(255),
|
|
10460
|
-
|
|
10528
|
+
_ts_metadata43("design:type", String)
|
|
10461
10529
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
10462
|
-
|
|
10530
|
+
_ts_decorate44([
|
|
10463
10531
|
classValidator.IsString(),
|
|
10464
10532
|
classValidator.IsNotEmpty(),
|
|
10465
10533
|
classValidator.Matches(/\S/, {
|
|
@@ -10467,38 +10535,38 @@ _ts_decorate43([
|
|
|
10467
10535
|
}),
|
|
10468
10536
|
classValidator.MinLength(1),
|
|
10469
10537
|
classValidator.MaxLength(128),
|
|
10470
|
-
|
|
10538
|
+
_ts_metadata43("design:type", String)
|
|
10471
10539
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
10472
|
-
function
|
|
10540
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
10473
10541
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10474
10542
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10475
10543
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10476
10544
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10477
10545
|
}
|
|
10478
|
-
__name(
|
|
10479
|
-
function
|
|
10546
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
10547
|
+
function _ts_metadata44(k, v) {
|
|
10480
10548
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10481
10549
|
}
|
|
10482
|
-
__name(
|
|
10483
|
-
function
|
|
10550
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
10551
|
+
function _ts_param24(paramIndex, decorator) {
|
|
10484
10552
|
return function(target, key) {
|
|
10485
10553
|
decorator(target, key, paramIndex);
|
|
10486
10554
|
};
|
|
10487
10555
|
}
|
|
10488
|
-
__name(
|
|
10556
|
+
__name(_ts_param24, "_ts_param");
|
|
10489
10557
|
exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
10490
10558
|
static {
|
|
10491
10559
|
__name(this, "JwtPlatformGuard");
|
|
10492
10560
|
}
|
|
10493
10561
|
jwtService;
|
|
10494
10562
|
tokenDelivery;
|
|
10495
|
-
|
|
10563
|
+
revocation;
|
|
10496
10564
|
reflector;
|
|
10497
10565
|
options;
|
|
10498
|
-
constructor(jwtService, tokenDelivery,
|
|
10566
|
+
constructor(jwtService, tokenDelivery, revocation, reflector, options) {
|
|
10499
10567
|
this.jwtService = jwtService;
|
|
10500
10568
|
this.tokenDelivery = tokenDelivery;
|
|
10501
|
-
this.
|
|
10569
|
+
this.revocation = revocation;
|
|
10502
10570
|
this.reflector = reflector;
|
|
10503
10571
|
this.options = options;
|
|
10504
10572
|
}
|
|
@@ -10524,51 +10592,46 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
|
10524
10592
|
if (payload.type !== "platform") {
|
|
10525
10593
|
throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
|
|
10526
10594
|
}
|
|
10527
|
-
|
|
10528
|
-
if (revoked !== null) {
|
|
10529
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10530
|
-
}
|
|
10531
|
-
const epoch = await this.redis.getUserTokenEpoch(payload.sub, "platform");
|
|
10532
|
-
if (readStampedEpoch(payload) < epoch) {
|
|
10595
|
+
if (await this.revocation.isAccessTokenRevoked(payload, "platform")) {
|
|
10533
10596
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10534
10597
|
}
|
|
10535
10598
|
request.user = payload;
|
|
10536
10599
|
return true;
|
|
10537
10600
|
}
|
|
10538
10601
|
};
|
|
10539
|
-
exports.JwtPlatformGuard =
|
|
10602
|
+
exports.JwtPlatformGuard = _ts_decorate45([
|
|
10540
10603
|
common.Injectable(),
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10604
|
+
_ts_param24(0, common.Inject(jwt.JwtService)),
|
|
10605
|
+
_ts_param24(1, common.Inject(exports.TokenDeliveryService)),
|
|
10606
|
+
_ts_param24(2, common.Inject(exports.AuthRevocationService)),
|
|
10607
|
+
_ts_param24(3, common.Inject(core.Reflector)),
|
|
10608
|
+
_ts_param24(4, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10609
|
+
_ts_metadata44("design:type", Function),
|
|
10610
|
+
_ts_metadata44("design:paramtypes", [
|
|
10548
10611
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
10549
10612
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
10550
|
-
typeof
|
|
10613
|
+
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
10551
10614
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
10552
10615
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
10553
10616
|
])
|
|
10554
10617
|
], exports.JwtPlatformGuard);
|
|
10555
|
-
function
|
|
10618
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
10556
10619
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10557
10620
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10558
10621
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10559
10622
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10560
10623
|
}
|
|
10561
|
-
__name(
|
|
10562
|
-
function
|
|
10624
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
10625
|
+
function _ts_metadata45(k, v) {
|
|
10563
10626
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10564
10627
|
}
|
|
10565
|
-
__name(
|
|
10566
|
-
function
|
|
10628
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
10629
|
+
function _ts_param25(paramIndex, decorator) {
|
|
10567
10630
|
return function(target, key) {
|
|
10568
10631
|
decorator(target, key, paramIndex);
|
|
10569
10632
|
};
|
|
10570
10633
|
}
|
|
10571
|
-
__name(
|
|
10634
|
+
__name(_ts_param25, "_ts_param");
|
|
10572
10635
|
exports.PlatformAuthService = class _PlatformAuthService {
|
|
10573
10636
|
static {
|
|
10574
10637
|
__name(this, "PlatformAuthService");
|
|
@@ -10790,16 +10853,16 @@ exports.PlatformAuthService = class _PlatformAuthService {
|
|
|
10790
10853
|
await this.redis.bumpUserTokenEpoch(userId, "platform");
|
|
10791
10854
|
}
|
|
10792
10855
|
};
|
|
10793
|
-
exports.PlatformAuthService =
|
|
10856
|
+
exports.PlatformAuthService = _ts_decorate46([
|
|
10794
10857
|
common.Injectable(),
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10858
|
+
_ts_param25(0, common.Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
10859
|
+
_ts_param25(1, common.Inject(PasswordService)),
|
|
10860
|
+
_ts_param25(2, common.Inject(TokenManagerService)),
|
|
10861
|
+
_ts_param25(3, common.Inject(exports.BruteForceService)),
|
|
10862
|
+
_ts_param25(4, common.Inject(AuthRedisService)),
|
|
10863
|
+
_ts_param25(5, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10864
|
+
_ts_metadata45("design:type", Function),
|
|
10865
|
+
_ts_metadata45("design:paramtypes", [
|
|
10803
10866
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
10804
10867
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
10805
10868
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -10810,23 +10873,23 @@ exports.PlatformAuthService = _ts_decorate45([
|
|
|
10810
10873
|
], exports.PlatformAuthService);
|
|
10811
10874
|
|
|
10812
10875
|
// src/server/controllers/platform-auth.controller.ts
|
|
10813
|
-
function
|
|
10876
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
10814
10877
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10815
10878
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10816
10879
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10817
10880
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10818
10881
|
}
|
|
10819
|
-
__name(
|
|
10820
|
-
function
|
|
10882
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
10883
|
+
function _ts_metadata46(k, v) {
|
|
10821
10884
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10822
10885
|
}
|
|
10823
|
-
__name(
|
|
10824
|
-
function
|
|
10886
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
10887
|
+
function _ts_param26(paramIndex, decorator) {
|
|
10825
10888
|
return function(target, key) {
|
|
10826
10889
|
decorator(target, key, paramIndex);
|
|
10827
10890
|
};
|
|
10828
10891
|
}
|
|
10829
|
-
__name(
|
|
10892
|
+
__name(_ts_param26, "_ts_param");
|
|
10830
10893
|
function isPlatformResult2(result) {
|
|
10831
10894
|
return "admin" in result;
|
|
10832
10895
|
}
|
|
@@ -10986,117 +11049,117 @@ var PlatformAuthController = class {
|
|
|
10986
11049
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
10987
11050
|
}
|
|
10988
11051
|
};
|
|
10989
|
-
|
|
11052
|
+
_ts_decorate47([
|
|
10990
11053
|
Public(),
|
|
10991
11054
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
10992
11055
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
10993
11056
|
common.HttpCode(common.HttpStatus.OK),
|
|
10994
11057
|
common.Post("login"),
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
11058
|
+
_ts_param26(0, common.Body()),
|
|
11059
|
+
_ts_param26(1, common.Req()),
|
|
11060
|
+
_ts_metadata46("design:type", Function),
|
|
11061
|
+
_ts_metadata46("design:paramtypes", [
|
|
10999
11062
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
11000
11063
|
typeof Request === "undefined" ? Object : Request
|
|
11001
11064
|
]),
|
|
11002
|
-
|
|
11065
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11003
11066
|
], PlatformAuthController.prototype, "login", null);
|
|
11004
|
-
|
|
11067
|
+
_ts_decorate47([
|
|
11005
11068
|
Public(),
|
|
11006
11069
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11007
11070
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11008
11071
|
common.HttpCode(common.HttpStatus.OK),
|
|
11009
11072
|
common.Post("mfa/challenge"),
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11073
|
+
_ts_param26(0, common.Body()),
|
|
11074
|
+
_ts_param26(1, common.Req()),
|
|
11075
|
+
_ts_metadata46("design:type", Function),
|
|
11076
|
+
_ts_metadata46("design:paramtypes", [
|
|
11014
11077
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
11015
11078
|
typeof Request === "undefined" ? Object : Request
|
|
11016
11079
|
]),
|
|
11017
|
-
|
|
11080
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11018
11081
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
11019
|
-
|
|
11082
|
+
_ts_decorate47([
|
|
11020
11083
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11021
11084
|
common.Get("me"),
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11085
|
+
_ts_param26(0, CurrentUser()),
|
|
11086
|
+
_ts_metadata46("design:type", Function),
|
|
11087
|
+
_ts_metadata46("design:paramtypes", [
|
|
11025
11088
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
11026
11089
|
]),
|
|
11027
|
-
|
|
11090
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11028
11091
|
], PlatformAuthController.prototype, "me", null);
|
|
11029
|
-
|
|
11092
|
+
_ts_decorate47([
|
|
11030
11093
|
Public(),
|
|
11031
11094
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
11032
11095
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
11033
11096
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11034
11097
|
common.Post("logout"),
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11098
|
+
_ts_param26(0, common.Req()),
|
|
11099
|
+
_ts_metadata46("design:type", Function),
|
|
11100
|
+
_ts_metadata46("design:paramtypes", [
|
|
11038
11101
|
typeof Request === "undefined" ? Object : Request
|
|
11039
11102
|
]),
|
|
11040
|
-
|
|
11103
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11041
11104
|
], PlatformAuthController.prototype, "logout", null);
|
|
11042
|
-
|
|
11105
|
+
_ts_decorate47([
|
|
11043
11106
|
Public(),
|
|
11044
11107
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
11045
11108
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
11046
11109
|
common.HttpCode(common.HttpStatus.OK),
|
|
11047
11110
|
common.Post("refresh"),
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11111
|
+
_ts_param26(0, common.Req()),
|
|
11112
|
+
_ts_metadata46("design:type", Function),
|
|
11113
|
+
_ts_metadata46("design:paramtypes", [
|
|
11051
11114
|
typeof Request === "undefined" ? Object : Request
|
|
11052
11115
|
]),
|
|
11053
|
-
|
|
11116
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11054
11117
|
], PlatformAuthController.prototype, "refresh", null);
|
|
11055
|
-
|
|
11118
|
+
_ts_decorate47([
|
|
11056
11119
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11057
11120
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11058
11121
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11059
11122
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11060
11123
|
common.Delete("sessions"),
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11124
|
+
_ts_param26(0, CurrentUser()),
|
|
11125
|
+
_ts_metadata46("design:type", Function),
|
|
11126
|
+
_ts_metadata46("design:paramtypes", [
|
|
11064
11127
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
11065
11128
|
]),
|
|
11066
|
-
|
|
11129
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11067
11130
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
11068
|
-
PlatformAuthController =
|
|
11131
|
+
PlatformAuthController = _ts_decorate47([
|
|
11069
11132
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11070
11133
|
common.Controller("platform"),
|
|
11071
11134
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
11072
11135
|
common.UsePipes(createAuthValidationPipe()),
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11136
|
+
_ts_param26(0, common.Inject(exports.PlatformAuthService)),
|
|
11137
|
+
_ts_param26(1, common.Inject(exports.MfaService)),
|
|
11138
|
+
_ts_param26(2, common.Inject(exports.TokenDeliveryService)),
|
|
11139
|
+
_ts_metadata46("design:type", Function),
|
|
11140
|
+
_ts_metadata46("design:paramtypes", [
|
|
11078
11141
|
typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
|
|
11079
11142
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
11080
11143
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
11081
11144
|
])
|
|
11082
11145
|
], PlatformAuthController);
|
|
11083
|
-
function
|
|
11146
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
11084
11147
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11085
11148
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11086
11149
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11087
11150
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11088
11151
|
}
|
|
11089
|
-
__name(
|
|
11090
|
-
function
|
|
11152
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
11153
|
+
function _ts_metadata47(k, v) {
|
|
11091
11154
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11092
11155
|
}
|
|
11093
|
-
__name(
|
|
11094
|
-
function
|
|
11156
|
+
__name(_ts_metadata47, "_ts_metadata");
|
|
11157
|
+
function _ts_param27(paramIndex, decorator) {
|
|
11095
11158
|
return function(target, key) {
|
|
11096
11159
|
decorator(target, key, paramIndex);
|
|
11097
11160
|
};
|
|
11098
11161
|
}
|
|
11099
|
-
__name(
|
|
11162
|
+
__name(_ts_param27, "_ts_param");
|
|
11100
11163
|
var PlatformMfaController = class {
|
|
11101
11164
|
static {
|
|
11102
11165
|
__name(this, "PlatformMfaController");
|
|
@@ -11175,101 +11238,101 @@ var PlatformMfaController = class {
|
|
|
11175
11238
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
11176
11239
|
}
|
|
11177
11240
|
};
|
|
11178
|
-
|
|
11241
|
+
_ts_decorate48([
|
|
11179
11242
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11180
11243
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11181
11244
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11182
11245
|
common.Post("setup"),
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11246
|
+
_ts_param27(0, CurrentUser()),
|
|
11247
|
+
_ts_param27(1, common.Body()),
|
|
11248
|
+
_ts_metadata47("design:type", Function),
|
|
11249
|
+
_ts_metadata47("design:paramtypes", [
|
|
11187
11250
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11188
11251
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
11189
11252
|
]),
|
|
11190
|
-
|
|
11253
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11191
11254
|
], PlatformMfaController.prototype, "setup", null);
|
|
11192
|
-
|
|
11255
|
+
_ts_decorate48([
|
|
11193
11256
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11194
11257
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11195
11258
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11196
11259
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11197
11260
|
common.Post("verify-enable"),
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11261
|
+
_ts_param27(0, CurrentUser()),
|
|
11262
|
+
_ts_param27(1, common.Body()),
|
|
11263
|
+
_ts_param27(2, common.Req()),
|
|
11264
|
+
_ts_metadata47("design:type", Function),
|
|
11265
|
+
_ts_metadata47("design:paramtypes", [
|
|
11203
11266
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11204
11267
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
11205
11268
|
typeof Request === "undefined" ? Object : Request
|
|
11206
11269
|
]),
|
|
11207
|
-
|
|
11270
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11208
11271
|
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
11209
|
-
|
|
11272
|
+
_ts_decorate48([
|
|
11210
11273
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11211
11274
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11212
11275
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11213
11276
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11214
11277
|
common.Post("disable"),
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11278
|
+
_ts_param27(0, CurrentUser()),
|
|
11279
|
+
_ts_param27(1, common.Body()),
|
|
11280
|
+
_ts_param27(2, common.Req()),
|
|
11281
|
+
_ts_metadata47("design:type", Function),
|
|
11282
|
+
_ts_metadata47("design:paramtypes", [
|
|
11220
11283
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11221
11284
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
11222
11285
|
typeof Request === "undefined" ? Object : Request
|
|
11223
11286
|
]),
|
|
11224
|
-
|
|
11287
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11225
11288
|
], PlatformMfaController.prototype, "disable", null);
|
|
11226
|
-
|
|
11289
|
+
_ts_decorate48([
|
|
11227
11290
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11228
11291
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11229
11292
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11230
11293
|
common.HttpCode(common.HttpStatus.OK),
|
|
11231
11294
|
common.Post("recovery-codes"),
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11295
|
+
_ts_param27(0, CurrentUser()),
|
|
11296
|
+
_ts_param27(1, common.Body()),
|
|
11297
|
+
_ts_param27(2, common.Req()),
|
|
11298
|
+
_ts_metadata47("design:type", Function),
|
|
11299
|
+
_ts_metadata47("design:paramtypes", [
|
|
11237
11300
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11238
11301
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
11239
11302
|
typeof Request === "undefined" ? Object : Request
|
|
11240
11303
|
]),
|
|
11241
|
-
|
|
11304
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11242
11305
|
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
11243
|
-
PlatformMfaController =
|
|
11306
|
+
PlatformMfaController = _ts_decorate48([
|
|
11244
11307
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11245
11308
|
common.Controller("platform/mfa"),
|
|
11246
11309
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
11247
11310
|
common.UsePipes(createAuthValidationPipe({
|
|
11248
11311
|
forbidUnknownValues: true
|
|
11249
11312
|
})),
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11313
|
+
_ts_param27(0, common.Inject(exports.MfaService)),
|
|
11314
|
+
_ts_metadata47("design:type", Function),
|
|
11315
|
+
_ts_metadata47("design:paramtypes", [
|
|
11253
11316
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService
|
|
11254
11317
|
])
|
|
11255
11318
|
], PlatformMfaController);
|
|
11256
|
-
function
|
|
11319
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
11257
11320
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11258
11321
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11259
11322
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11260
11323
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11261
11324
|
}
|
|
11262
|
-
__name(
|
|
11263
|
-
function
|
|
11325
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
11326
|
+
function _ts_metadata48(k, v) {
|
|
11264
11327
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11265
11328
|
}
|
|
11266
|
-
__name(
|
|
11267
|
-
function
|
|
11329
|
+
__name(_ts_metadata48, "_ts_metadata");
|
|
11330
|
+
function _ts_param28(paramIndex, decorator) {
|
|
11268
11331
|
return function(target, key) {
|
|
11269
11332
|
decorator(target, key, paramIndex);
|
|
11270
11333
|
};
|
|
11271
11334
|
}
|
|
11272
|
-
__name(
|
|
11335
|
+
__name(_ts_param28, "_ts_param");
|
|
11273
11336
|
var SessionController = class {
|
|
11274
11337
|
static {
|
|
11275
11338
|
__name(this, "SessionController");
|
|
@@ -11345,77 +11408,77 @@ var SessionController = class {
|
|
|
11345
11408
|
await this.sessionService.revokeOtherSession(user.sub, id);
|
|
11346
11409
|
}
|
|
11347
11410
|
};
|
|
11348
|
-
|
|
11411
|
+
_ts_decorate49([
|
|
11349
11412
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
11350
11413
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
11351
11414
|
common.Get(),
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11415
|
+
_ts_param28(0, CurrentUser()),
|
|
11416
|
+
_ts_param28(1, common.Req()),
|
|
11417
|
+
_ts_metadata48("design:type", Function),
|
|
11418
|
+
_ts_metadata48("design:paramtypes", [
|
|
11356
11419
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11357
11420
|
typeof Request === "undefined" ? Object : Request
|
|
11358
11421
|
]),
|
|
11359
|
-
|
|
11422
|
+
_ts_metadata48("design:returntype", Promise)
|
|
11360
11423
|
], SessionController.prototype, "listSessions", null);
|
|
11361
|
-
|
|
11424
|
+
_ts_decorate49([
|
|
11362
11425
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11363
11426
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11364
11427
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11365
11428
|
common.Delete("all"),
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11429
|
+
_ts_param28(0, CurrentUser()),
|
|
11430
|
+
_ts_param28(1, common.Req()),
|
|
11431
|
+
_ts_metadata48("design:type", Function),
|
|
11432
|
+
_ts_metadata48("design:paramtypes", [
|
|
11370
11433
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11371
11434
|
typeof Request === "undefined" ? Object : Request
|
|
11372
11435
|
]),
|
|
11373
|
-
|
|
11436
|
+
_ts_metadata48("design:returntype", Promise)
|
|
11374
11437
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
11375
|
-
|
|
11438
|
+
_ts_decorate49([
|
|
11376
11439
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
11377
11440
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
11378
11441
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11379
11442
|
common.Delete(":id"),
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11443
|
+
_ts_param28(0, CurrentUser()),
|
|
11444
|
+
_ts_param28(1, common.Param("id")),
|
|
11445
|
+
_ts_metadata48("design:type", Function),
|
|
11446
|
+
_ts_metadata48("design:paramtypes", [
|
|
11384
11447
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11385
11448
|
String
|
|
11386
11449
|
]),
|
|
11387
|
-
|
|
11450
|
+
_ts_metadata48("design:returntype", Promise)
|
|
11388
11451
|
], SessionController.prototype, "revokeSession", null);
|
|
11389
|
-
SessionController =
|
|
11452
|
+
SessionController = _ts_decorate49([
|
|
11390
11453
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11391
11454
|
common.Controller("sessions"),
|
|
11392
11455
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
11393
11456
|
common.UsePipes(createAuthValidationPipe()),
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11457
|
+
_ts_param28(0, common.Inject(exports.SessionService)),
|
|
11458
|
+
_ts_param28(1, common.Inject(exports.TokenDeliveryService)),
|
|
11459
|
+
_ts_metadata48("design:type", Function),
|
|
11460
|
+
_ts_metadata48("design:paramtypes", [
|
|
11398
11461
|
typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
|
|
11399
11462
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
11400
11463
|
])
|
|
11401
11464
|
], SessionController);
|
|
11402
|
-
function
|
|
11465
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
11403
11466
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11404
11467
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11405
11468
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11406
11469
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11407
11470
|
}
|
|
11408
|
-
__name(
|
|
11409
|
-
function
|
|
11471
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
11472
|
+
function _ts_metadata49(k, v) {
|
|
11410
11473
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11411
11474
|
}
|
|
11412
|
-
__name(
|
|
11413
|
-
function
|
|
11475
|
+
__name(_ts_metadata49, "_ts_metadata");
|
|
11476
|
+
function _ts_param29(paramIndex, decorator) {
|
|
11414
11477
|
return function(target, key) {
|
|
11415
11478
|
decorator(target, key, paramIndex);
|
|
11416
11479
|
};
|
|
11417
11480
|
}
|
|
11418
|
-
__name(
|
|
11481
|
+
__name(_ts_param29, "_ts_param");
|
|
11419
11482
|
exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
11420
11483
|
static {
|
|
11421
11484
|
__name(this, "MfaRequiredGuard");
|
|
@@ -11442,11 +11505,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
|
11442
11505
|
return true;
|
|
11443
11506
|
}
|
|
11444
11507
|
};
|
|
11445
|
-
exports.MfaRequiredGuard =
|
|
11508
|
+
exports.MfaRequiredGuard = _ts_decorate50([
|
|
11446
11509
|
common.Injectable(),
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11510
|
+
_ts_param29(0, common.Inject(core.Reflector)),
|
|
11511
|
+
_ts_metadata49("design:type", Function),
|
|
11512
|
+
_ts_metadata49("design:paramtypes", [
|
|
11450
11513
|
typeof core.Reflector === "undefined" ? Object : core.Reflector
|
|
11451
11514
|
])
|
|
11452
11515
|
], exports.MfaRequiredGuard);
|
|
@@ -11454,23 +11517,23 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
11454
11517
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
11455
11518
|
|
|
11456
11519
|
// src/server/guards/platform-roles.guard.ts
|
|
11457
|
-
function
|
|
11520
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
11458
11521
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11459
11522
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11460
11523
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11461
11524
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11462
|
-
}
|
|
11463
|
-
__name(
|
|
11464
|
-
function
|
|
11525
|
+
}
|
|
11526
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
11527
|
+
function _ts_metadata50(k, v) {
|
|
11465
11528
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11466
11529
|
}
|
|
11467
|
-
__name(
|
|
11468
|
-
function
|
|
11530
|
+
__name(_ts_metadata50, "_ts_metadata");
|
|
11531
|
+
function _ts_param30(paramIndex, decorator) {
|
|
11469
11532
|
return function(target, key) {
|
|
11470
11533
|
decorator(target, key, paramIndex);
|
|
11471
11534
|
};
|
|
11472
11535
|
}
|
|
11473
|
-
__name(
|
|
11536
|
+
__name(_ts_param30, "_ts_param");
|
|
11474
11537
|
exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
11475
11538
|
static {
|
|
11476
11539
|
__name(this, "PlatformRolesGuard");
|
|
@@ -11504,12 +11567,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
|
11504
11567
|
return true;
|
|
11505
11568
|
}
|
|
11506
11569
|
};
|
|
11507
|
-
exports.PlatformRolesGuard =
|
|
11570
|
+
exports.PlatformRolesGuard = _ts_decorate51([
|
|
11508
11571
|
common.Injectable(),
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11572
|
+
_ts_param30(0, common.Inject(core.Reflector)),
|
|
11573
|
+
_ts_param30(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11574
|
+
_ts_metadata50("design:type", Function),
|
|
11575
|
+
_ts_metadata50("design:paramtypes", [
|
|
11513
11576
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
11514
11577
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11515
11578
|
])
|
|
@@ -11518,23 +11581,23 @@ var ROLES_KEY = "roles";
|
|
|
11518
11581
|
var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
|
|
11519
11582
|
|
|
11520
11583
|
// src/server/guards/roles.guard.ts
|
|
11521
|
-
function
|
|
11584
|
+
function _ts_decorate52(decorators, target, key, desc) {
|
|
11522
11585
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11523
11586
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11524
11587
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11525
11588
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11526
11589
|
}
|
|
11527
|
-
__name(
|
|
11528
|
-
function
|
|
11590
|
+
__name(_ts_decorate52, "_ts_decorate");
|
|
11591
|
+
function _ts_metadata51(k, v) {
|
|
11529
11592
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11530
11593
|
}
|
|
11531
|
-
__name(
|
|
11532
|
-
function
|
|
11594
|
+
__name(_ts_metadata51, "_ts_metadata");
|
|
11595
|
+
function _ts_param31(paramIndex, decorator) {
|
|
11533
11596
|
return function(target, key) {
|
|
11534
11597
|
decorator(target, key, paramIndex);
|
|
11535
11598
|
};
|
|
11536
11599
|
}
|
|
11537
|
-
__name(
|
|
11600
|
+
__name(_ts_param31, "_ts_param");
|
|
11538
11601
|
exports.RolesGuard = class RolesGuard {
|
|
11539
11602
|
static {
|
|
11540
11603
|
__name(this, "RolesGuard");
|
|
@@ -11564,23 +11627,23 @@ exports.RolesGuard = class RolesGuard {
|
|
|
11564
11627
|
return true;
|
|
11565
11628
|
}
|
|
11566
11629
|
};
|
|
11567
|
-
exports.RolesGuard =
|
|
11630
|
+
exports.RolesGuard = _ts_decorate52([
|
|
11568
11631
|
common.Injectable(),
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11632
|
+
_ts_param31(0, common.Inject(core.Reflector)),
|
|
11633
|
+
_ts_param31(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11634
|
+
_ts_metadata51("design:type", Function),
|
|
11635
|
+
_ts_metadata51("design:paramtypes", [
|
|
11573
11636
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
11574
11637
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11575
11638
|
])
|
|
11576
11639
|
], exports.RolesGuard);
|
|
11577
|
-
function
|
|
11640
|
+
function _ts_decorate53(decorators, target, key, desc) {
|
|
11578
11641
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11579
11642
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11580
11643
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11581
11644
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11582
11645
|
}
|
|
11583
|
-
__name(
|
|
11646
|
+
__name(_ts_decorate53, "_ts_decorate");
|
|
11584
11647
|
exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
11585
11648
|
static {
|
|
11586
11649
|
__name(this, "NoOpAuthHooks");
|
|
@@ -11623,7 +11686,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
|
11623
11686
|
};
|
|
11624
11687
|
}
|
|
11625
11688
|
};
|
|
11626
|
-
exports.NoOpAuthHooks =
|
|
11689
|
+
exports.NoOpAuthHooks = _ts_decorate53([
|
|
11627
11690
|
common.Injectable()
|
|
11628
11691
|
], exports.NoOpAuthHooks);
|
|
11629
11692
|
|
|
@@ -11636,23 +11699,23 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
|
11636
11699
|
var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
|
|
11637
11700
|
|
|
11638
11701
|
// src/server/oauth/oauth.service.ts
|
|
11639
|
-
function
|
|
11702
|
+
function _ts_decorate54(decorators, target, key, desc) {
|
|
11640
11703
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11641
11704
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11642
11705
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11643
11706
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11644
11707
|
}
|
|
11645
|
-
__name(
|
|
11646
|
-
function
|
|
11708
|
+
__name(_ts_decorate54, "_ts_decorate");
|
|
11709
|
+
function _ts_metadata52(k, v) {
|
|
11647
11710
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11648
11711
|
}
|
|
11649
|
-
__name(
|
|
11650
|
-
function
|
|
11712
|
+
__name(_ts_metadata52, "_ts_metadata");
|
|
11713
|
+
function _ts_param32(paramIndex, decorator) {
|
|
11651
11714
|
return function(target, key) {
|
|
11652
11715
|
decorator(target, key, paramIndex);
|
|
11653
11716
|
};
|
|
11654
11717
|
}
|
|
11655
|
-
__name(
|
|
11718
|
+
__name(_ts_param32, "_ts_param");
|
|
11656
11719
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
11657
11720
|
function isStoredOAuthState(value) {
|
|
11658
11721
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -11912,18 +11975,18 @@ exports.OAuthService = class _OAuthService {
|
|
|
11912
11975
|
return plugin;
|
|
11913
11976
|
}
|
|
11914
11977
|
};
|
|
11915
|
-
exports.OAuthService =
|
|
11978
|
+
exports.OAuthService = _ts_decorate54([
|
|
11916
11979
|
common.Injectable(),
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11980
|
+
_ts_param32(0, common.Inject(OAUTH_PLUGINS)),
|
|
11981
|
+
_ts_param32(1, common.Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
11982
|
+
_ts_param32(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
11983
|
+
_ts_param32(2, common.Optional()),
|
|
11984
|
+
_ts_param32(3, common.Inject(AuthRedisService)),
|
|
11985
|
+
_ts_param32(4, common.Inject(TokenManagerService)),
|
|
11986
|
+
_ts_param32(5, common.Inject(exports.SessionService)),
|
|
11987
|
+
_ts_param32(6, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11988
|
+
_ts_metadata52("design:type", Function),
|
|
11989
|
+
_ts_metadata52("design:paramtypes", [
|
|
11927
11990
|
Array,
|
|
11928
11991
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
11929
11992
|
Object,
|
|
@@ -11933,17 +11996,17 @@ exports.OAuthService = _ts_decorate53([
|
|
|
11933
11996
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11934
11997
|
])
|
|
11935
11998
|
], exports.OAuthService);
|
|
11936
|
-
function
|
|
11999
|
+
function _ts_decorate55(decorators, target, key, desc) {
|
|
11937
12000
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11938
12001
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11939
12002
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11940
12003
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11941
12004
|
}
|
|
11942
|
-
__name(
|
|
11943
|
-
function
|
|
12005
|
+
__name(_ts_decorate55, "_ts_decorate");
|
|
12006
|
+
function _ts_metadata53(k, v) {
|
|
11944
12007
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11945
12008
|
}
|
|
11946
|
-
__name(
|
|
12009
|
+
__name(_ts_metadata53, "_ts_metadata");
|
|
11947
12010
|
var OAuthCallbackQueryDto = class {
|
|
11948
12011
|
static {
|
|
11949
12012
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -12023,78 +12086,78 @@ var OAuthCallbackQueryDto = class {
|
|
|
12023
12086
|
*/
|
|
12024
12087
|
hd;
|
|
12025
12088
|
};
|
|
12026
|
-
|
|
12089
|
+
_ts_decorate55([
|
|
12027
12090
|
classValidator.ValidateIf((query) => query.error === void 0),
|
|
12028
12091
|
classValidator.IsString(),
|
|
12029
12092
|
classValidator.IsNotEmpty(),
|
|
12030
12093
|
classValidator.MaxLength(2048),
|
|
12031
|
-
|
|
12094
|
+
_ts_metadata53("design:type", String)
|
|
12032
12095
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
12033
|
-
|
|
12096
|
+
_ts_decorate55([
|
|
12034
12097
|
classValidator.IsOptional(),
|
|
12035
12098
|
classValidator.IsString(),
|
|
12036
12099
|
classValidator.MaxLength(128),
|
|
12037
|
-
|
|
12100
|
+
_ts_metadata53("design:type", String)
|
|
12038
12101
|
], OAuthCallbackQueryDto.prototype, "error", void 0);
|
|
12039
|
-
|
|
12102
|
+
_ts_decorate55([
|
|
12040
12103
|
classValidator.IsOptional(),
|
|
12041
12104
|
classValidator.IsString(),
|
|
12042
12105
|
classValidator.MaxLength(512),
|
|
12043
|
-
|
|
12106
|
+
_ts_metadata53("design:type", String)
|
|
12044
12107
|
], OAuthCallbackQueryDto.prototype, "error_description", void 0);
|
|
12045
|
-
|
|
12108
|
+
_ts_decorate55([
|
|
12046
12109
|
classValidator.IsOptional(),
|
|
12047
12110
|
classValidator.IsString(),
|
|
12048
12111
|
classValidator.MaxLength(512),
|
|
12049
|
-
|
|
12112
|
+
_ts_metadata53("design:type", String)
|
|
12050
12113
|
], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
|
|
12051
|
-
|
|
12114
|
+
_ts_decorate55([
|
|
12052
12115
|
classValidator.IsString(),
|
|
12053
12116
|
classValidator.IsNotEmpty(),
|
|
12054
12117
|
classValidator.MaxLength(128),
|
|
12055
|
-
|
|
12118
|
+
_ts_metadata53("design:type", String)
|
|
12056
12119
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
12057
|
-
|
|
12120
|
+
_ts_decorate55([
|
|
12058
12121
|
classValidator.IsOptional(),
|
|
12059
12122
|
classValidator.IsString(),
|
|
12060
12123
|
classValidator.MaxLength(512),
|
|
12061
|
-
|
|
12124
|
+
_ts_metadata53("design:type", String)
|
|
12062
12125
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
12063
|
-
|
|
12126
|
+
_ts_decorate55([
|
|
12064
12127
|
classValidator.IsOptional(),
|
|
12065
12128
|
classValidator.IsString(),
|
|
12066
12129
|
classValidator.MaxLength(2048),
|
|
12067
|
-
|
|
12130
|
+
_ts_metadata53("design:type", String)
|
|
12068
12131
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
12069
|
-
|
|
12132
|
+
_ts_decorate55([
|
|
12070
12133
|
classValidator.IsOptional(),
|
|
12071
12134
|
classValidator.IsString(),
|
|
12072
12135
|
classValidator.MaxLength(16),
|
|
12073
|
-
|
|
12136
|
+
_ts_metadata53("design:type", String)
|
|
12074
12137
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
12075
|
-
|
|
12138
|
+
_ts_decorate55([
|
|
12076
12139
|
classValidator.IsOptional(),
|
|
12077
12140
|
classValidator.IsString(),
|
|
12078
12141
|
classValidator.MaxLength(64),
|
|
12079
|
-
|
|
12142
|
+
_ts_metadata53("design:type", String)
|
|
12080
12143
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
12081
|
-
|
|
12144
|
+
_ts_decorate55([
|
|
12082
12145
|
classValidator.IsOptional(),
|
|
12083
12146
|
classValidator.IsString(),
|
|
12084
12147
|
classValidator.MaxLength(253),
|
|
12085
|
-
|
|
12148
|
+
_ts_metadata53("design:type", String)
|
|
12086
12149
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
12087
|
-
function
|
|
12150
|
+
function _ts_decorate56(decorators, target, key, desc) {
|
|
12088
12151
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12089
12152
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12090
12153
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12091
12154
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12092
12155
|
}
|
|
12093
|
-
__name(
|
|
12094
|
-
function
|
|
12156
|
+
__name(_ts_decorate56, "_ts_decorate");
|
|
12157
|
+
function _ts_metadata54(k, v) {
|
|
12095
12158
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12096
12159
|
}
|
|
12097
|
-
__name(
|
|
12160
|
+
__name(_ts_metadata54, "_ts_metadata");
|
|
12098
12161
|
var OAuthInitiateQueryDto = class {
|
|
12099
12162
|
static {
|
|
12100
12163
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -12111,34 +12174,35 @@ var OAuthInitiateQueryDto = class {
|
|
|
12111
12174
|
*/
|
|
12112
12175
|
tenantId;
|
|
12113
12176
|
};
|
|
12114
|
-
|
|
12177
|
+
_ts_decorate56([
|
|
12178
|
+
classValidator.IsOptional(),
|
|
12115
12179
|
classValidator.IsString(),
|
|
12116
12180
|
classValidator.IsNotEmpty(),
|
|
12117
12181
|
classValidator.MaxLength(128),
|
|
12118
12182
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
12119
12183
|
message: "tenantId must not contain control characters"
|
|
12120
12184
|
}),
|
|
12121
|
-
|
|
12185
|
+
_ts_metadata54("design:type", String)
|
|
12122
12186
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
12123
12187
|
|
|
12124
12188
|
// src/server/oauth/oauth.controller.ts
|
|
12125
|
-
function
|
|
12189
|
+
function _ts_decorate57(decorators, target, key, desc) {
|
|
12126
12190
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12127
12191
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12128
12192
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12129
12193
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12130
12194
|
}
|
|
12131
|
-
__name(
|
|
12132
|
-
function
|
|
12195
|
+
__name(_ts_decorate57, "_ts_decorate");
|
|
12196
|
+
function _ts_metadata55(k, v) {
|
|
12133
12197
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12134
12198
|
}
|
|
12135
|
-
__name(
|
|
12136
|
-
function
|
|
12199
|
+
__name(_ts_metadata55, "_ts_metadata");
|
|
12200
|
+
function _ts_param33(paramIndex, decorator) {
|
|
12137
12201
|
return function(target, key) {
|
|
12138
12202
|
decorator(target, key, paramIndex);
|
|
12139
12203
|
};
|
|
12140
12204
|
}
|
|
12141
|
-
__name(
|
|
12205
|
+
__name(_ts_param33, "_ts_param");
|
|
12142
12206
|
function isOAuthMfaChallenge(result) {
|
|
12143
12207
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
12144
12208
|
}
|
|
@@ -12356,46 +12420,46 @@ var OAuthController = class _OAuthController {
|
|
|
12356
12420
|
});
|
|
12357
12421
|
}
|
|
12358
12422
|
};
|
|
12359
|
-
|
|
12423
|
+
_ts_decorate57([
|
|
12360
12424
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
12361
12425
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
12362
12426
|
common.Get(":provider"),
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12427
|
+
_ts_param33(0, common.Param("provider")),
|
|
12428
|
+
_ts_param33(1, common.Query()),
|
|
12429
|
+
_ts_param33(2, common.Req()),
|
|
12430
|
+
_ts_param33(3, common.Res({
|
|
12367
12431
|
passthrough: true
|
|
12368
12432
|
})),
|
|
12369
|
-
|
|
12370
|
-
|
|
12433
|
+
_ts_metadata55("design:type", Function),
|
|
12434
|
+
_ts_metadata55("design:paramtypes", [
|
|
12371
12435
|
String,
|
|
12372
12436
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
12373
12437
|
typeof Request === "undefined" ? Object : Request,
|
|
12374
12438
|
typeof Response === "undefined" ? Object : Response
|
|
12375
12439
|
]),
|
|
12376
|
-
|
|
12440
|
+
_ts_metadata55("design:returntype", Promise)
|
|
12377
12441
|
], OAuthController.prototype, "initiate", null);
|
|
12378
|
-
|
|
12442
|
+
_ts_decorate57([
|
|
12379
12443
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
12380
12444
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
12381
12445
|
common.HttpCode(common.HttpStatus.OK),
|
|
12382
12446
|
common.Get(":provider/callback"),
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12447
|
+
_ts_param33(0, common.Param("provider")),
|
|
12448
|
+
_ts_param33(1, common.Query()),
|
|
12449
|
+
_ts_param33(2, common.Req()),
|
|
12450
|
+
_ts_param33(3, common.Res({
|
|
12387
12451
|
passthrough: true
|
|
12388
12452
|
})),
|
|
12389
|
-
|
|
12390
|
-
|
|
12453
|
+
_ts_metadata55("design:type", Function),
|
|
12454
|
+
_ts_metadata55("design:paramtypes", [
|
|
12391
12455
|
String,
|
|
12392
12456
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
12393
12457
|
typeof Request === "undefined" ? Object : Request,
|
|
12394
12458
|
typeof Response === "undefined" ? Object : Response
|
|
12395
12459
|
]),
|
|
12396
|
-
|
|
12460
|
+
_ts_metadata55("design:returntype", Promise)
|
|
12397
12461
|
], OAuthController.prototype, "callback", null);
|
|
12398
|
-
OAuthController =
|
|
12462
|
+
OAuthController = _ts_decorate57([
|
|
12399
12463
|
Public(),
|
|
12400
12464
|
SkipMfa(),
|
|
12401
12465
|
common.UseInterceptors(NoStoreInterceptor),
|
|
@@ -12404,11 +12468,11 @@ OAuthController = _ts_decorate56([
|
|
|
12404
12468
|
common.UsePipes(createAuthValidationPipe({
|
|
12405
12469
|
forbidUnknownValues: true
|
|
12406
12470
|
})),
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12471
|
+
_ts_param33(0, common.Inject(exports.OAuthService)),
|
|
12472
|
+
_ts_param33(1, common.Inject(exports.TokenDeliveryService)),
|
|
12473
|
+
_ts_param33(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
12474
|
+
_ts_metadata55("design:type", Function),
|
|
12475
|
+
_ts_metadata55("design:paramtypes", [
|
|
12412
12476
|
typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
|
|
12413
12477
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
12414
12478
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -12547,13 +12611,13 @@ var GoogleOAuthPlugin = class {
|
|
|
12547
12611
|
};
|
|
12548
12612
|
|
|
12549
12613
|
// src/server/oauth/oauth.module.ts
|
|
12550
|
-
function
|
|
12614
|
+
function _ts_decorate58(decorators, target, key, desc) {
|
|
12551
12615
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12552
12616
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12553
12617
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12554
12618
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12555
12619
|
}
|
|
12556
|
-
__name(
|
|
12620
|
+
__name(_ts_decorate58, "_ts_decorate");
|
|
12557
12621
|
function buildOAuthPlugins(options) {
|
|
12558
12622
|
const plugins = [];
|
|
12559
12623
|
if (options.oauth?.google) {
|
|
@@ -12623,26 +12687,26 @@ var OAuthModule = class _OAuthModule {
|
|
|
12623
12687
|
};
|
|
12624
12688
|
}
|
|
12625
12689
|
};
|
|
12626
|
-
OAuthModule =
|
|
12690
|
+
OAuthModule = _ts_decorate58([
|
|
12627
12691
|
common.Module({})
|
|
12628
12692
|
], OAuthModule);
|
|
12629
|
-
function
|
|
12693
|
+
function _ts_decorate59(decorators, target, key, desc) {
|
|
12630
12694
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12631
12695
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12632
12696
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12633
12697
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12634
12698
|
}
|
|
12635
|
-
__name(
|
|
12636
|
-
function
|
|
12699
|
+
__name(_ts_decorate59, "_ts_decorate");
|
|
12700
|
+
function _ts_metadata56(k, v) {
|
|
12637
12701
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12638
12702
|
}
|
|
12639
|
-
__name(
|
|
12640
|
-
function
|
|
12703
|
+
__name(_ts_metadata56, "_ts_metadata");
|
|
12704
|
+
function _ts_param34(paramIndex, decorator) {
|
|
12641
12705
|
return function(target, key) {
|
|
12642
12706
|
decorator(target, key, paramIndex);
|
|
12643
12707
|
};
|
|
12644
12708
|
}
|
|
12645
|
-
__name(
|
|
12709
|
+
__name(_ts_param34, "_ts_param");
|
|
12646
12710
|
var COMMON_BASE_WORDS = [
|
|
12647
12711
|
// The perennial top of every published list.
|
|
12648
12712
|
"password",
|
|
@@ -12948,68 +13012,68 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
|
|
|
12948
13012
|
return false;
|
|
12949
13013
|
}
|
|
12950
13014
|
};
|
|
12951
|
-
exports.CommonPasswordChecker =
|
|
13015
|
+
exports.CommonPasswordChecker = _ts_decorate59([
|
|
12952
13016
|
common.Injectable(),
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
13017
|
+
_ts_param34(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13018
|
+
_ts_param34(0, common.Optional()),
|
|
13019
|
+
_ts_metadata56("design:type", Function),
|
|
13020
|
+
_ts_metadata56("design:paramtypes", [
|
|
12957
13021
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
12958
13022
|
])
|
|
12959
13023
|
], exports.CommonPasswordChecker);
|
|
12960
|
-
function
|
|
13024
|
+
function _ts_decorate60(decorators, target, key, desc) {
|
|
12961
13025
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12962
13026
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12963
13027
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12964
13028
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12965
13029
|
}
|
|
12966
|
-
__name(
|
|
13030
|
+
__name(_ts_decorate60, "_ts_decorate");
|
|
12967
13031
|
exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
12968
13032
|
static {
|
|
12969
13033
|
__name(this, "NoOpEmailProvider");
|
|
12970
13034
|
}
|
|
12971
13035
|
logger = new common.Logger(_NoOpEmailProvider.name);
|
|
12972
13036
|
/** @inheritdoc */
|
|
12973
|
-
async sendPasswordResetToken(email, _token, _locale) {
|
|
13037
|
+
async sendPasswordResetToken(_tenantId, email, _token, _locale) {
|
|
12974
13038
|
this.logger.log(`sendPasswordResetToken \u2192 ${maskEmail(email)} (no-op)`);
|
|
12975
13039
|
}
|
|
12976
13040
|
/** @inheritdoc */
|
|
12977
|
-
async sendPasswordResetOtp(email, _otp, _locale) {
|
|
13041
|
+
async sendPasswordResetOtp(_tenantId, email, _otp, _locale) {
|
|
12978
13042
|
this.logger.log(`sendPasswordResetOtp \u2192 ${maskEmail(email)} (no-op)`);
|
|
12979
13043
|
}
|
|
12980
13044
|
/** @inheritdoc */
|
|
12981
|
-
async sendEmailVerificationOtp(email, _otp, _locale) {
|
|
13045
|
+
async sendEmailVerificationOtp(_tenantId, email, _otp, _locale) {
|
|
12982
13046
|
this.logger.log(`sendEmailVerificationOtp \u2192 ${maskEmail(email)} (no-op)`);
|
|
12983
13047
|
}
|
|
12984
13048
|
/** @inheritdoc */
|
|
12985
|
-
async sendMfaEnabledNotification(email, _locale) {
|
|
13049
|
+
async sendMfaEnabledNotification(_tenantId, email, _locale) {
|
|
12986
13050
|
this.logger.log(`sendMfaEnabledNotification \u2192 ${maskEmail(email)} (no-op)`);
|
|
12987
13051
|
}
|
|
12988
13052
|
/** @inheritdoc */
|
|
12989
|
-
async sendMfaDisabledNotification(email, _locale) {
|
|
13053
|
+
async sendMfaDisabledNotification(_tenantId, email, _locale) {
|
|
12990
13054
|
this.logger.log(`sendMfaDisabledNotification \u2192 ${maskEmail(email)} (no-op)`);
|
|
12991
13055
|
}
|
|
12992
13056
|
/** @inheritdoc */
|
|
12993
|
-
async sendNewSessionAlert(email, _sessionInfo, _locale) {
|
|
13057
|
+
async sendNewSessionAlert(_tenantId, email, _sessionInfo, _locale) {
|
|
12994
13058
|
this.logger.log(`sendNewSessionAlert \u2192 ${maskEmail(email)} (no-op)`);
|
|
12995
13059
|
}
|
|
12996
13060
|
/** @inheritdoc */
|
|
12997
|
-
async sendInvitation(email, _inviteData, _locale) {
|
|
13061
|
+
async sendInvitation(_tenantId, email, _inviteData, _locale) {
|
|
12998
13062
|
this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
|
|
12999
13063
|
}
|
|
13000
13064
|
};
|
|
13001
|
-
exports.NoOpEmailProvider =
|
|
13065
|
+
exports.NoOpEmailProvider = _ts_decorate60([
|
|
13002
13066
|
common.Injectable()
|
|
13003
13067
|
], exports.NoOpEmailProvider);
|
|
13004
13068
|
|
|
13005
13069
|
// src/server/bymax-auth.module.ts
|
|
13006
|
-
function
|
|
13070
|
+
function _ts_decorate61(decorators, target, key, desc) {
|
|
13007
13071
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13008
13072
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13009
13073
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13010
13074
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13011
13075
|
}
|
|
13012
|
-
__name(
|
|
13076
|
+
__name(_ts_decorate61, "_ts_decorate");
|
|
13013
13077
|
function hasProviderToken(providers, token) {
|
|
13014
13078
|
return providers.some((p) => {
|
|
13015
13079
|
if (typeof p === "function") return false;
|
|
@@ -13193,6 +13257,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
13193
13257
|
// BYMAX_AUTH_REDIS_CLIENT and BYMAX_AUTH_OPTIONS provided via extraProviders
|
|
13194
13258
|
// are visible in the same module scope.
|
|
13195
13259
|
AuthRedisService,
|
|
13260
|
+
exports.AuthRevocationService,
|
|
13196
13261
|
PasswordService,
|
|
13197
13262
|
TokenManagerService,
|
|
13198
13263
|
exports.TokenDeliveryService,
|
|
@@ -13280,6 +13345,10 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
13280
13345
|
// NestJS auto-registers @UseGuards() guards as local providers in the controller's
|
|
13281
13346
|
// module; all constructor deps must be resolvable from that module's context.
|
|
13282
13347
|
AuthRedisService,
|
|
13348
|
+
// Export AuthRevocationService for the same @UseGuards() reason — the exported guards now
|
|
13349
|
+
// depend on it — and so a host bridging a realtime transport can inject it and consult
|
|
13350
|
+
// both revocation channels rather than granting a stream that outlives a logout.
|
|
13351
|
+
exports.AuthRevocationService,
|
|
13283
13352
|
// Same reason, for the two exported guards whose remaining constructor deps are not
|
|
13284
13353
|
// covered by the entries above. Exporting the guard class is necessary but not
|
|
13285
13354
|
// sufficient: because @UseGuards() re-instantiates the guard in the *consumer's*
|
|
@@ -13304,20 +13373,229 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
13304
13373
|
};
|
|
13305
13374
|
}
|
|
13306
13375
|
};
|
|
13307
|
-
exports.BymaxAuthModule =
|
|
13376
|
+
exports.BymaxAuthModule = _ts_decorate61([
|
|
13308
13377
|
common.Module({})
|
|
13309
13378
|
], exports.BymaxAuthModule);
|
|
13310
|
-
|
|
13379
|
+
var CODE_VALIDITY_TEXT = "It expires shortly, so use it soon.";
|
|
13380
|
+
var UNEXPECTED_CHANGE_TEXT = "If this was not you, secure your account immediately: change your password and sign out of every session.";
|
|
13381
|
+
var DEFAULT_MESSAGES = {
|
|
13382
|
+
passwordResetToken: /* @__PURE__ */ __name(({ token }) => ({
|
|
13383
|
+
subject: "Reset your password",
|
|
13384
|
+
text: `Use this token to reset your password: ${token}
|
|
13385
|
+
|
|
13386
|
+
${CODE_VALIDITY_TEXT}
|
|
13387
|
+
|
|
13388
|
+
If you did not ask to reset your password, ignore this message and nothing will change.`
|
|
13389
|
+
}), "passwordResetToken"),
|
|
13390
|
+
passwordResetOtp: /* @__PURE__ */ __name(({ otp }) => ({
|
|
13391
|
+
subject: "Your password reset code",
|
|
13392
|
+
text: `Your password reset code is ${otp}.
|
|
13393
|
+
|
|
13394
|
+
${CODE_VALIDITY_TEXT}
|
|
13395
|
+
|
|
13396
|
+
If you did not ask to reset your password, ignore this message and nothing will change.`
|
|
13397
|
+
}), "passwordResetOtp"),
|
|
13398
|
+
emailVerificationOtp: /* @__PURE__ */ __name(({ otp }) => ({
|
|
13399
|
+
subject: "Verify your email address",
|
|
13400
|
+
text: `Your verification code is ${otp}.
|
|
13401
|
+
|
|
13402
|
+
${CODE_VALIDITY_TEXT}
|
|
13403
|
+
|
|
13404
|
+
If you did not create an account, ignore this message.`
|
|
13405
|
+
}), "emailVerificationOtp"),
|
|
13406
|
+
passwordChanged: /* @__PURE__ */ __name(() => ({
|
|
13407
|
+
subject: "Your password was changed",
|
|
13408
|
+
text: `The password on your account was changed.
|
|
13409
|
+
|
|
13410
|
+
${UNEXPECTED_CHANGE_TEXT}`
|
|
13411
|
+
}), "passwordChanged"),
|
|
13412
|
+
emailChangeVerification: /* @__PURE__ */ __name(({ token }) => ({
|
|
13413
|
+
subject: "Confirm your new email address",
|
|
13414
|
+
text: `Your confirmation code is ${token}.
|
|
13415
|
+
|
|
13416
|
+
${CODE_VALIDITY_TEXT}
|
|
13417
|
+
|
|
13418
|
+
If you did not ask to change your email address, ignore this message.`
|
|
13419
|
+
}), "emailChangeVerification"),
|
|
13420
|
+
emailChanged: /* @__PURE__ */ __name(({ newEmail }) => ({
|
|
13421
|
+
subject: "Your email address was changed",
|
|
13422
|
+
text: `The email address on your account was changed to ${newEmail}, and this address no longer signs in to it.
|
|
13423
|
+
|
|
13424
|
+
${UNEXPECTED_CHANGE_TEXT}`
|
|
13425
|
+
}), "emailChanged"),
|
|
13426
|
+
mfaEnabled: /* @__PURE__ */ __name(() => ({
|
|
13427
|
+
subject: "Two-factor authentication is on",
|
|
13428
|
+
text: `Two-factor authentication was enabled on your account.
|
|
13429
|
+
|
|
13430
|
+
${UNEXPECTED_CHANGE_TEXT}`
|
|
13431
|
+
}), "mfaEnabled"),
|
|
13432
|
+
mfaDisabled: /* @__PURE__ */ __name(() => ({
|
|
13433
|
+
subject: "Two-factor authentication is off",
|
|
13434
|
+
text: `Two-factor authentication was disabled on your account.
|
|
13435
|
+
|
|
13436
|
+
${UNEXPECTED_CHANGE_TEXT}`
|
|
13437
|
+
}), "mfaDisabled"),
|
|
13438
|
+
newSessionAlert: /* @__PURE__ */ __name(({ sessionInfo }) => ({
|
|
13439
|
+
subject: "New sign-in to your account",
|
|
13440
|
+
text: `A new session was started on your account.
|
|
13441
|
+
|
|
13442
|
+
Device: ${sessionInfo.device}
|
|
13443
|
+
IP: ${sessionInfo.ip}
|
|
13444
|
+
Session: ${sessionInfo.sessionHash}
|
|
13445
|
+
|
|
13446
|
+
${UNEXPECTED_CHANGE_TEXT}`
|
|
13447
|
+
}), "newSessionAlert"),
|
|
13448
|
+
invitation: /* @__PURE__ */ __name(({ invite }) => ({
|
|
13449
|
+
subject: `${invite.inviterName} invited you to ${invite.tenantName}`,
|
|
13450
|
+
text: `${invite.inviterName} invited you to join ${invite.tenantName}.
|
|
13451
|
+
|
|
13452
|
+
Use this token to accept: ${invite.inviteToken}
|
|
13453
|
+
|
|
13454
|
+
It expires on ${invite.expiresAt.toISOString()}.
|
|
13455
|
+
|
|
13456
|
+
If you were not expecting this invitation, ignore this message.`
|
|
13457
|
+
}), "invitation")
|
|
13458
|
+
};
|
|
13459
|
+
function escapeHtml(value) {
|
|
13460
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
13461
|
+
}
|
|
13462
|
+
__name(escapeHtml, "escapeHtml");
|
|
13463
|
+
function toHtml(text) {
|
|
13464
|
+
return text.split("\n\n").map((paragraph) => `<p>${escapeHtml(paragraph).replace(/\n/g, "<br>")}</p>`).join("\n");
|
|
13465
|
+
}
|
|
13466
|
+
__name(toHtml, "toHtml");
|
|
13467
|
+
function sanitizeSubject(subject) {
|
|
13468
|
+
return subject.replace(/[\r\n]+/g, " ");
|
|
13469
|
+
}
|
|
13470
|
+
__name(sanitizeSubject, "sanitizeSubject");
|
|
13471
|
+
var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
13472
|
+
static {
|
|
13473
|
+
__name(this, "DefaultAuthEmailProvider");
|
|
13474
|
+
}
|
|
13475
|
+
sink;
|
|
13476
|
+
/** Records a delivery this provider swallowed, so a silent channel is still visible somewhere. */
|
|
13477
|
+
logger = new common.Logger(_DefaultAuthEmailProvider.name);
|
|
13478
|
+
/** The copy in effect: the defaults, with any provided overrides layered on top. */
|
|
13479
|
+
messages;
|
|
13480
|
+
/** Whether a rejected send is re-thrown after logging; `false` (swallow) unless asked otherwise. */
|
|
13481
|
+
rethrowOnError;
|
|
13482
|
+
/**
|
|
13483
|
+
* @param sink - The delivery channel to send through.
|
|
13484
|
+
* @param options - Optional copy overrides and delivery-error policy.
|
|
13485
|
+
*/
|
|
13486
|
+
constructor(sink, options) {
|
|
13487
|
+
this.sink = sink;
|
|
13488
|
+
this.messages = {
|
|
13489
|
+
...DEFAULT_MESSAGES,
|
|
13490
|
+
...options?.messages
|
|
13491
|
+
};
|
|
13492
|
+
this.rethrowOnError = options?.onDeliveryError === "rethrow";
|
|
13493
|
+
}
|
|
13494
|
+
/** @inheritdoc */
|
|
13495
|
+
async sendPasswordResetToken(tenantId, email, token, locale) {
|
|
13496
|
+
await this.deliver(tenantId, email, this.messages.passwordResetToken({
|
|
13497
|
+
token,
|
|
13498
|
+
locale
|
|
13499
|
+
}));
|
|
13500
|
+
}
|
|
13501
|
+
/** @inheritdoc */
|
|
13502
|
+
async sendPasswordResetOtp(tenantId, email, otp, locale) {
|
|
13503
|
+
await this.deliver(tenantId, email, this.messages.passwordResetOtp({
|
|
13504
|
+
otp,
|
|
13505
|
+
locale
|
|
13506
|
+
}));
|
|
13507
|
+
}
|
|
13508
|
+
/** @inheritdoc */
|
|
13509
|
+
async sendEmailVerificationOtp(tenantId, email, otp, locale) {
|
|
13510
|
+
await this.deliver(tenantId, email, this.messages.emailVerificationOtp({
|
|
13511
|
+
otp,
|
|
13512
|
+
locale
|
|
13513
|
+
}));
|
|
13514
|
+
}
|
|
13515
|
+
/** @inheritdoc */
|
|
13516
|
+
async sendPasswordChangedNotification(tenantId, email, locale) {
|
|
13517
|
+
await this.deliver(tenantId, email, this.messages.passwordChanged({
|
|
13518
|
+
locale
|
|
13519
|
+
}));
|
|
13520
|
+
}
|
|
13521
|
+
/** @inheritdoc */
|
|
13522
|
+
async sendEmailChangeVerification(tenantId, newEmail, token, locale) {
|
|
13523
|
+
await this.deliver(tenantId, newEmail, this.messages.emailChangeVerification({
|
|
13524
|
+
token,
|
|
13525
|
+
locale
|
|
13526
|
+
}));
|
|
13527
|
+
}
|
|
13528
|
+
/** @inheritdoc */
|
|
13529
|
+
async sendEmailChangedNotification(tenantId, oldEmail, newEmail, locale) {
|
|
13530
|
+
await this.deliver(tenantId, oldEmail, this.messages.emailChanged({
|
|
13531
|
+
oldEmail,
|
|
13532
|
+
newEmail,
|
|
13533
|
+
locale
|
|
13534
|
+
}));
|
|
13535
|
+
}
|
|
13536
|
+
/** @inheritdoc */
|
|
13537
|
+
async sendMfaEnabledNotification(tenantId, email, locale) {
|
|
13538
|
+
await this.deliver(tenantId, email, this.messages.mfaEnabled({
|
|
13539
|
+
locale
|
|
13540
|
+
}));
|
|
13541
|
+
}
|
|
13542
|
+
/** @inheritdoc */
|
|
13543
|
+
async sendMfaDisabledNotification(tenantId, email, locale) {
|
|
13544
|
+
await this.deliver(tenantId, email, this.messages.mfaDisabled({
|
|
13545
|
+
locale
|
|
13546
|
+
}));
|
|
13547
|
+
}
|
|
13548
|
+
/** @inheritdoc */
|
|
13549
|
+
async sendNewSessionAlert(tenantId, email, sessionInfo, locale) {
|
|
13550
|
+
await this.deliver(tenantId, email, this.messages.newSessionAlert({
|
|
13551
|
+
sessionInfo,
|
|
13552
|
+
locale
|
|
13553
|
+
}));
|
|
13554
|
+
}
|
|
13555
|
+
/** @inheritdoc */
|
|
13556
|
+
async sendInvitation(tenantId, email, inviteData, locale) {
|
|
13557
|
+
await this.deliver(tenantId, email, this.messages.invitation({
|
|
13558
|
+
invite: inviteData,
|
|
13559
|
+
locale
|
|
13560
|
+
}));
|
|
13561
|
+
}
|
|
13562
|
+
/**
|
|
13563
|
+
* Renders the body to HTML (unless the message already carries its own), hands the message to the
|
|
13564
|
+
* channel, and swallows any delivery error.
|
|
13565
|
+
*
|
|
13566
|
+
* @param tenantId - Tenant the message is attributed to.
|
|
13567
|
+
* @param to - Recipient address.
|
|
13568
|
+
* @param message - The rendered subject and body, and optionally its own HTML.
|
|
13569
|
+
*/
|
|
13570
|
+
async deliver(tenantId, to, message) {
|
|
13571
|
+
const subject = sanitizeSubject(message.subject);
|
|
13572
|
+
try {
|
|
13573
|
+
await this.sink.send({
|
|
13574
|
+
tenantId,
|
|
13575
|
+
to,
|
|
13576
|
+
subject,
|
|
13577
|
+
html: message.html ?? toHtml(message.text),
|
|
13578
|
+
text: message.text
|
|
13579
|
+
});
|
|
13580
|
+
} catch (error) {
|
|
13581
|
+
this.logger.error(`delivery failed for "${subject}"`, error);
|
|
13582
|
+
if (this.rethrowOnError) {
|
|
13583
|
+
throw error;
|
|
13584
|
+
}
|
|
13585
|
+
}
|
|
13586
|
+
}
|
|
13587
|
+
};
|
|
13588
|
+
function _ts_decorate62(decorators, target, key, desc) {
|
|
13311
13589
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13312
13590
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13313
13591
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13314
13592
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13315
13593
|
}
|
|
13316
|
-
__name(
|
|
13317
|
-
function
|
|
13594
|
+
__name(_ts_decorate62, "_ts_decorate");
|
|
13595
|
+
function _ts_metadata57(k, v) {
|
|
13318
13596
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13319
13597
|
}
|
|
13320
|
-
__name(
|
|
13598
|
+
__name(_ts_metadata57, "_ts_metadata");
|
|
13321
13599
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
13322
13600
|
var PREFIX_LENGTH = 5;
|
|
13323
13601
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -13374,10 +13652,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
|
|
|
13374
13652
|
}
|
|
13375
13653
|
}
|
|
13376
13654
|
};
|
|
13377
|
-
exports.HibpBreachChecker =
|
|
13655
|
+
exports.HibpBreachChecker = _ts_decorate62([
|
|
13378
13656
|
common.Injectable(),
|
|
13379
|
-
|
|
13380
|
-
|
|
13657
|
+
_ts_metadata57("design:type", Function),
|
|
13658
|
+
_ts_metadata57("design:paramtypes", [
|
|
13381
13659
|
Number
|
|
13382
13660
|
])
|
|
13383
13661
|
], exports.HibpBreachChecker);
|
|
@@ -13390,16 +13668,16 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
|
|
|
13390
13668
|
return false;
|
|
13391
13669
|
}
|
|
13392
13670
|
};
|
|
13393
|
-
exports.AllowAllBreachChecker =
|
|
13671
|
+
exports.AllowAllBreachChecker = _ts_decorate62([
|
|
13394
13672
|
common.Injectable()
|
|
13395
13673
|
], exports.AllowAllBreachChecker);
|
|
13396
|
-
function
|
|
13674
|
+
function _ts_decorate63(decorators, target, key, desc) {
|
|
13397
13675
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13398
13676
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13399
13677
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13400
13678
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13401
13679
|
}
|
|
13402
|
-
__name(
|
|
13680
|
+
__name(_ts_decorate63, "_ts_decorate");
|
|
13403
13681
|
exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
|
|
13404
13682
|
static {
|
|
13405
13683
|
__name(this, "OptionalAuthGuard");
|
|
@@ -13414,26 +13692,26 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
|
|
|
13414
13692
|
return super.canActivate(context);
|
|
13415
13693
|
}
|
|
13416
13694
|
};
|
|
13417
|
-
exports.OptionalAuthGuard =
|
|
13695
|
+
exports.OptionalAuthGuard = _ts_decorate63([
|
|
13418
13696
|
common.Injectable()
|
|
13419
13697
|
], exports.OptionalAuthGuard);
|
|
13420
|
-
function
|
|
13698
|
+
function _ts_decorate64(decorators, target, key, desc) {
|
|
13421
13699
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13422
13700
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13423
13701
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13424
13702
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13425
13703
|
}
|
|
13426
|
-
__name(
|
|
13427
|
-
function
|
|
13704
|
+
__name(_ts_decorate64, "_ts_decorate");
|
|
13705
|
+
function _ts_metadata58(k, v) {
|
|
13428
13706
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13429
13707
|
}
|
|
13430
|
-
__name(
|
|
13431
|
-
function
|
|
13708
|
+
__name(_ts_metadata58, "_ts_metadata");
|
|
13709
|
+
function _ts_param35(paramIndex, decorator) {
|
|
13432
13710
|
return function(target, key) {
|
|
13433
13711
|
decorator(target, key, paramIndex);
|
|
13434
13712
|
};
|
|
13435
13713
|
}
|
|
13436
|
-
__name(
|
|
13714
|
+
__name(_ts_param35, "_ts_param");
|
|
13437
13715
|
exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
13438
13716
|
static {
|
|
13439
13717
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -13463,11 +13741,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
|
13463
13741
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE, common.HttpStatus.FORBIDDEN);
|
|
13464
13742
|
}
|
|
13465
13743
|
};
|
|
13466
|
-
exports.SelfOrAdminGuard =
|
|
13744
|
+
exports.SelfOrAdminGuard = _ts_decorate64([
|
|
13467
13745
|
common.Injectable(),
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13746
|
+
_ts_param35(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13747
|
+
_ts_metadata58("design:type", Function),
|
|
13748
|
+
_ts_metadata58("design:paramtypes", [
|
|
13471
13749
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13472
13750
|
])
|
|
13473
13751
|
], exports.SelfOrAdminGuard);
|
|
@@ -13480,34 +13758,34 @@ function isHexLooking(value) {
|
|
|
13480
13758
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
13481
13759
|
}
|
|
13482
13760
|
__name(isHexLooking, "isHexLooking");
|
|
13483
|
-
function
|
|
13761
|
+
function _ts_decorate65(decorators, target, key, desc) {
|
|
13484
13762
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13485
13763
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13486
13764
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13487
13765
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13488
13766
|
}
|
|
13489
|
-
__name(
|
|
13490
|
-
function
|
|
13767
|
+
__name(_ts_decorate65, "_ts_decorate");
|
|
13768
|
+
function _ts_metadata59(k, v) {
|
|
13491
13769
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13492
13770
|
}
|
|
13493
|
-
__name(
|
|
13494
|
-
function
|
|
13771
|
+
__name(_ts_metadata59, "_ts_metadata");
|
|
13772
|
+
function _ts_param36(paramIndex, decorator) {
|
|
13495
13773
|
return function(target, key) {
|
|
13496
13774
|
decorator(target, key, paramIndex);
|
|
13497
13775
|
};
|
|
13498
13776
|
}
|
|
13499
|
-
__name(
|
|
13777
|
+
__name(_ts_param36, "_ts_param");
|
|
13500
13778
|
exports.WsJwtGuard = class WsJwtGuard {
|
|
13501
13779
|
static {
|
|
13502
13780
|
__name(this, "WsJwtGuard");
|
|
13503
13781
|
}
|
|
13504
13782
|
jwtService;
|
|
13505
|
-
|
|
13783
|
+
revocation;
|
|
13506
13784
|
wsTickets;
|
|
13507
13785
|
options;
|
|
13508
|
-
constructor(jwtService,
|
|
13786
|
+
constructor(jwtService, revocation, wsTickets, options) {
|
|
13509
13787
|
this.jwtService = jwtService;
|
|
13510
|
-
this.
|
|
13788
|
+
this.revocation = revocation;
|
|
13511
13789
|
this.wsTickets = wsTickets;
|
|
13512
13790
|
this.options = options;
|
|
13513
13791
|
}
|
|
@@ -13546,29 +13824,24 @@ exports.WsJwtGuard = class WsJwtGuard {
|
|
|
13546
13824
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
13547
13825
|
}
|
|
13548
13826
|
assertTokenType(payload, "dashboard");
|
|
13549
|
-
const revoked = await this.redis.get(`rv:${payload.jti}`);
|
|
13550
|
-
if (revoked !== null) {
|
|
13551
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
13552
|
-
}
|
|
13553
13827
|
assertValidSub(payload.sub);
|
|
13554
|
-
|
|
13555
|
-
if (readStampedEpoch(payload) < epoch) {
|
|
13828
|
+
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
13556
13829
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
13557
13830
|
}
|
|
13558
13831
|
client.data.user = payload;
|
|
13559
13832
|
return true;
|
|
13560
13833
|
}
|
|
13561
13834
|
};
|
|
13562
|
-
exports.WsJwtGuard =
|
|
13835
|
+
exports.WsJwtGuard = _ts_decorate65([
|
|
13563
13836
|
common.Injectable(),
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13837
|
+
_ts_param36(0, common.Inject(jwt.JwtService)),
|
|
13838
|
+
_ts_param36(1, common.Inject(exports.AuthRevocationService)),
|
|
13839
|
+
_ts_param36(2, common.Inject(exports.WsTicketService)),
|
|
13840
|
+
_ts_param36(3, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13841
|
+
_ts_metadata59("design:type", Function),
|
|
13842
|
+
_ts_metadata59("design:paramtypes", [
|
|
13570
13843
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
13571
|
-
typeof
|
|
13844
|
+
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
13572
13845
|
typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
|
|
13573
13846
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13574
13847
|
])
|
|
@@ -13599,13 +13872,13 @@ function readUpgradeTicket(client) {
|
|
|
13599
13872
|
return all.length === 1 && all[0] !== "" ? all[0] : void 0;
|
|
13600
13873
|
}
|
|
13601
13874
|
__name(readUpgradeTicket, "readUpgradeTicket");
|
|
13602
|
-
function
|
|
13875
|
+
function _ts_decorate66(decorators, target, key, desc) {
|
|
13603
13876
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13604
13877
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13605
13878
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13606
13879
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13607
13880
|
}
|
|
13608
|
-
__name(
|
|
13881
|
+
__name(_ts_decorate66, "_ts_decorate");
|
|
13609
13882
|
function isAuthEnvelope(body) {
|
|
13610
13883
|
if (typeof body !== "object" || body === null) return false;
|
|
13611
13884
|
const error = body.error;
|
|
@@ -13657,7 +13930,7 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
13657
13930
|
});
|
|
13658
13931
|
}
|
|
13659
13932
|
};
|
|
13660
|
-
exports.AuthExceptionFilter =
|
|
13933
|
+
exports.AuthExceptionFilter = _ts_decorate66([
|
|
13661
13934
|
common.Catch()
|
|
13662
13935
|
], exports.AuthExceptionFilter);
|
|
13663
13936
|
|
|
@@ -13678,6 +13951,7 @@ exports.BYMAX_AUTH_USER_REPOSITORY = BYMAX_AUTH_USER_REPOSITORY;
|
|
|
13678
13951
|
exports.ChangePasswordDto = ChangePasswordDto;
|
|
13679
13952
|
exports.CreateInvitationDto = CreateInvitationDto;
|
|
13680
13953
|
exports.CurrentUser = CurrentUser;
|
|
13954
|
+
exports.DefaultAuthEmailProvider = DefaultAuthEmailProvider;
|
|
13681
13955
|
exports.ForgotPasswordDto = ForgotPasswordDto;
|
|
13682
13956
|
exports.IS_PUBLIC_KEY = IS_PUBLIC_KEY;
|
|
13683
13957
|
exports.LoginDto = LoginDto;
|