@bymax-one/nest-auth 1.3.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 +82 -1
- package/README.md +38 -9
- package/dist/server/index.cjs +1243 -984
- package/dist/server/index.d.cts +285 -24
- package/dist/server/index.d.ts +285 -24
- package/dist/server/index.mjs +1243 -985
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -2688,6 +2688,100 @@ exports.AuthRateLimitGuard = _ts_decorate6([
|
|
|
2688
2688
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
2689
2689
|
])
|
|
2690
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
|
|
2691
2785
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
2692
2786
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2693
2787
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2705,6 +2799,58 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
2705
2799
|
};
|
|
2706
2800
|
}
|
|
2707
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");
|
|
2708
2854
|
var HOSTNAME_RE = /^[a-z0-9.-]+$/i;
|
|
2709
2855
|
exports.TokenDeliveryService = class TokenDeliveryService {
|
|
2710
2856
|
static {
|
|
@@ -2993,107 +3139,15 @@ exports.TokenDeliveryService = class TokenDeliveryService {
|
|
|
2993
3139
|
return typeof value === "string" ? value : void 0;
|
|
2994
3140
|
}
|
|
2995
3141
|
};
|
|
2996
|
-
exports.TokenDeliveryService =
|
|
3142
|
+
exports.TokenDeliveryService = _ts_decorate8([
|
|
2997
3143
|
common.Injectable(),
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3144
|
+
_ts_param4(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3145
|
+
_ts_metadata8("design:type", Function),
|
|
3146
|
+
_ts_metadata8("design:paramtypes", [
|
|
3001
3147
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3002
3148
|
])
|
|
3003
3149
|
], exports.TokenDeliveryService);
|
|
3004
3150
|
|
|
3005
|
-
// src/server/utils/assert-not-blocked.ts
|
|
3006
|
-
var BLOCKED_STATUS_CODES = /* @__PURE__ */ new Map([
|
|
3007
|
-
[
|
|
3008
|
-
"banned",
|
|
3009
|
-
AUTH_ERROR_CODES.ACCOUNT_BANNED
|
|
3010
|
-
],
|
|
3011
|
-
[
|
|
3012
|
-
"suspended",
|
|
3013
|
-
AUTH_ERROR_CODES.ACCOUNT_SUSPENDED
|
|
3014
|
-
],
|
|
3015
|
-
[
|
|
3016
|
-
"pending",
|
|
3017
|
-
AUTH_ERROR_CODES.PENDING_APPROVAL
|
|
3018
|
-
],
|
|
3019
|
-
[
|
|
3020
|
-
"pending_approval",
|
|
3021
|
-
AUTH_ERROR_CODES.PENDING_APPROVAL
|
|
3022
|
-
]
|
|
3023
|
-
]);
|
|
3024
|
-
function assertNotBlocked(status, blockedStatuses) {
|
|
3025
|
-
const canonical = status.toLowerCase();
|
|
3026
|
-
if (!blockedStatuses.some((blocked) => blocked.toLowerCase() === canonical)) {
|
|
3027
|
-
return;
|
|
3028
|
-
}
|
|
3029
|
-
throw new AuthException(BLOCKED_STATUS_CODES.get(canonical) ?? AUTH_ERROR_CODES.ACCOUNT_INACTIVE, 403);
|
|
3030
|
-
}
|
|
3031
|
-
__name(assertNotBlocked, "assertNotBlocked");
|
|
3032
|
-
|
|
3033
|
-
// src/server/utils/stamped-epoch.ts
|
|
3034
|
-
function readStampedEpoch(payload) {
|
|
3035
|
-
const { epoch } = payload;
|
|
3036
|
-
return typeof epoch === "number" && Number.isInteger(epoch) ? Math.max(0, epoch) : 0;
|
|
3037
|
-
}
|
|
3038
|
-
__name(readStampedEpoch, "readStampedEpoch");
|
|
3039
|
-
|
|
3040
|
-
// src/server/utils/sanitize-headers.ts
|
|
3041
|
-
var BLOCKED_HEADERS = /* @__PURE__ */ new Set([
|
|
3042
|
-
"authorization",
|
|
3043
|
-
"cookie",
|
|
3044
|
-
"proxy-authorization",
|
|
3045
|
-
"www-authenticate",
|
|
3046
|
-
// 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
|
|
3047
|
-
"x-api-key",
|
|
3048
|
-
// 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
|
|
3049
|
-
"x-auth-token",
|
|
3050
|
-
// 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
|
|
3051
|
-
"x-csrf-token",
|
|
3052
|
-
"x-session-id",
|
|
3053
|
-
"x-forwarded-for",
|
|
3054
|
-
"x-forwarded-host",
|
|
3055
|
-
"x-real-ip",
|
|
3056
|
-
"x-original-forwarded-for",
|
|
3057
|
-
"cf-connecting-ip",
|
|
3058
|
-
"true-client-ip",
|
|
3059
|
-
"x-cluster-client-ip"
|
|
3060
|
-
]);
|
|
3061
|
-
var SENSITIVE_HEADER_PATTERN = /^x-.*-(token|secret|key|password|credential|auth|bearer|signature|hmac)$/i;
|
|
3062
|
-
function sanitizeHeaders(headers) {
|
|
3063
|
-
return Object.fromEntries(Object.entries(headers).map(([key, value]) => [
|
|
3064
|
-
key.toLowerCase(),
|
|
3065
|
-
value
|
|
3066
|
-
]).filter(([key]) => !BLOCKED_HEADERS.has(key) && !SENSITIVE_HEADER_PATTERN.test(key)));
|
|
3067
|
-
}
|
|
3068
|
-
__name(sanitizeHeaders, "sanitizeHeaders");
|
|
3069
|
-
function createEmptyHookContext() {
|
|
3070
|
-
return {
|
|
3071
|
-
ip: "",
|
|
3072
|
-
userAgent: "",
|
|
3073
|
-
sanitizedHeaders: {}
|
|
3074
|
-
};
|
|
3075
|
-
}
|
|
3076
|
-
__name(createEmptyHookContext, "createEmptyHookContext");
|
|
3077
|
-
|
|
3078
|
-
// src/server/utils/sleep.ts
|
|
3079
|
-
var MAX_SLEEP_MS = 1e4;
|
|
3080
|
-
function sleep(ms) {
|
|
3081
|
-
const clamped = Math.min(Math.max(0, ms), MAX_SLEEP_MS);
|
|
3082
|
-
return new Promise((resolve) => {
|
|
3083
|
-
setTimeout(resolve, clamped);
|
|
3084
|
-
});
|
|
3085
|
-
}
|
|
3086
|
-
__name(sleep, "sleep");
|
|
3087
|
-
|
|
3088
|
-
// src/server/utils/roles.util.ts
|
|
3089
|
-
function hasRole(userRole, requiredRole, hierarchy) {
|
|
3090
|
-
if (userRole === requiredRole) return true;
|
|
3091
|
-
if (!Object.hasOwn(hierarchy, userRole)) return false;
|
|
3092
|
-
const inherited = hierarchy[userRole];
|
|
3093
|
-
return inherited !== void 0 && inherited.includes(requiredRole);
|
|
3094
|
-
}
|
|
3095
|
-
__name(hasRole, "hasRole");
|
|
3096
|
-
|
|
3097
3151
|
// src/server/utils/verify-with-rotation.ts
|
|
3098
3152
|
function verifyWithRotation(jwtService, options, token, { ignoreExpiration = false } = {}) {
|
|
3099
3153
|
const algorithms = [
|
|
@@ -3147,36 +3201,36 @@ function assertValidSub(sub) {
|
|
|
3147
3201
|
__name(assertValidSub, "assertValidSub");
|
|
3148
3202
|
|
|
3149
3203
|
// src/server/guards/jwt-auth.guard.ts
|
|
3150
|
-
function
|
|
3204
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
3151
3205
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3152
3206
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3153
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;
|
|
3154
3208
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3155
3209
|
}
|
|
3156
|
-
__name(
|
|
3157
|
-
function
|
|
3210
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
3211
|
+
function _ts_metadata9(k, v) {
|
|
3158
3212
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3159
3213
|
}
|
|
3160
|
-
__name(
|
|
3161
|
-
function
|
|
3214
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
3215
|
+
function _ts_param5(paramIndex, decorator) {
|
|
3162
3216
|
return function(target, key) {
|
|
3163
3217
|
decorator(target, key, paramIndex);
|
|
3164
3218
|
};
|
|
3165
3219
|
}
|
|
3166
|
-
__name(
|
|
3220
|
+
__name(_ts_param5, "_ts_param");
|
|
3167
3221
|
exports.JwtAuthGuard = class JwtAuthGuard {
|
|
3168
3222
|
static {
|
|
3169
3223
|
__name(this, "JwtAuthGuard");
|
|
3170
3224
|
}
|
|
3171
3225
|
jwtService;
|
|
3172
3226
|
tokenDelivery;
|
|
3173
|
-
|
|
3227
|
+
revocation;
|
|
3174
3228
|
reflector;
|
|
3175
3229
|
options;
|
|
3176
|
-
constructor(jwtService, tokenDelivery,
|
|
3230
|
+
constructor(jwtService, tokenDelivery, revocation, reflector, options) {
|
|
3177
3231
|
this.jwtService = jwtService;
|
|
3178
3232
|
this.tokenDelivery = tokenDelivery;
|
|
3179
|
-
this.
|
|
3233
|
+
this.revocation = revocation;
|
|
3180
3234
|
this.reflector = reflector;
|
|
3181
3235
|
this.options = options;
|
|
3182
3236
|
}
|
|
@@ -3200,51 +3254,46 @@ exports.JwtAuthGuard = class JwtAuthGuard {
|
|
|
3200
3254
|
assertValidJti(payload.jti);
|
|
3201
3255
|
assertValidSub(payload.sub);
|
|
3202
3256
|
assertTokenType(payload, "dashboard");
|
|
3203
|
-
|
|
3204
|
-
if (revoked !== null) {
|
|
3205
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3206
|
-
}
|
|
3207
|
-
const epoch = await this.redis.getUserTokenEpoch(payload.sub);
|
|
3208
|
-
if (readStampedEpoch(payload) < epoch) {
|
|
3257
|
+
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
3209
3258
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
3210
3259
|
}
|
|
3211
3260
|
request.user = payload;
|
|
3212
3261
|
return true;
|
|
3213
3262
|
}
|
|
3214
3263
|
};
|
|
3215
|
-
exports.JwtAuthGuard =
|
|
3264
|
+
exports.JwtAuthGuard = _ts_decorate9([
|
|
3216
3265
|
common.Injectable(),
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
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", [
|
|
3224
3273
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
3225
3274
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
3226
|
-
typeof
|
|
3275
|
+
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
3227
3276
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
3228
3277
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3229
3278
|
])
|
|
3230
3279
|
], exports.JwtAuthGuard);
|
|
3231
|
-
function
|
|
3280
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
3232
3281
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3233
3282
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3234
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;
|
|
3235
3284
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3236
3285
|
}
|
|
3237
|
-
__name(
|
|
3238
|
-
function
|
|
3286
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
3287
|
+
function _ts_metadata10(k, v) {
|
|
3239
3288
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3240
3289
|
}
|
|
3241
|
-
__name(
|
|
3242
|
-
function
|
|
3290
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
3291
|
+
function _ts_param6(paramIndex, decorator) {
|
|
3243
3292
|
return function(target, key) {
|
|
3244
3293
|
decorator(target, key, paramIndex);
|
|
3245
3294
|
};
|
|
3246
3295
|
}
|
|
3247
|
-
__name(
|
|
3296
|
+
__name(_ts_param6, "_ts_param");
|
|
3248
3297
|
var SAFE_METHODS = /* @__PURE__ */ new Set([
|
|
3249
3298
|
"GET",
|
|
3250
3299
|
"HEAD",
|
|
@@ -3282,31 +3331,31 @@ exports.TrustedOriginGuard = class TrustedOriginGuard {
|
|
|
3282
3331
|
return true;
|
|
3283
3332
|
}
|
|
3284
3333
|
};
|
|
3285
|
-
exports.TrustedOriginGuard =
|
|
3334
|
+
exports.TrustedOriginGuard = _ts_decorate10([
|
|
3286
3335
|
common.Injectable(),
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3336
|
+
_ts_param6(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
3337
|
+
_ts_metadata10("design:type", Function),
|
|
3338
|
+
_ts_metadata10("design:paramtypes", [
|
|
3290
3339
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3291
3340
|
])
|
|
3292
3341
|
], exports.TrustedOriginGuard);
|
|
3293
|
-
function
|
|
3342
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
3294
3343
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3295
3344
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3296
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;
|
|
3297
3346
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3298
3347
|
}
|
|
3299
|
-
__name(
|
|
3300
|
-
function
|
|
3348
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
3349
|
+
function _ts_metadata11(k, v) {
|
|
3301
3350
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3302
3351
|
}
|
|
3303
|
-
__name(
|
|
3304
|
-
function
|
|
3352
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
3353
|
+
function _ts_param7(paramIndex, decorator) {
|
|
3305
3354
|
return function(target, key) {
|
|
3306
3355
|
decorator(target, key, paramIndex);
|
|
3307
3356
|
};
|
|
3308
3357
|
}
|
|
3309
|
-
__name(
|
|
3358
|
+
__name(_ts_param7, "_ts_param");
|
|
3310
3359
|
exports.UserStatusGuard = class UserStatusGuard {
|
|
3311
3360
|
static {
|
|
3312
3361
|
__name(this, "UserStatusGuard");
|
|
@@ -3339,25 +3388,25 @@ exports.UserStatusGuard = class UserStatusGuard {
|
|
|
3339
3388
|
return true;
|
|
3340
3389
|
}
|
|
3341
3390
|
};
|
|
3342
|
-
exports.UserStatusGuard =
|
|
3391
|
+
exports.UserStatusGuard = _ts_decorate11([
|
|
3343
3392
|
common.Injectable(),
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
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", [
|
|
3349
3398
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
3350
3399
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
3351
3400
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3352
3401
|
])
|
|
3353
3402
|
], exports.UserStatusGuard);
|
|
3354
|
-
function
|
|
3403
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
3355
3404
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3356
3405
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3357
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;
|
|
3358
3407
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3359
3408
|
}
|
|
3360
|
-
__name(
|
|
3409
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
3361
3410
|
var NoStoreInterceptor = class {
|
|
3362
3411
|
static {
|
|
3363
3412
|
__name(this, "NoStoreInterceptor");
|
|
@@ -3372,7 +3421,7 @@ var NoStoreInterceptor = class {
|
|
|
3372
3421
|
return next.handle();
|
|
3373
3422
|
}
|
|
3374
3423
|
};
|
|
3375
|
-
NoStoreInterceptor =
|
|
3424
|
+
NoStoreInterceptor = _ts_decorate12([
|
|
3376
3425
|
common.Injectable()
|
|
3377
3426
|
], NoStoreInterceptor);
|
|
3378
3427
|
function flattenValidationErrors(errors, parentPath = "") {
|
|
@@ -3401,23 +3450,23 @@ function createAuthValidationPipe(options = {}) {
|
|
|
3401
3450
|
});
|
|
3402
3451
|
}
|
|
3403
3452
|
__name(createAuthValidationPipe, "createAuthValidationPipe");
|
|
3404
|
-
function
|
|
3453
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
3405
3454
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3406
3455
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3407
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;
|
|
3408
3457
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3409
3458
|
}
|
|
3410
|
-
__name(
|
|
3411
|
-
function
|
|
3459
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
3460
|
+
function _ts_metadata12(k, v) {
|
|
3412
3461
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3413
3462
|
}
|
|
3414
|
-
__name(
|
|
3415
|
-
function
|
|
3463
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
3464
|
+
function _ts_param8(paramIndex, decorator) {
|
|
3416
3465
|
return function(target, key) {
|
|
3417
3466
|
decorator(target, key, paramIndex);
|
|
3418
3467
|
};
|
|
3419
3468
|
}
|
|
3420
|
-
__name(
|
|
3469
|
+
__name(_ts_param8, "_ts_param");
|
|
3421
3470
|
var LOCKOUT_PREFIX = "lf:";
|
|
3422
3471
|
var MAX_IDENTIFIER_LENGTH = 512;
|
|
3423
3472
|
exports.BruteForceService = class _BruteForceService {
|
|
@@ -3507,33 +3556,33 @@ exports.BruteForceService = class _BruteForceService {
|
|
|
3507
3556
|
}
|
|
3508
3557
|
}
|
|
3509
3558
|
};
|
|
3510
|
-
exports.BruteForceService =
|
|
3559
|
+
exports.BruteForceService = _ts_decorate13([
|
|
3511
3560
|
common.Injectable(),
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
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", [
|
|
3516
3565
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
3517
3566
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3518
3567
|
])
|
|
3519
3568
|
], exports.BruteForceService);
|
|
3520
|
-
function
|
|
3569
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
3521
3570
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3522
3571
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3523
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;
|
|
3524
3573
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3525
3574
|
}
|
|
3526
|
-
__name(
|
|
3527
|
-
function
|
|
3575
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
3576
|
+
function _ts_metadata13(k, v) {
|
|
3528
3577
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3529
3578
|
}
|
|
3530
|
-
__name(
|
|
3531
|
-
function
|
|
3579
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
3580
|
+
function _ts_param9(paramIndex, decorator) {
|
|
3532
3581
|
return function(target, key) {
|
|
3533
3582
|
decorator(target, key, paramIndex);
|
|
3534
3583
|
};
|
|
3535
3584
|
}
|
|
3536
|
-
__name(
|
|
3585
|
+
__name(_ts_param9, "_ts_param");
|
|
3537
3586
|
var MAX_ATTEMPTS = 5;
|
|
3538
3587
|
var MIN_VERIFY_MS = 100;
|
|
3539
3588
|
var OTP_STORE_LUA = `
|
|
@@ -3670,31 +3719,31 @@ exports.OtpService = class OtpService {
|
|
|
3670
3719
|
await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
|
|
3671
3720
|
}
|
|
3672
3721
|
};
|
|
3673
|
-
exports.OtpService =
|
|
3722
|
+
exports.OtpService = _ts_decorate14([
|
|
3674
3723
|
common.Injectable(),
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3724
|
+
_ts_param9(0, common.Inject(AuthRedisService)),
|
|
3725
|
+
_ts_metadata13("design:type", Function),
|
|
3726
|
+
_ts_metadata13("design:paramtypes", [
|
|
3678
3727
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService
|
|
3679
3728
|
])
|
|
3680
3729
|
], exports.OtpService);
|
|
3681
|
-
function
|
|
3730
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
3682
3731
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3683
3732
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3684
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;
|
|
3685
3734
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3686
3735
|
}
|
|
3687
|
-
__name(
|
|
3688
|
-
function
|
|
3736
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
3737
|
+
function _ts_metadata14(k, v) {
|
|
3689
3738
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
3690
3739
|
}
|
|
3691
|
-
__name(
|
|
3692
|
-
function
|
|
3740
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
3741
|
+
function _ts_param10(paramIndex, decorator) {
|
|
3693
3742
|
return function(target, key) {
|
|
3694
3743
|
decorator(target, key, paramIndex);
|
|
3695
3744
|
};
|
|
3696
3745
|
}
|
|
3697
|
-
__name(
|
|
3746
|
+
__name(_ts_param10, "_ts_param");
|
|
3698
3747
|
var scrypt = util.promisify(crypto.scrypt);
|
|
3699
3748
|
var SCRYPT_KEY_LEN = 64;
|
|
3700
3749
|
var SALT_BYTES = 16;
|
|
@@ -3978,33 +4027,33 @@ var PasswordService = class _PasswordService {
|
|
|
3978
4027
|
return crypto.timingSafeEqual(candidate, DUMMY_EXPECTED);
|
|
3979
4028
|
}
|
|
3980
4029
|
};
|
|
3981
|
-
PasswordService =
|
|
4030
|
+
PasswordService = _ts_decorate15([
|
|
3982
4031
|
common.Injectable(),
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
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", [
|
|
3987
4036
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
3988
4037
|
typeof IPasswordBreachChecker === "undefined" ? Object : IPasswordBreachChecker
|
|
3989
4038
|
])
|
|
3990
4039
|
], PasswordService);
|
|
3991
|
-
function
|
|
4040
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
3992
4041
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3993
4042
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3994
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;
|
|
3995
4044
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3996
4045
|
}
|
|
3997
|
-
__name(
|
|
3998
|
-
function
|
|
4046
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
4047
|
+
function _ts_metadata15(k, v) {
|
|
3999
4048
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4000
4049
|
}
|
|
4001
|
-
__name(
|
|
4002
|
-
function
|
|
4050
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
4051
|
+
function _ts_param11(paramIndex, decorator) {
|
|
4003
4052
|
return function(target, key) {
|
|
4004
4053
|
decorator(target, key, paramIndex);
|
|
4005
4054
|
};
|
|
4006
4055
|
}
|
|
4007
|
-
__name(
|
|
4056
|
+
__name(_ts_param11, "_ts_param");
|
|
4008
4057
|
var MAX_IP_LENGTH = 45;
|
|
4009
4058
|
var SESSION_HASH_RE = /^[a-f0-9]{64}$/;
|
|
4010
4059
|
var REVOKE_SESSION_LUA = `
|
|
@@ -4510,15 +4559,15 @@ exports.SessionService = class _SessionService {
|
|
|
4510
4559
|
}
|
|
4511
4560
|
}
|
|
4512
4561
|
};
|
|
4513
|
-
exports.SessionService =
|
|
4562
|
+
exports.SessionService = _ts_decorate16([
|
|
4514
4563
|
common.Injectable(),
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
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", [
|
|
4522
4571
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
4523
4572
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
4524
4573
|
Object,
|
|
@@ -4541,23 +4590,23 @@ function logSafe(value) {
|
|
|
4541
4590
|
__name(logSafe, "logSafe");
|
|
4542
4591
|
|
|
4543
4592
|
// src/server/services/token-manager.service.ts
|
|
4544
|
-
function
|
|
4593
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4545
4594
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4546
4595
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4547
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;
|
|
4548
4597
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4549
4598
|
}
|
|
4550
|
-
__name(
|
|
4551
|
-
function
|
|
4599
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
4600
|
+
function _ts_metadata16(k, v) {
|
|
4552
4601
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4553
4602
|
}
|
|
4554
|
-
__name(
|
|
4555
|
-
function
|
|
4603
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
4604
|
+
function _ts_param12(paramIndex, decorator) {
|
|
4556
4605
|
return function(target, key) {
|
|
4557
4606
|
decorator(target, key, paramIndex);
|
|
4558
4607
|
};
|
|
4559
4608
|
}
|
|
4560
|
-
__name(
|
|
4609
|
+
__name(_ts_param12, "_ts_param");
|
|
4561
4610
|
var MFA_TEMP_TOKEN_TTL_SECONDS = 300;
|
|
4562
4611
|
var MAX_SESSION_FIELD_LENGTH = 45;
|
|
4563
4612
|
var TokenManagerService = class _TokenManagerService {
|
|
@@ -5353,15 +5402,15 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
5353
5402
|
return await this.redis.del(`mfa:${sha256(jti)}`);
|
|
5354
5403
|
}
|
|
5355
5404
|
};
|
|
5356
|
-
TokenManagerService =
|
|
5405
|
+
TokenManagerService = _ts_decorate17([
|
|
5357
5406
|
common.Injectable(),
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
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", [
|
|
5365
5414
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
5366
5415
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
5367
5416
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -5406,23 +5455,23 @@ function tenantScoped(user, tenantId) {
|
|
|
5406
5455
|
__name(tenantScoped, "tenantScoped");
|
|
5407
5456
|
|
|
5408
5457
|
// src/server/services/auth.service.ts
|
|
5409
|
-
function
|
|
5458
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
5410
5459
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5411
5460
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5412
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;
|
|
5413
5462
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5414
5463
|
}
|
|
5415
|
-
__name(
|
|
5416
|
-
function
|
|
5464
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
5465
|
+
function _ts_metadata17(k, v) {
|
|
5417
5466
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5418
5467
|
}
|
|
5419
|
-
__name(
|
|
5420
|
-
function
|
|
5468
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
5469
|
+
function _ts_param13(paramIndex, decorator) {
|
|
5421
5470
|
return function(target, key) {
|
|
5422
5471
|
decorator(target, key, paramIndex);
|
|
5423
5472
|
};
|
|
5424
5473
|
}
|
|
5425
|
-
__name(
|
|
5474
|
+
__name(_ts_param13, "_ts_param");
|
|
5426
5475
|
var ANTI_ENUM_MIN_MS = 300;
|
|
5427
5476
|
exports.AuthService = class _AuthService {
|
|
5428
5477
|
static {
|
|
@@ -6151,27 +6200,27 @@ exports.AuthService = class _AuthService {
|
|
|
6151
6200
|
const ttl = this.options.emailVerification.otpTtlSeconds;
|
|
6152
6201
|
const otp = this.otpService.generate(length);
|
|
6153
6202
|
await this.otpService.store("email_verification", identifier, otp, ttl);
|
|
6154
|
-
void this.emailProvider.sendEmailVerificationOtp(email, otp).catch((err) => {
|
|
6203
|
+
void this.emailProvider.sendEmailVerificationOtp(tenantId, email, otp).catch((err) => {
|
|
6155
6204
|
this.logger.error(`sendEmailVerificationOtp failed for user ${userId}`, err);
|
|
6156
6205
|
});
|
|
6157
6206
|
}
|
|
6158
6207
|
};
|
|
6159
|
-
exports.AuthService =
|
|
6208
|
+
exports.AuthService = _ts_decorate18([
|
|
6160
6209
|
common.Injectable(),
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
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", [
|
|
6175
6224
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6176
6225
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6177
6226
|
Object,
|
|
@@ -6194,23 +6243,23 @@ __name(toSafeUser2, "toSafeUser");
|
|
|
6194
6243
|
var WS_TICKET_TTL_SECONDS = 30;
|
|
6195
6244
|
|
|
6196
6245
|
// src/server/services/ws-ticket.service.ts
|
|
6197
|
-
function
|
|
6246
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
6198
6247
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6199
6248
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6200
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;
|
|
6201
6250
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6202
6251
|
}
|
|
6203
|
-
__name(
|
|
6204
|
-
function
|
|
6252
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
6253
|
+
function _ts_metadata18(k, v) {
|
|
6205
6254
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6206
6255
|
}
|
|
6207
|
-
__name(
|
|
6208
|
-
function
|
|
6256
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
6257
|
+
function _ts_param14(paramIndex, decorator) {
|
|
6209
6258
|
return function(target, key) {
|
|
6210
6259
|
decorator(target, key, paramIndex);
|
|
6211
6260
|
};
|
|
6212
6261
|
}
|
|
6213
|
-
__name(
|
|
6262
|
+
__name(_ts_param14, "_ts_param");
|
|
6214
6263
|
exports.WsTicketService = class _WsTicketService {
|
|
6215
6264
|
static {
|
|
6216
6265
|
__name(this, "WsTicketService");
|
|
@@ -6278,13 +6327,13 @@ exports.WsTicketService = class _WsTicketService {
|
|
|
6278
6327
|
return snapshot;
|
|
6279
6328
|
}
|
|
6280
6329
|
};
|
|
6281
|
-
exports.WsTicketService =
|
|
6330
|
+
exports.WsTicketService = _ts_decorate19([
|
|
6282
6331
|
common.Injectable(),
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
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", [
|
|
6288
6337
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
6289
6338
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6290
6339
|
typeof IUserRepository === "undefined" ? Object : IUserRepository
|
|
@@ -6292,23 +6341,23 @@ exports.WsTicketService = _ts_decorate18([
|
|
|
6292
6341
|
], exports.WsTicketService);
|
|
6293
6342
|
|
|
6294
6343
|
// src/server/controllers/auth.controller.ts
|
|
6295
|
-
function
|
|
6344
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
6296
6345
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6297
6346
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6298
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;
|
|
6299
6348
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6300
6349
|
}
|
|
6301
|
-
__name(
|
|
6302
|
-
function
|
|
6350
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
6351
|
+
function _ts_metadata19(k, v) {
|
|
6303
6352
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6304
6353
|
}
|
|
6305
|
-
__name(
|
|
6306
|
-
function
|
|
6354
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
6355
|
+
function _ts_param15(paramIndex, decorator) {
|
|
6307
6356
|
return function(target, key) {
|
|
6308
6357
|
decorator(target, key, paramIndex);
|
|
6309
6358
|
};
|
|
6310
6359
|
}
|
|
6311
|
-
__name(
|
|
6360
|
+
__name(_ts_param15, "_ts_param");
|
|
6312
6361
|
function isMfaChallenge(result) {
|
|
6313
6362
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
6314
6363
|
}
|
|
@@ -6450,156 +6499,156 @@ var AuthController = class {
|
|
|
6450
6499
|
await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
|
|
6451
6500
|
}
|
|
6452
6501
|
};
|
|
6453
|
-
|
|
6502
|
+
_ts_decorate20([
|
|
6454
6503
|
Public(),
|
|
6455
6504
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.register),
|
|
6456
6505
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
|
|
6457
6506
|
common.Post("register"),
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6507
|
+
_ts_param15(0, common.Body()),
|
|
6508
|
+
_ts_param15(1, common.Req()),
|
|
6509
|
+
_ts_param15(2, common.Res({
|
|
6461
6510
|
passthrough: true
|
|
6462
6511
|
})),
|
|
6463
|
-
|
|
6464
|
-
|
|
6512
|
+
_ts_metadata19("design:type", Function),
|
|
6513
|
+
_ts_metadata19("design:paramtypes", [
|
|
6465
6514
|
typeof RegisterDto === "undefined" ? Object : RegisterDto,
|
|
6466
6515
|
typeof Request === "undefined" ? Object : Request,
|
|
6467
6516
|
typeof Response === "undefined" ? Object : Response
|
|
6468
6517
|
]),
|
|
6469
|
-
|
|
6518
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6470
6519
|
], AuthController.prototype, "register", null);
|
|
6471
|
-
|
|
6520
|
+
_ts_decorate20([
|
|
6472
6521
|
Public(),
|
|
6473
6522
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.login),
|
|
6474
6523
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
|
|
6475
6524
|
common.HttpCode(common.HttpStatus.OK),
|
|
6476
6525
|
common.Post("login"),
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6526
|
+
_ts_param15(0, common.Body()),
|
|
6527
|
+
_ts_param15(1, common.Req()),
|
|
6528
|
+
_ts_param15(2, common.Res({
|
|
6480
6529
|
passthrough: true
|
|
6481
6530
|
})),
|
|
6482
|
-
|
|
6483
|
-
|
|
6531
|
+
_ts_metadata19("design:type", Function),
|
|
6532
|
+
_ts_metadata19("design:paramtypes", [
|
|
6484
6533
|
typeof LoginDto === "undefined" ? Object : LoginDto,
|
|
6485
6534
|
typeof Request === "undefined" ? Object : Request,
|
|
6486
6535
|
typeof Response === "undefined" ? Object : Response
|
|
6487
6536
|
]),
|
|
6488
|
-
|
|
6537
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6489
6538
|
], AuthController.prototype, "login", null);
|
|
6490
|
-
|
|
6539
|
+
_ts_decorate20([
|
|
6491
6540
|
Public(),
|
|
6492
6541
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
6493
6542
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
6494
6543
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6495
6544
|
common.Post("logout"),
|
|
6496
|
-
|
|
6497
|
-
|
|
6545
|
+
_ts_param15(0, common.Req()),
|
|
6546
|
+
_ts_param15(1, common.Res({
|
|
6498
6547
|
passthrough: true
|
|
6499
6548
|
})),
|
|
6500
|
-
|
|
6501
|
-
|
|
6549
|
+
_ts_metadata19("design:type", Function),
|
|
6550
|
+
_ts_metadata19("design:paramtypes", [
|
|
6502
6551
|
typeof Request === "undefined" ? Object : Request,
|
|
6503
6552
|
typeof Response === "undefined" ? Object : Response
|
|
6504
6553
|
]),
|
|
6505
|
-
|
|
6554
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6506
6555
|
], AuthController.prototype, "logout", null);
|
|
6507
|
-
|
|
6556
|
+
_ts_decorate20([
|
|
6508
6557
|
Public(),
|
|
6509
6558
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6510
6559
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
6511
6560
|
common.HttpCode(common.HttpStatus.OK),
|
|
6512
6561
|
common.Post("refresh"),
|
|
6513
|
-
|
|
6514
|
-
|
|
6562
|
+
_ts_param15(0, common.Req()),
|
|
6563
|
+
_ts_param15(1, common.Res({
|
|
6515
6564
|
passthrough: true
|
|
6516
6565
|
})),
|
|
6517
|
-
|
|
6518
|
-
|
|
6566
|
+
_ts_metadata19("design:type", Function),
|
|
6567
|
+
_ts_metadata19("design:paramtypes", [
|
|
6519
6568
|
typeof Request === "undefined" ? Object : Request,
|
|
6520
6569
|
typeof Response === "undefined" ? Object : Response
|
|
6521
6570
|
]),
|
|
6522
|
-
|
|
6571
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6523
6572
|
], AuthController.prototype, "refresh", null);
|
|
6524
|
-
|
|
6573
|
+
_ts_decorate20([
|
|
6525
6574
|
common.UseGuards(exports.JwtAuthGuard),
|
|
6526
6575
|
common.Get("me"),
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6576
|
+
_ts_param15(0, CurrentUser()),
|
|
6577
|
+
_ts_metadata19("design:type", Function),
|
|
6578
|
+
_ts_metadata19("design:paramtypes", [
|
|
6530
6579
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
6531
6580
|
]),
|
|
6532
|
-
|
|
6581
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6533
6582
|
], AuthController.prototype, "me", null);
|
|
6534
|
-
|
|
6583
|
+
_ts_decorate20([
|
|
6535
6584
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
6536
6585
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
|
|
6537
6586
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
|
|
6538
6587
|
common.Post("ws-ticket"),
|
|
6539
6588
|
common.HttpCode(common.HttpStatus.OK),
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6589
|
+
_ts_param15(0, CurrentUser()),
|
|
6590
|
+
_ts_metadata19("design:type", Function),
|
|
6591
|
+
_ts_metadata19("design:paramtypes", [
|
|
6543
6592
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
6544
6593
|
]),
|
|
6545
|
-
|
|
6594
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6546
6595
|
], AuthController.prototype, "wsTicket", null);
|
|
6547
|
-
|
|
6596
|
+
_ts_decorate20([
|
|
6548
6597
|
Public(),
|
|
6549
6598
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
|
|
6550
6599
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
|
|
6551
6600
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6552
6601
|
common.Post("verify-email"),
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6602
|
+
_ts_param15(0, common.Body()),
|
|
6603
|
+
_ts_param15(1, common.Req()),
|
|
6604
|
+
_ts_metadata19("design:type", Function),
|
|
6605
|
+
_ts_metadata19("design:paramtypes", [
|
|
6557
6606
|
typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
|
|
6558
6607
|
typeof Request === "undefined" ? Object : Request
|
|
6559
6608
|
]),
|
|
6560
|
-
|
|
6609
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6561
6610
|
], AuthController.prototype, "verifyEmail", null);
|
|
6562
|
-
|
|
6611
|
+
_ts_decorate20([
|
|
6563
6612
|
Public(),
|
|
6564
6613
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
|
|
6565
6614
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
|
|
6566
6615
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6567
6616
|
common.Post("resend-verification"),
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6617
|
+
_ts_param15(0, common.Body()),
|
|
6618
|
+
_ts_param15(1, common.Req()),
|
|
6619
|
+
_ts_metadata19("design:type", Function),
|
|
6620
|
+
_ts_metadata19("design:paramtypes", [
|
|
6572
6621
|
typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
|
|
6573
6622
|
typeof Request === "undefined" ? Object : Request
|
|
6574
6623
|
]),
|
|
6575
|
-
|
|
6624
|
+
_ts_metadata19("design:returntype", Promise)
|
|
6576
6625
|
], AuthController.prototype, "resendVerification", null);
|
|
6577
|
-
AuthController =
|
|
6626
|
+
AuthController = _ts_decorate20([
|
|
6578
6627
|
common.UseInterceptors(NoStoreInterceptor),
|
|
6579
6628
|
common.Controller(),
|
|
6580
6629
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
6581
6630
|
common.UsePipes(createAuthValidationPipe()),
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
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", [
|
|
6587
6636
|
typeof exports.AuthService === "undefined" ? Object : exports.AuthService,
|
|
6588
6637
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
6589
6638
|
typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService
|
|
6590
6639
|
])
|
|
6591
6640
|
], AuthController);
|
|
6592
|
-
function
|
|
6641
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
6593
6642
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6594
6643
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6595
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;
|
|
6596
6645
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6597
6646
|
}
|
|
6598
|
-
__name(
|
|
6599
|
-
function
|
|
6647
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
6648
|
+
function _ts_metadata20(k, v) {
|
|
6600
6649
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6601
6650
|
}
|
|
6602
|
-
__name(
|
|
6651
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
6603
6652
|
var ChangeEmailDto = class {
|
|
6604
6653
|
static {
|
|
6605
6654
|
__name(this, "ChangeEmailDto");
|
|
@@ -6619,30 +6668,30 @@ var ChangeEmailDto = class {
|
|
|
6619
6668
|
*/
|
|
6620
6669
|
currentPassword;
|
|
6621
6670
|
};
|
|
6622
|
-
|
|
6671
|
+
_ts_decorate21([
|
|
6623
6672
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
6624
6673
|
classValidator.IsEmail(),
|
|
6625
6674
|
classValidator.IsNotEmpty(),
|
|
6626
6675
|
classValidator.MaxLength(255),
|
|
6627
|
-
|
|
6676
|
+
_ts_metadata20("design:type", String)
|
|
6628
6677
|
], ChangeEmailDto.prototype, "newEmail", void 0);
|
|
6629
|
-
|
|
6678
|
+
_ts_decorate21([
|
|
6630
6679
|
classValidator.IsString(),
|
|
6631
6680
|
classValidator.MinLength(1),
|
|
6632
6681
|
classValidator.MaxLength(128),
|
|
6633
|
-
|
|
6682
|
+
_ts_metadata20("design:type", String)
|
|
6634
6683
|
], ChangeEmailDto.prototype, "currentPassword", void 0);
|
|
6635
|
-
function
|
|
6684
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
6636
6685
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6637
6686
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6638
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;
|
|
6639
6688
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6640
6689
|
}
|
|
6641
|
-
__name(
|
|
6642
|
-
function
|
|
6690
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
6691
|
+
function _ts_metadata21(k, v) {
|
|
6643
6692
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6644
6693
|
}
|
|
6645
|
-
__name(
|
|
6694
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
6646
6695
|
var ConfirmEmailChangeDto = class {
|
|
6647
6696
|
static {
|
|
6648
6697
|
__name(this, "ConfirmEmailChangeDto");
|
|
@@ -6655,29 +6704,29 @@ var ConfirmEmailChangeDto = class {
|
|
|
6655
6704
|
*/
|
|
6656
6705
|
token;
|
|
6657
6706
|
};
|
|
6658
|
-
|
|
6707
|
+
_ts_decorate22([
|
|
6659
6708
|
classValidator.IsString(),
|
|
6660
6709
|
classValidator.IsNotEmpty(),
|
|
6661
6710
|
classValidator.Length(64, 64),
|
|
6662
|
-
|
|
6711
|
+
_ts_metadata21("design:type", String)
|
|
6663
6712
|
], ConfirmEmailChangeDto.prototype, "token", void 0);
|
|
6664
|
-
function
|
|
6713
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
6665
6714
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6666
6715
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6667
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;
|
|
6668
6717
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6669
6718
|
}
|
|
6670
|
-
__name(
|
|
6671
|
-
function
|
|
6719
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
6720
|
+
function _ts_metadata22(k, v) {
|
|
6672
6721
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6673
6722
|
}
|
|
6674
|
-
__name(
|
|
6675
|
-
function
|
|
6723
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
6724
|
+
function _ts_param16(paramIndex, decorator) {
|
|
6676
6725
|
return function(target, key) {
|
|
6677
6726
|
decorator(target, key, paramIndex);
|
|
6678
6727
|
};
|
|
6679
6728
|
}
|
|
6680
|
-
__name(
|
|
6729
|
+
__name(_ts_param16, "_ts_param");
|
|
6681
6730
|
var EMAIL_CHANGE_TOKEN_BYTES = 32;
|
|
6682
6731
|
function isEmailChangeContext(value) {
|
|
6683
6732
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -6767,7 +6816,7 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
6767
6816
|
passwordFingerprint: sha256(user.passwordHash)
|
|
6768
6817
|
};
|
|
6769
6818
|
await this.redis.set(`ec:${sha256(rawToken)}`, JSON.stringify(context), this.options.emailChange.tokenTtlSeconds);
|
|
6770
|
-
await this.emailProvider.sendEmailChangeVerification?.(newEmail, rawToken);
|
|
6819
|
+
await this.emailProvider.sendEmailChangeVerification?.(user.tenantId, newEmail, rawToken);
|
|
6771
6820
|
this.logger.log(`requestChange: verification sent userId=${userId} newEmail=${maskEmail(newEmail)}`);
|
|
6772
6821
|
}
|
|
6773
6822
|
// ---------------------------------------------------------------------------
|
|
@@ -6801,7 +6850,7 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
6801
6850
|
const oldEmail = user.email;
|
|
6802
6851
|
await this.userRepo.updateEmail(context.userId, context.newEmail);
|
|
6803
6852
|
this.logger.log(`confirmChange: address changed userId=${context.userId} from=${maskEmail(oldEmail)} to=${maskEmail(context.newEmail)}`);
|
|
6804
|
-
await this.notifyOldAddress(oldEmail, context.newEmail);
|
|
6853
|
+
await this.notifyOldAddress(user.tenantId, oldEmail, context.newEmail);
|
|
6805
6854
|
}
|
|
6806
6855
|
// ---------------------------------------------------------------------------
|
|
6807
6856
|
// Private helpers
|
|
@@ -6881,25 +6930,25 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
6881
6930
|
* @param oldEmail - The address the account is leaving.
|
|
6882
6931
|
* @param newEmail - The address it moved to.
|
|
6883
6932
|
*/
|
|
6884
|
-
async notifyOldAddress(oldEmail, newEmail) {
|
|
6933
|
+
async notifyOldAddress(tenantId, oldEmail, newEmail) {
|
|
6885
6934
|
if (!this.emailProvider.sendEmailChangedNotification) return;
|
|
6886
6935
|
try {
|
|
6887
|
-
await this.emailProvider.sendEmailChangedNotification(oldEmail, newEmail);
|
|
6936
|
+
await this.emailProvider.sendEmailChangedNotification(tenantId, oldEmail, newEmail);
|
|
6888
6937
|
} catch (err) {
|
|
6889
6938
|
this.logger.error("confirmChange: notification to the previous address failed", err);
|
|
6890
6939
|
}
|
|
6891
6940
|
}
|
|
6892
6941
|
};
|
|
6893
|
-
exports.EmailChangeService =
|
|
6942
|
+
exports.EmailChangeService = _ts_decorate23([
|
|
6894
6943
|
common.Injectable(),
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
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", [
|
|
6903
6952
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6904
6953
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
6905
6954
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
@@ -6910,23 +6959,23 @@ exports.EmailChangeService = _ts_decorate22([
|
|
|
6910
6959
|
], exports.EmailChangeService);
|
|
6911
6960
|
|
|
6912
6961
|
// src/server/controllers/email-change.controller.ts
|
|
6913
|
-
function
|
|
6962
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
6914
6963
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6915
6964
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6916
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;
|
|
6917
6966
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6918
6967
|
}
|
|
6919
|
-
__name(
|
|
6920
|
-
function
|
|
6968
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
6969
|
+
function _ts_metadata23(k, v) {
|
|
6921
6970
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
6922
6971
|
}
|
|
6923
|
-
__name(
|
|
6924
|
-
function
|
|
6972
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
6973
|
+
function _ts_param17(paramIndex, decorator) {
|
|
6925
6974
|
return function(target, key) {
|
|
6926
6975
|
decorator(target, key, paramIndex);
|
|
6927
6976
|
};
|
|
6928
6977
|
}
|
|
6929
|
-
__name(
|
|
6978
|
+
__name(_ts_param17, "_ts_param");
|
|
6930
6979
|
var EmailChangeController = class {
|
|
6931
6980
|
static {
|
|
6932
6981
|
__name(this, "EmailChangeController");
|
|
@@ -6973,56 +7022,56 @@ var EmailChangeController = class {
|
|
|
6973
7022
|
await this.emailChangeService.confirmChange(dto);
|
|
6974
7023
|
}
|
|
6975
7024
|
};
|
|
6976
|
-
|
|
7025
|
+
_ts_decorate24([
|
|
6977
7026
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
6978
7027
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
|
|
6979
7028
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
|
|
6980
7029
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6981
7030
|
common.Post("change"),
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
7031
|
+
_ts_param17(0, common.Body()),
|
|
7032
|
+
_ts_param17(1, CurrentUser()),
|
|
7033
|
+
_ts_metadata23("design:type", Function),
|
|
7034
|
+
_ts_metadata23("design:paramtypes", [
|
|
6986
7035
|
typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
|
|
6987
7036
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
6988
7037
|
]),
|
|
6989
|
-
|
|
7038
|
+
_ts_metadata23("design:returntype", Promise)
|
|
6990
7039
|
], EmailChangeController.prototype, "requestChange", null);
|
|
6991
|
-
|
|
7040
|
+
_ts_decorate24([
|
|
6992
7041
|
Public(),
|
|
6993
7042
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
|
|
6994
7043
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
|
|
6995
7044
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
6996
7045
|
common.Post("change/confirm"),
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7046
|
+
_ts_param17(0, common.Body()),
|
|
7047
|
+
_ts_metadata23("design:type", Function),
|
|
7048
|
+
_ts_metadata23("design:paramtypes", [
|
|
7000
7049
|
typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
|
|
7001
7050
|
]),
|
|
7002
|
-
|
|
7051
|
+
_ts_metadata23("design:returntype", Promise)
|
|
7003
7052
|
], EmailChangeController.prototype, "confirmChange", null);
|
|
7004
|
-
EmailChangeController =
|
|
7053
|
+
EmailChangeController = _ts_decorate24([
|
|
7005
7054
|
common.UseInterceptors(NoStoreInterceptor),
|
|
7006
7055
|
common.Controller("email"),
|
|
7007
7056
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
7008
7057
|
common.UsePipes(createAuthValidationPipe()),
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7058
|
+
_ts_param17(0, common.Inject(exports.EmailChangeService)),
|
|
7059
|
+
_ts_metadata23("design:type", Function),
|
|
7060
|
+
_ts_metadata23("design:paramtypes", [
|
|
7012
7061
|
typeof exports.EmailChangeService === "undefined" ? Object : exports.EmailChangeService
|
|
7013
7062
|
])
|
|
7014
7063
|
], EmailChangeController);
|
|
7015
|
-
function
|
|
7064
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
7016
7065
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7017
7066
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7018
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;
|
|
7019
7068
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7020
7069
|
}
|
|
7021
|
-
__name(
|
|
7022
|
-
function
|
|
7070
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
7071
|
+
function _ts_metadata24(k, v) {
|
|
7023
7072
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7024
7073
|
}
|
|
7025
|
-
__name(
|
|
7074
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
7026
7075
|
var AcceptInvitationDto = class {
|
|
7027
7076
|
static {
|
|
7028
7077
|
__name(this, "AcceptInvitationDto");
|
|
@@ -7060,34 +7109,34 @@ var AcceptInvitationDto = class {
|
|
|
7060
7109
|
*/
|
|
7061
7110
|
password;
|
|
7062
7111
|
};
|
|
7063
|
-
|
|
7112
|
+
_ts_decorate25([
|
|
7064
7113
|
classValidator.IsString(),
|
|
7065
7114
|
classValidator.IsNotEmpty(),
|
|
7066
7115
|
classValidator.Length(64, 64),
|
|
7067
|
-
|
|
7116
|
+
_ts_metadata24("design:type", String)
|
|
7068
7117
|
], AcceptInvitationDto.prototype, "token", void 0);
|
|
7069
|
-
|
|
7118
|
+
_ts_decorate25([
|
|
7070
7119
|
classValidator.IsString(),
|
|
7071
7120
|
classValidator.IsNotEmpty(),
|
|
7072
7121
|
classValidator.Length(2, 100),
|
|
7073
|
-
|
|
7122
|
+
_ts_metadata24("design:type", String)
|
|
7074
7123
|
], AcceptInvitationDto.prototype, "name", void 0);
|
|
7075
|
-
|
|
7124
|
+
_ts_decorate25([
|
|
7076
7125
|
classValidator.IsString(),
|
|
7077
7126
|
classValidator.Length(8, 128),
|
|
7078
|
-
|
|
7127
|
+
_ts_metadata24("design:type", String)
|
|
7079
7128
|
], AcceptInvitationDto.prototype, "password", void 0);
|
|
7080
|
-
function
|
|
7129
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
7081
7130
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7082
7131
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7083
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;
|
|
7084
7133
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7085
7134
|
}
|
|
7086
|
-
__name(
|
|
7087
|
-
function
|
|
7135
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
7136
|
+
function _ts_metadata25(k, v) {
|
|
7088
7137
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7089
7138
|
}
|
|
7090
|
-
__name(
|
|
7139
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
7091
7140
|
var CreateInvitationDto = class {
|
|
7092
7141
|
static {
|
|
7093
7142
|
__name(this, "CreateInvitationDto");
|
|
@@ -7118,37 +7167,37 @@ var CreateInvitationDto = class {
|
|
|
7118
7167
|
*/
|
|
7119
7168
|
tenantName;
|
|
7120
7169
|
};
|
|
7121
|
-
|
|
7170
|
+
_ts_decorate26([
|
|
7122
7171
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
7123
7172
|
classValidator.IsEmail(),
|
|
7124
7173
|
classValidator.IsNotEmpty(),
|
|
7125
7174
|
classValidator.MaxLength(255),
|
|
7126
|
-
|
|
7175
|
+
_ts_metadata25("design:type", String)
|
|
7127
7176
|
], CreateInvitationDto.prototype, "email", void 0);
|
|
7128
|
-
|
|
7177
|
+
_ts_decorate26([
|
|
7129
7178
|
classValidator.IsString(),
|
|
7130
7179
|
classValidator.IsNotEmpty(),
|
|
7131
7180
|
classValidator.MaxLength(64),
|
|
7132
|
-
|
|
7181
|
+
_ts_metadata25("design:type", String)
|
|
7133
7182
|
], CreateInvitationDto.prototype, "role", void 0);
|
|
7134
|
-
|
|
7183
|
+
_ts_decorate26([
|
|
7135
7184
|
classValidator.IsOptional(),
|
|
7136
7185
|
classValidator.IsString(),
|
|
7137
7186
|
classValidator.IsNotEmpty(),
|
|
7138
7187
|
classValidator.MaxLength(128),
|
|
7139
|
-
|
|
7188
|
+
_ts_metadata25("design:type", String)
|
|
7140
7189
|
], CreateInvitationDto.prototype, "tenantName", void 0);
|
|
7141
|
-
function
|
|
7190
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
7142
7191
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7143
7192
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7144
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;
|
|
7145
7194
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7146
7195
|
}
|
|
7147
|
-
__name(
|
|
7148
|
-
function
|
|
7196
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
7197
|
+
function _ts_metadata26(k, v) {
|
|
7149
7198
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7150
7199
|
}
|
|
7151
|
-
__name(
|
|
7200
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
7152
7201
|
var RevokeInvitationDto = class {
|
|
7153
7202
|
static {
|
|
7154
7203
|
__name(this, "RevokeInvitationDto");
|
|
@@ -7160,30 +7209,30 @@ var RevokeInvitationDto = class {
|
|
|
7160
7209
|
*/
|
|
7161
7210
|
email;
|
|
7162
7211
|
};
|
|
7163
|
-
|
|
7212
|
+
_ts_decorate27([
|
|
7164
7213
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
7165
7214
|
classValidator.IsEmail(),
|
|
7166
7215
|
classValidator.IsNotEmpty(),
|
|
7167
7216
|
classValidator.MaxLength(255),
|
|
7168
|
-
|
|
7217
|
+
_ts_metadata26("design:type", String)
|
|
7169
7218
|
], RevokeInvitationDto.prototype, "email", void 0);
|
|
7170
|
-
function
|
|
7219
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
7171
7220
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7172
7221
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7173
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;
|
|
7174
7223
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7175
7224
|
}
|
|
7176
|
-
__name(
|
|
7177
|
-
function
|
|
7225
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
7226
|
+
function _ts_metadata27(k, v) {
|
|
7178
7227
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7179
7228
|
}
|
|
7180
|
-
__name(
|
|
7181
|
-
function
|
|
7229
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
7230
|
+
function _ts_param18(paramIndex, decorator) {
|
|
7182
7231
|
return function(target, key) {
|
|
7183
7232
|
decorator(target, key, paramIndex);
|
|
7184
7233
|
};
|
|
7185
7234
|
}
|
|
7186
|
-
__name(
|
|
7235
|
+
__name(_ts_param18, "_ts_param");
|
|
7187
7236
|
function isStoredInvitation(value) {
|
|
7188
7237
|
if (typeof value !== "object" || value === null) return false;
|
|
7189
7238
|
const v = value;
|
|
@@ -7274,7 +7323,7 @@ exports.InvitationService = class _InvitationService {
|
|
|
7274
7323
|
await this.redis.set(tokenKey, JSON.stringify(stored), ttl);
|
|
7275
7324
|
const displayTenantName = tenantName ?? tenantId;
|
|
7276
7325
|
const expiresAt = new Date(Date.now() + ttl * 1e3);
|
|
7277
|
-
await this.emailProvider.sendInvitation(normalizedEmail, {
|
|
7326
|
+
await this.emailProvider.sendInvitation(tenantId, normalizedEmail, {
|
|
7278
7327
|
inviterName: inviter.name,
|
|
7279
7328
|
tenantName: displayTenantName,
|
|
7280
7329
|
inviteToken: rawToken,
|
|
@@ -7610,18 +7659,18 @@ exports.InvitationService = class _InvitationService {
|
|
|
7610
7659
|
return result;
|
|
7611
7660
|
}
|
|
7612
7661
|
};
|
|
7613
|
-
exports.InvitationService =
|
|
7662
|
+
exports.InvitationService = _ts_decorate28([
|
|
7614
7663
|
common.Injectable(),
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
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", [
|
|
7625
7674
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
7626
7675
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
7627
7676
|
typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
|
|
@@ -7634,23 +7683,23 @@ exports.InvitationService = _ts_decorate27([
|
|
|
7634
7683
|
], exports.InvitationService);
|
|
7635
7684
|
|
|
7636
7685
|
// src/server/controllers/invitation.controller.ts
|
|
7637
|
-
function
|
|
7686
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
7638
7687
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7639
7688
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7640
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;
|
|
7641
7690
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7642
7691
|
}
|
|
7643
|
-
__name(
|
|
7644
|
-
function
|
|
7692
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
7693
|
+
function _ts_metadata28(k, v) {
|
|
7645
7694
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7646
7695
|
}
|
|
7647
|
-
__name(
|
|
7648
|
-
function
|
|
7696
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
7697
|
+
function _ts_param19(paramIndex, decorator) {
|
|
7649
7698
|
return function(target, key) {
|
|
7650
7699
|
decorator(target, key, paramIndex);
|
|
7651
7700
|
};
|
|
7652
7701
|
}
|
|
7653
|
-
__name(
|
|
7702
|
+
__name(_ts_param19, "_ts_param");
|
|
7654
7703
|
var InvitationController = class {
|
|
7655
7704
|
static {
|
|
7656
7705
|
__name(this, "InvitationController");
|
|
@@ -7726,64 +7775,64 @@ var InvitationController = class {
|
|
|
7726
7775
|
return this.tokenDelivery.deliverAuthResponse(res, result, req);
|
|
7727
7776
|
}
|
|
7728
7777
|
};
|
|
7729
|
-
|
|
7778
|
+
_ts_decorate29([
|
|
7730
7779
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
7731
7780
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
|
|
7732
7781
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
|
|
7733
7782
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
7734
7783
|
common.Post(),
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7784
|
+
_ts_param19(0, common.Body()),
|
|
7785
|
+
_ts_param19(1, CurrentUser()),
|
|
7786
|
+
_ts_metadata28("design:type", Function),
|
|
7787
|
+
_ts_metadata28("design:paramtypes", [
|
|
7739
7788
|
typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
|
|
7740
7789
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
7741
7790
|
]),
|
|
7742
|
-
|
|
7791
|
+
_ts_metadata28("design:returntype", Promise)
|
|
7743
7792
|
], InvitationController.prototype, "invite", null);
|
|
7744
|
-
|
|
7793
|
+
_ts_decorate29([
|
|
7745
7794
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
7746
7795
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
|
|
7747
7796
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
|
|
7748
7797
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
7749
7798
|
common.Post("revoke"),
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7799
|
+
_ts_param19(0, common.Body()),
|
|
7800
|
+
_ts_param19(1, CurrentUser()),
|
|
7801
|
+
_ts_metadata28("design:type", Function),
|
|
7802
|
+
_ts_metadata28("design:paramtypes", [
|
|
7754
7803
|
typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
|
|
7755
7804
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
7756
7805
|
]),
|
|
7757
|
-
|
|
7806
|
+
_ts_metadata28("design:returntype", Promise)
|
|
7758
7807
|
], InvitationController.prototype, "revoke", null);
|
|
7759
|
-
|
|
7808
|
+
_ts_decorate29([
|
|
7760
7809
|
Public(),
|
|
7761
7810
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
|
|
7762
7811
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
|
|
7763
7812
|
common.HttpCode(common.HttpStatus.CREATED),
|
|
7764
7813
|
common.Post("accept"),
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7814
|
+
_ts_param19(0, common.Body()),
|
|
7815
|
+
_ts_param19(1, common.Req()),
|
|
7816
|
+
_ts_param19(2, common.Res({
|
|
7768
7817
|
passthrough: true
|
|
7769
7818
|
})),
|
|
7770
|
-
|
|
7771
|
-
|
|
7819
|
+
_ts_metadata28("design:type", Function),
|
|
7820
|
+
_ts_metadata28("design:paramtypes", [
|
|
7772
7821
|
typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
|
|
7773
7822
|
typeof Request === "undefined" ? Object : Request,
|
|
7774
7823
|
typeof Response === "undefined" ? Object : Response
|
|
7775
7824
|
]),
|
|
7776
|
-
|
|
7825
|
+
_ts_metadata28("design:returntype", Promise)
|
|
7777
7826
|
], InvitationController.prototype, "accept", null);
|
|
7778
|
-
InvitationController =
|
|
7827
|
+
InvitationController = _ts_decorate29([
|
|
7779
7828
|
common.UseInterceptors(NoStoreInterceptor),
|
|
7780
7829
|
common.Controller("invitations"),
|
|
7781
7830
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
7782
7831
|
common.UsePipes(createAuthValidationPipe()),
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
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", [
|
|
7787
7836
|
typeof exports.InvitationService === "undefined" ? Object : exports.InvitationService,
|
|
7788
7837
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
7789
7838
|
])
|
|
@@ -7794,17 +7843,17 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
|
|
|
7794
7843
|
var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
|
|
7795
7844
|
var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
|
|
7796
7845
|
var SkipMfa = /* @__PURE__ */ __name(() => common.SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
|
|
7797
|
-
function
|
|
7846
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
7798
7847
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7799
7848
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7800
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;
|
|
7801
7850
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7802
7851
|
}
|
|
7803
|
-
__name(
|
|
7804
|
-
function
|
|
7852
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
7853
|
+
function _ts_metadata29(k, v) {
|
|
7805
7854
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7806
7855
|
}
|
|
7807
|
-
__name(
|
|
7856
|
+
__name(_ts_metadata29, "_ts_metadata");
|
|
7808
7857
|
var MfaChallengeDto = class {
|
|
7809
7858
|
static {
|
|
7810
7859
|
__name(this, "MfaChallengeDto");
|
|
@@ -7840,33 +7889,33 @@ var MfaChallengeDto = class {
|
|
|
7840
7889
|
*/
|
|
7841
7890
|
code;
|
|
7842
7891
|
};
|
|
7843
|
-
|
|
7892
|
+
_ts_decorate30([
|
|
7844
7893
|
classValidator.IsOptional(),
|
|
7845
7894
|
classValidator.IsString(),
|
|
7846
7895
|
classValidator.IsNotEmpty(),
|
|
7847
7896
|
classValidator.MaxLength(512),
|
|
7848
|
-
|
|
7897
|
+
_ts_metadata29("design:type", String)
|
|
7849
7898
|
], MfaChallengeDto.prototype, "mfaTempToken", void 0);
|
|
7850
|
-
|
|
7899
|
+
_ts_decorate30([
|
|
7851
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})$/, {
|
|
7852
7901
|
message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
|
|
7853
7902
|
}),
|
|
7854
7903
|
classValidator.IsString(),
|
|
7855
7904
|
classValidator.IsNotEmpty(),
|
|
7856
7905
|
classValidator.MaxLength(29),
|
|
7857
|
-
|
|
7906
|
+
_ts_metadata29("design:type", String)
|
|
7858
7907
|
], MfaChallengeDto.prototype, "code", void 0);
|
|
7859
|
-
function
|
|
7908
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
7860
7909
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7861
7910
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7862
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;
|
|
7863
7912
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7864
7913
|
}
|
|
7865
|
-
__name(
|
|
7866
|
-
function
|
|
7914
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
7915
|
+
function _ts_metadata30(k, v) {
|
|
7867
7916
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7868
7917
|
}
|
|
7869
|
-
__name(
|
|
7918
|
+
__name(_ts_metadata30, "_ts_metadata");
|
|
7870
7919
|
var MfaDisableDto = class {
|
|
7871
7920
|
static {
|
|
7872
7921
|
__name(this, "MfaDisableDto");
|
|
@@ -7880,26 +7929,26 @@ var MfaDisableDto = class {
|
|
|
7880
7929
|
*/
|
|
7881
7930
|
code;
|
|
7882
7931
|
};
|
|
7883
|
-
|
|
7932
|
+
_ts_decorate31([
|
|
7884
7933
|
classValidator.MaxLength(6),
|
|
7885
7934
|
classValidator.Matches(/^\d{6}$/, {
|
|
7886
7935
|
message: "code must be exactly 6 digits"
|
|
7887
7936
|
}),
|
|
7888
7937
|
classValidator.IsString(),
|
|
7889
7938
|
classValidator.IsNotEmpty(),
|
|
7890
|
-
|
|
7939
|
+
_ts_metadata30("design:type", String)
|
|
7891
7940
|
], MfaDisableDto.prototype, "code", void 0);
|
|
7892
|
-
function
|
|
7941
|
+
function _ts_decorate32(decorators, target, key, desc) {
|
|
7893
7942
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7894
7943
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7895
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;
|
|
7896
7945
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7897
7946
|
}
|
|
7898
|
-
__name(
|
|
7899
|
-
function
|
|
7947
|
+
__name(_ts_decorate32, "_ts_decorate");
|
|
7948
|
+
function _ts_metadata31(k, v) {
|
|
7900
7949
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7901
7950
|
}
|
|
7902
|
-
__name(
|
|
7951
|
+
__name(_ts_metadata31, "_ts_metadata");
|
|
7903
7952
|
var MfaRegenerateRecoveryCodesDto = class {
|
|
7904
7953
|
static {
|
|
7905
7954
|
__name(this, "MfaRegenerateRecoveryCodesDto");
|
|
@@ -7913,26 +7962,26 @@ var MfaRegenerateRecoveryCodesDto = class {
|
|
|
7913
7962
|
*/
|
|
7914
7963
|
code;
|
|
7915
7964
|
};
|
|
7916
|
-
|
|
7965
|
+
_ts_decorate32([
|
|
7917
7966
|
classValidator.MaxLength(6),
|
|
7918
7967
|
classValidator.Matches(/^\d{6}$/, {
|
|
7919
7968
|
message: "code must be exactly 6 digits"
|
|
7920
7969
|
}),
|
|
7921
7970
|
classValidator.IsString(),
|
|
7922
7971
|
classValidator.IsNotEmpty(),
|
|
7923
|
-
|
|
7972
|
+
_ts_metadata31("design:type", String)
|
|
7924
7973
|
], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
|
|
7925
|
-
function
|
|
7974
|
+
function _ts_decorate33(decorators, target, key, desc) {
|
|
7926
7975
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7927
7976
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7928
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;
|
|
7929
7978
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7930
7979
|
}
|
|
7931
|
-
__name(
|
|
7932
|
-
function
|
|
7980
|
+
__name(_ts_decorate33, "_ts_decorate");
|
|
7981
|
+
function _ts_metadata32(k, v) {
|
|
7933
7982
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7934
7983
|
}
|
|
7935
|
-
__name(
|
|
7984
|
+
__name(_ts_metadata32, "_ts_metadata");
|
|
7936
7985
|
var MfaSetupDto = class {
|
|
7937
7986
|
static {
|
|
7938
7987
|
__name(this, "MfaSetupDto");
|
|
@@ -7956,24 +8005,24 @@ var MfaSetupDto = class {
|
|
|
7956
8005
|
*/
|
|
7957
8006
|
password;
|
|
7958
8007
|
};
|
|
7959
|
-
|
|
8008
|
+
_ts_decorate33([
|
|
7960
8009
|
classValidator.IsOptional(),
|
|
7961
8010
|
classValidator.IsString(),
|
|
7962
8011
|
classValidator.MinLength(1),
|
|
7963
8012
|
classValidator.MaxLength(128),
|
|
7964
|
-
|
|
8013
|
+
_ts_metadata32("design:type", String)
|
|
7965
8014
|
], MfaSetupDto.prototype, "password", void 0);
|
|
7966
|
-
function
|
|
8015
|
+
function _ts_decorate34(decorators, target, key, desc) {
|
|
7967
8016
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7968
8017
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7969
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;
|
|
7970
8019
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7971
8020
|
}
|
|
7972
|
-
__name(
|
|
7973
|
-
function
|
|
8021
|
+
__name(_ts_decorate34, "_ts_decorate");
|
|
8022
|
+
function _ts_metadata33(k, v) {
|
|
7974
8023
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
7975
8024
|
}
|
|
7976
|
-
__name(
|
|
8025
|
+
__name(_ts_metadata33, "_ts_metadata");
|
|
7977
8026
|
var MfaVerifyDto = class {
|
|
7978
8027
|
static {
|
|
7979
8028
|
__name(this, "MfaVerifyDto");
|
|
@@ -7986,14 +8035,14 @@ var MfaVerifyDto = class {
|
|
|
7986
8035
|
*/
|
|
7987
8036
|
code;
|
|
7988
8037
|
};
|
|
7989
|
-
|
|
8038
|
+
_ts_decorate34([
|
|
7990
8039
|
classValidator.MaxLength(6),
|
|
7991
8040
|
classValidator.Matches(/^\d{6}$/, {
|
|
7992
8041
|
message: "code must be exactly 6 digits"
|
|
7993
8042
|
}),
|
|
7994
8043
|
classValidator.IsString(),
|
|
7995
8044
|
classValidator.IsNotEmpty(),
|
|
7996
|
-
|
|
8045
|
+
_ts_metadata33("design:type", String)
|
|
7997
8046
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
7998
8047
|
var IV_LENGTH = 12;
|
|
7999
8048
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
@@ -8045,23 +8094,28 @@ function decrypt(ciphertext, keyBase64) {
|
|
|
8045
8094
|
__name(decrypt, "decrypt");
|
|
8046
8095
|
|
|
8047
8096
|
// src/server/services/mfa.service.ts
|
|
8048
|
-
function
|
|
8097
|
+
function _ts_decorate35(decorators, target, key, desc) {
|
|
8049
8098
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8050
8099
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8051
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;
|
|
8052
8101
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8053
8102
|
}
|
|
8054
|
-
__name(
|
|
8055
|
-
function
|
|
8103
|
+
__name(_ts_decorate35, "_ts_decorate");
|
|
8104
|
+
function _ts_metadata34(k, v) {
|
|
8056
8105
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8057
8106
|
}
|
|
8058
|
-
__name(
|
|
8059
|
-
function
|
|
8107
|
+
__name(_ts_metadata34, "_ts_metadata");
|
|
8108
|
+
function _ts_param20(paramIndex, decorator) {
|
|
8060
8109
|
return function(target, key) {
|
|
8061
8110
|
decorator(target, key, paramIndex);
|
|
8062
8111
|
};
|
|
8063
8112
|
}
|
|
8064
|
-
__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");
|
|
8065
8119
|
var MFA_SETUP_TTL_SECONDS = 600;
|
|
8066
8120
|
var RECOVERY_CODE_CLAIM_TTL_SECONDS = 300;
|
|
8067
8121
|
function totpAntiReplayTtlSeconds(window) {
|
|
@@ -8573,7 +8627,7 @@ exports.MfaService = class _MfaService {
|
|
|
8573
8627
|
await this.redis.invalidateUserSessions(userId, context);
|
|
8574
8628
|
await this.redis.bumpUserTokenEpoch(userId, context);
|
|
8575
8629
|
this.logger.log(`verifyAndEnable: MFA enabled userId=${userId} context=${context}`);
|
|
8576
|
-
await this.emailProvider.sendMfaEnabledNotification(user.email);
|
|
8630
|
+
await this.emailProvider.sendMfaEnabledNotification(emailTenantOf(user), user.email);
|
|
8577
8631
|
if (this.hooks.afterMfaEnabled) {
|
|
8578
8632
|
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
8579
8633
|
void Promise.resolve(this.hooks.afterMfaEnabled(safeUser, {
|
|
@@ -8750,7 +8804,7 @@ exports.MfaService = class _MfaService {
|
|
|
8750
8804
|
await this.redis.invalidateUserSessions(userId, context);
|
|
8751
8805
|
await this.redis.bumpUserTokenEpoch(userId, context);
|
|
8752
8806
|
this.logger.log(`disable: MFA disabled userId=${userId} context=${context}`);
|
|
8753
|
-
await this.emailProvider.sendMfaDisabledNotification(user.email);
|
|
8807
|
+
await this.emailProvider.sendMfaDisabledNotification(emailTenantOf(user), user.email);
|
|
8754
8808
|
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
8755
8809
|
if (this.hooks.afterMfaDisabled) {
|
|
8756
8810
|
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
@@ -8816,7 +8870,7 @@ exports.MfaService = class _MfaService {
|
|
|
8816
8870
|
await this.redis.invalidateUserSessions(userId, context);
|
|
8817
8871
|
await this.redis.bumpUserTokenEpoch(userId, context);
|
|
8818
8872
|
this.logger.warn(`resetMfa: MFA removed administratively userId=${userId} context=${context}`);
|
|
8819
|
-
await this.emailProvider.sendMfaDisabledNotification(user.email);
|
|
8873
|
+
await this.emailProvider.sendMfaDisabledNotification(emailTenantOf(user), user.email);
|
|
8820
8874
|
const safeUser = context === "platform" ? this.platformUserAsSafeUser(user) : this.toSafeUser(user);
|
|
8821
8875
|
if (this.hooks.afterMfaDisabled) {
|
|
8822
8876
|
void Promise.resolve(this.hooks.afterMfaDisabled(safeUser, {
|
|
@@ -9025,21 +9079,21 @@ exports.MfaService = class _MfaService {
|
|
|
9025
9079
|
return admin;
|
|
9026
9080
|
}
|
|
9027
9081
|
};
|
|
9028
|
-
exports.MfaService =
|
|
9082
|
+
exports.MfaService = _ts_decorate35([
|
|
9029
9083
|
common.Injectable(),
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
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", [
|
|
9043
9097
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
9044
9098
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
9045
9099
|
Object,
|
|
@@ -9054,23 +9108,23 @@ exports.MfaService = _ts_decorate34([
|
|
|
9054
9108
|
], exports.MfaService);
|
|
9055
9109
|
|
|
9056
9110
|
// src/server/controllers/mfa.controller.ts
|
|
9057
|
-
function
|
|
9111
|
+
function _ts_decorate36(decorators, target, key, desc) {
|
|
9058
9112
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9059
9113
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9060
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;
|
|
9061
9115
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9062
9116
|
}
|
|
9063
|
-
__name(
|
|
9064
|
-
function
|
|
9117
|
+
__name(_ts_decorate36, "_ts_decorate");
|
|
9118
|
+
function _ts_metadata35(k, v) {
|
|
9065
9119
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9066
9120
|
}
|
|
9067
|
-
__name(
|
|
9068
|
-
function
|
|
9121
|
+
__name(_ts_metadata35, "_ts_metadata");
|
|
9122
|
+
function _ts_param21(paramIndex, decorator) {
|
|
9069
9123
|
return function(target, key) {
|
|
9070
9124
|
decorator(target, key, paramIndex);
|
|
9071
9125
|
};
|
|
9072
9126
|
}
|
|
9073
|
-
__name(
|
|
9127
|
+
__name(_ts_param21, "_ts_param");
|
|
9074
9128
|
function isPlatformResult(result) {
|
|
9075
9129
|
return "admin" in result;
|
|
9076
9130
|
}
|
|
@@ -9259,120 +9313,120 @@ var MfaController = class {
|
|
|
9259
9313
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard");
|
|
9260
9314
|
}
|
|
9261
9315
|
};
|
|
9262
|
-
|
|
9316
|
+
_ts_decorate36([
|
|
9263
9317
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9264
9318
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
9265
9319
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
9266
9320
|
common.Post("setup"),
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9321
|
+
_ts_param21(0, CurrentUser()),
|
|
9322
|
+
_ts_param21(1, common.Body()),
|
|
9323
|
+
_ts_metadata35("design:type", Function),
|
|
9324
|
+
_ts_metadata35("design:paramtypes", [
|
|
9271
9325
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9272
9326
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
9273
9327
|
]),
|
|
9274
|
-
|
|
9328
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9275
9329
|
], MfaController.prototype, "setup", null);
|
|
9276
|
-
|
|
9330
|
+
_ts_decorate36([
|
|
9277
9331
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9278
9332
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
9279
9333
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
9280
9334
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
9281
9335
|
common.Post("verify-enable"),
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
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", [
|
|
9287
9341
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9288
9342
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
9289
9343
|
typeof Request === "undefined" ? Object : Request
|
|
9290
9344
|
]),
|
|
9291
|
-
|
|
9345
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9292
9346
|
], MfaController.prototype, "verifyEnable", null);
|
|
9293
|
-
|
|
9347
|
+
_ts_decorate36([
|
|
9294
9348
|
Public(),
|
|
9295
9349
|
SkipMfa(),
|
|
9296
9350
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
9297
9351
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
9298
9352
|
common.HttpCode(common.HttpStatus.OK),
|
|
9299
9353
|
common.Post("challenge"),
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9354
|
+
_ts_param21(0, common.Body()),
|
|
9355
|
+
_ts_param21(1, common.Req()),
|
|
9356
|
+
_ts_param21(2, common.Res({
|
|
9303
9357
|
passthrough: true
|
|
9304
9358
|
})),
|
|
9305
|
-
|
|
9306
|
-
|
|
9359
|
+
_ts_metadata35("design:type", Function),
|
|
9360
|
+
_ts_metadata35("design:paramtypes", [
|
|
9307
9361
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
9308
9362
|
typeof Request === "undefined" ? Object : Request,
|
|
9309
9363
|
typeof Response === "undefined" ? Object : Response
|
|
9310
9364
|
]),
|
|
9311
|
-
|
|
9365
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9312
9366
|
], MfaController.prototype, "challenge", null);
|
|
9313
|
-
|
|
9367
|
+
_ts_decorate36([
|
|
9314
9368
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9315
9369
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9316
9370
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9317
9371
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
9318
9372
|
common.Post("disable"),
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
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", [
|
|
9324
9378
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9325
9379
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
9326
9380
|
typeof Request === "undefined" ? Object : Request
|
|
9327
9381
|
]),
|
|
9328
|
-
|
|
9382
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9329
9383
|
], MfaController.prototype, "disable", null);
|
|
9330
|
-
|
|
9384
|
+
_ts_decorate36([
|
|
9331
9385
|
common.UseGuards(exports.JwtAuthGuard),
|
|
9332
9386
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9333
9387
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
9334
9388
|
common.HttpCode(common.HttpStatus.OK),
|
|
9335
9389
|
common.Post("recovery-codes"),
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
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", [
|
|
9341
9395
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
9342
9396
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
9343
9397
|
typeof Request === "undefined" ? Object : Request
|
|
9344
9398
|
]),
|
|
9345
|
-
|
|
9399
|
+
_ts_metadata35("design:returntype", Promise)
|
|
9346
9400
|
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
9347
|
-
MfaController =
|
|
9401
|
+
MfaController = _ts_decorate36([
|
|
9348
9402
|
common.UseInterceptors(NoStoreInterceptor),
|
|
9349
9403
|
common.Controller("mfa"),
|
|
9350
9404
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
9351
9405
|
common.UsePipes(createAuthValidationPipe({
|
|
9352
9406
|
forbidUnknownValues: true
|
|
9353
9407
|
})),
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
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", [
|
|
9359
9413
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
9360
9414
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
9361
9415
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
9362
9416
|
])
|
|
9363
9417
|
], MfaController);
|
|
9364
9418
|
var Authenticated = /* @__PURE__ */ __name(() => common.SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
|
|
9365
|
-
function
|
|
9419
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
9366
9420
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9367
9421
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9368
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;
|
|
9369
9423
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9370
9424
|
}
|
|
9371
|
-
__name(
|
|
9372
|
-
function
|
|
9425
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
9426
|
+
function _ts_metadata36(k, v) {
|
|
9373
9427
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9374
9428
|
}
|
|
9375
|
-
__name(
|
|
9429
|
+
__name(_ts_metadata36, "_ts_metadata");
|
|
9376
9430
|
var ChangePasswordDto = class {
|
|
9377
9431
|
static {
|
|
9378
9432
|
__name(this, "ChangePasswordDto");
|
|
@@ -9405,29 +9459,29 @@ var ChangePasswordDto = class {
|
|
|
9405
9459
|
*/
|
|
9406
9460
|
newPassword;
|
|
9407
9461
|
};
|
|
9408
|
-
|
|
9462
|
+
_ts_decorate37([
|
|
9409
9463
|
classValidator.IsString(),
|
|
9410
9464
|
classValidator.MinLength(1),
|
|
9411
9465
|
classValidator.MaxLength(128),
|
|
9412
|
-
|
|
9466
|
+
_ts_metadata36("design:type", String)
|
|
9413
9467
|
], ChangePasswordDto.prototype, "currentPassword", void 0);
|
|
9414
|
-
|
|
9468
|
+
_ts_decorate37([
|
|
9415
9469
|
classValidator.IsString(),
|
|
9416
9470
|
classValidator.MinLength(8),
|
|
9417
9471
|
classValidator.MaxLength(128),
|
|
9418
|
-
|
|
9472
|
+
_ts_metadata36("design:type", String)
|
|
9419
9473
|
], ChangePasswordDto.prototype, "newPassword", void 0);
|
|
9420
|
-
function
|
|
9474
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
9421
9475
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9422
9476
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9423
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;
|
|
9424
9478
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9425
9479
|
}
|
|
9426
|
-
__name(
|
|
9427
|
-
function
|
|
9480
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
9481
|
+
function _ts_metadata37(k, v) {
|
|
9428
9482
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9429
9483
|
}
|
|
9430
|
-
__name(
|
|
9484
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
9431
9485
|
var ForgotPasswordDto = class {
|
|
9432
9486
|
static {
|
|
9433
9487
|
__name(this, "ForgotPasswordDto");
|
|
@@ -9443,13 +9497,13 @@ var ForgotPasswordDto = class {
|
|
|
9443
9497
|
*/
|
|
9444
9498
|
tenantId;
|
|
9445
9499
|
};
|
|
9446
|
-
|
|
9500
|
+
_ts_decorate38([
|
|
9447
9501
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9448
9502
|
classValidator.IsEmail(),
|
|
9449
9503
|
classValidator.MaxLength(255),
|
|
9450
|
-
|
|
9504
|
+
_ts_metadata37("design:type", String)
|
|
9451
9505
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
9452
|
-
|
|
9506
|
+
_ts_decorate38([
|
|
9453
9507
|
classValidator.IsOptional(),
|
|
9454
9508
|
classValidator.IsString(),
|
|
9455
9509
|
classValidator.IsNotEmpty(),
|
|
@@ -9457,19 +9511,19 @@ _ts_decorate37([
|
|
|
9457
9511
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9458
9512
|
message: "tenantId must not contain control characters"
|
|
9459
9513
|
}),
|
|
9460
|
-
|
|
9514
|
+
_ts_metadata37("design:type", String)
|
|
9461
9515
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
9462
|
-
function
|
|
9516
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
9463
9517
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9464
9518
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9465
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;
|
|
9466
9520
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9467
9521
|
}
|
|
9468
|
-
__name(
|
|
9469
|
-
function
|
|
9522
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
9523
|
+
function _ts_metadata38(k, v) {
|
|
9470
9524
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9471
9525
|
}
|
|
9472
|
-
__name(
|
|
9526
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
9473
9527
|
var ResendOtpDto = class {
|
|
9474
9528
|
static {
|
|
9475
9529
|
__name(this, "ResendOtpDto");
|
|
@@ -9484,13 +9538,13 @@ var ResendOtpDto = class {
|
|
|
9484
9538
|
*/
|
|
9485
9539
|
tenantId;
|
|
9486
9540
|
};
|
|
9487
|
-
|
|
9541
|
+
_ts_decorate39([
|
|
9488
9542
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9489
9543
|
classValidator.IsEmail(),
|
|
9490
9544
|
classValidator.MaxLength(255),
|
|
9491
|
-
|
|
9545
|
+
_ts_metadata38("design:type", String)
|
|
9492
9546
|
], ResendOtpDto.prototype, "email", void 0);
|
|
9493
|
-
|
|
9547
|
+
_ts_decorate39([
|
|
9494
9548
|
classValidator.IsOptional(),
|
|
9495
9549
|
classValidator.IsString(),
|
|
9496
9550
|
classValidator.IsNotEmpty(),
|
|
@@ -9498,19 +9552,19 @@ _ts_decorate38([
|
|
|
9498
9552
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9499
9553
|
message: "tenantId must not contain control characters"
|
|
9500
9554
|
}),
|
|
9501
|
-
|
|
9555
|
+
_ts_metadata38("design:type", String)
|
|
9502
9556
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
9503
|
-
function
|
|
9557
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
9504
9558
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9505
9559
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9506
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;
|
|
9507
9561
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9508
9562
|
}
|
|
9509
|
-
__name(
|
|
9510
|
-
function
|
|
9563
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
9564
|
+
function _ts_metadata39(k, v) {
|
|
9511
9565
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9512
9566
|
}
|
|
9513
|
-
__name(
|
|
9567
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
9514
9568
|
var ResetPasswordDto = class {
|
|
9515
9569
|
static {
|
|
9516
9570
|
__name(this, "ResetPasswordDto");
|
|
@@ -9557,38 +9611,38 @@ var ResetPasswordDto = class {
|
|
|
9557
9611
|
*/
|
|
9558
9612
|
tenantId;
|
|
9559
9613
|
};
|
|
9560
|
-
|
|
9614
|
+
_ts_decorate40([
|
|
9561
9615
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9562
9616
|
classValidator.IsEmail(),
|
|
9563
9617
|
classValidator.MaxLength(255),
|
|
9564
|
-
|
|
9618
|
+
_ts_metadata39("design:type", String)
|
|
9565
9619
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
9566
|
-
|
|
9620
|
+
_ts_decorate40([
|
|
9567
9621
|
classValidator.IsString(),
|
|
9568
9622
|
classValidator.MinLength(8),
|
|
9569
9623
|
classValidator.MaxLength(128),
|
|
9570
|
-
|
|
9624
|
+
_ts_metadata39("design:type", String)
|
|
9571
9625
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
9572
|
-
|
|
9626
|
+
_ts_decorate40([
|
|
9573
9627
|
classValidator.IsOptional(),
|
|
9574
9628
|
classValidator.IsString(),
|
|
9575
9629
|
classValidator.IsNotEmpty(),
|
|
9576
9630
|
classValidator.MaxLength(2048),
|
|
9577
|
-
|
|
9631
|
+
_ts_metadata39("design:type", String)
|
|
9578
9632
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
9579
|
-
|
|
9633
|
+
_ts_decorate40([
|
|
9580
9634
|
classValidator.IsOptional(),
|
|
9581
9635
|
classValidator.IsString(),
|
|
9582
9636
|
classValidator.Length(4, 8),
|
|
9583
|
-
|
|
9637
|
+
_ts_metadata39("design:type", String)
|
|
9584
9638
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
9585
|
-
|
|
9639
|
+
_ts_decorate40([
|
|
9586
9640
|
classValidator.IsOptional(),
|
|
9587
9641
|
classValidator.IsString(),
|
|
9588
9642
|
classValidator.Length(64, 64),
|
|
9589
|
-
|
|
9643
|
+
_ts_metadata39("design:type", String)
|
|
9590
9644
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
9591
|
-
|
|
9645
|
+
_ts_decorate40([
|
|
9592
9646
|
classValidator.IsOptional(),
|
|
9593
9647
|
classValidator.IsString(),
|
|
9594
9648
|
classValidator.IsNotEmpty(),
|
|
@@ -9596,19 +9650,19 @@ _ts_decorate39([
|
|
|
9596
9650
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9597
9651
|
message: "tenantId must not contain control characters"
|
|
9598
9652
|
}),
|
|
9599
|
-
|
|
9653
|
+
_ts_metadata39("design:type", String)
|
|
9600
9654
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
9601
|
-
function
|
|
9655
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
9602
9656
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9603
9657
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9604
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;
|
|
9605
9659
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9606
9660
|
}
|
|
9607
|
-
__name(
|
|
9608
|
-
function
|
|
9661
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
9662
|
+
function _ts_metadata40(k, v) {
|
|
9609
9663
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9610
9664
|
}
|
|
9611
|
-
__name(
|
|
9665
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
9612
9666
|
var VerifyOtpDto = class {
|
|
9613
9667
|
static {
|
|
9614
9668
|
__name(this, "VerifyOtpDto");
|
|
@@ -9630,18 +9684,18 @@ var VerifyOtpDto = class {
|
|
|
9630
9684
|
*/
|
|
9631
9685
|
tenantId;
|
|
9632
9686
|
};
|
|
9633
|
-
|
|
9687
|
+
_ts_decorate41([
|
|
9634
9688
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
9635
9689
|
classValidator.IsEmail(),
|
|
9636
9690
|
classValidator.MaxLength(255),
|
|
9637
|
-
|
|
9691
|
+
_ts_metadata40("design:type", String)
|
|
9638
9692
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
9639
|
-
|
|
9693
|
+
_ts_decorate41([
|
|
9640
9694
|
classValidator.IsString(),
|
|
9641
9695
|
classValidator.Length(4, 8),
|
|
9642
|
-
|
|
9696
|
+
_ts_metadata40("design:type", String)
|
|
9643
9697
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
9644
|
-
|
|
9698
|
+
_ts_decorate41([
|
|
9645
9699
|
classValidator.IsOptional(),
|
|
9646
9700
|
classValidator.IsString(),
|
|
9647
9701
|
classValidator.IsNotEmpty(),
|
|
@@ -9649,25 +9703,25 @@ _ts_decorate40([
|
|
|
9649
9703
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
9650
9704
|
message: "tenantId must not contain control characters"
|
|
9651
9705
|
}),
|
|
9652
|
-
|
|
9706
|
+
_ts_metadata40("design:type", String)
|
|
9653
9707
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
9654
|
-
function
|
|
9708
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
9655
9709
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9656
9710
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9657
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;
|
|
9658
9712
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9659
9713
|
}
|
|
9660
|
-
__name(
|
|
9661
|
-
function
|
|
9714
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
9715
|
+
function _ts_metadata41(k, v) {
|
|
9662
9716
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9663
9717
|
}
|
|
9664
|
-
__name(
|
|
9665
|
-
function
|
|
9718
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
9719
|
+
function _ts_param22(paramIndex, decorator) {
|
|
9666
9720
|
return function(target, key) {
|
|
9667
9721
|
decorator(target, key, paramIndex);
|
|
9668
9722
|
};
|
|
9669
9723
|
}
|
|
9670
|
-
__name(
|
|
9724
|
+
__name(_ts_param22, "_ts_param");
|
|
9671
9725
|
var ANTI_ENUM_MIN_MS2 = 300;
|
|
9672
9726
|
var VERIFIED_TOKEN_TTL_SECONDS = 300;
|
|
9673
9727
|
var PASSWORD_RESET_PURPOSE = "password_reset";
|
|
@@ -10029,7 +10083,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10029
10083
|
async notifyPasswordChanged(user) {
|
|
10030
10084
|
const send = this.emailProvider?.sendPasswordChangedNotification;
|
|
10031
10085
|
if (send === void 0) return;
|
|
10032
|
-
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) => {
|
|
10033
10087
|
this.logger.error("notifyPasswordChanged: delivery failed", err);
|
|
10034
10088
|
});
|
|
10035
10089
|
}
|
|
@@ -10100,7 +10154,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10100
10154
|
passwordFingerprint: await this.passwordFingerprintOf(userId)
|
|
10101
10155
|
};
|
|
10102
10156
|
await this.redis.set(tokenKey, JSON.stringify(context), this.options.passwordReset.tokenTtlSeconds);
|
|
10103
|
-
void Promise.resolve(this.emailProvider.sendPasswordResetToken(email, rawToken)).catch((err) => {
|
|
10157
|
+
void Promise.resolve(this.emailProvider.sendPasswordResetToken(tenantId, email, rawToken)).catch((err) => {
|
|
10104
10158
|
this.logger.error(`sendPasswordResetToken failed for user ${userId}`, err);
|
|
10105
10159
|
void this.redis.del(tokenKey).catch((delErr) => {
|
|
10106
10160
|
this.logger.error(`pw_reset rollback delete failed for user ${userId}`, delErr);
|
|
@@ -10120,7 +10174,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10120
10174
|
const identifier = this.otpIdentifier(tenantId, email);
|
|
10121
10175
|
const otp = this.otpService.generate(otpLength);
|
|
10122
10176
|
await this.otpService.store(PASSWORD_RESET_PURPOSE, identifier, otp, otpTtlSeconds);
|
|
10123
|
-
void Promise.resolve(this.emailProvider.sendPasswordResetOtp(email, otp)).catch((err) => {
|
|
10177
|
+
void Promise.resolve(this.emailProvider.sendPasswordResetOtp(tenantId, email, otp)).catch((err) => {
|
|
10124
10178
|
this.logger.error(`sendPasswordResetOtp failed for user ${userId}`, err);
|
|
10125
10179
|
});
|
|
10126
10180
|
}
|
|
@@ -10180,21 +10234,21 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
10180
10234
|
};
|
|
10181
10235
|
}
|
|
10182
10236
|
};
|
|
10183
|
-
exports.PasswordResetService =
|
|
10237
|
+
exports.PasswordResetService = _ts_decorate42([
|
|
10184
10238
|
common.Injectable(),
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
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", [
|
|
10198
10252
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
10199
10253
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
10200
10254
|
Object,
|
|
@@ -10213,23 +10267,23 @@ function toSafeUser3(user) {
|
|
|
10213
10267
|
__name(toSafeUser3, "toSafeUser");
|
|
10214
10268
|
|
|
10215
10269
|
// src/server/controllers/password-reset.controller.ts
|
|
10216
|
-
function
|
|
10270
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
10217
10271
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10218
10272
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10219
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;
|
|
10220
10274
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10221
10275
|
}
|
|
10222
|
-
__name(
|
|
10223
|
-
function
|
|
10276
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
10277
|
+
function _ts_metadata42(k, v) {
|
|
10224
10278
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10225
10279
|
}
|
|
10226
|
-
__name(
|
|
10227
|
-
function
|
|
10280
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
10281
|
+
function _ts_param23(paramIndex, decorator) {
|
|
10228
10282
|
return function(target, key) {
|
|
10229
10283
|
decorator(target, key, paramIndex);
|
|
10230
10284
|
};
|
|
10231
10285
|
}
|
|
10232
|
-
__name(
|
|
10286
|
+
__name(_ts_param23, "_ts_param");
|
|
10233
10287
|
var PasswordResetController = class {
|
|
10234
10288
|
static {
|
|
10235
10289
|
__name(this, "PasswordResetController");
|
|
@@ -10340,105 +10394,105 @@ var PasswordResetController = class {
|
|
|
10340
10394
|
await this.passwordResetService.resendOtp(dto, req);
|
|
10341
10395
|
}
|
|
10342
10396
|
};
|
|
10343
|
-
|
|
10397
|
+
_ts_decorate43([
|
|
10344
10398
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
10345
10399
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
10346
10400
|
common.HttpCode(common.HttpStatus.OK),
|
|
10347
10401
|
common.Post("forgot-password"),
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10402
|
+
_ts_param23(0, common.Body()),
|
|
10403
|
+
_ts_param23(1, common.Req()),
|
|
10404
|
+
_ts_metadata42("design:type", Function),
|
|
10405
|
+
_ts_metadata42("design:paramtypes", [
|
|
10352
10406
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
|
|
10353
10407
|
typeof Request === "undefined" ? Object : Request
|
|
10354
10408
|
]),
|
|
10355
|
-
|
|
10409
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10356
10410
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
10357
|
-
|
|
10411
|
+
_ts_decorate43([
|
|
10358
10412
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
10359
10413
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
10360
10414
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
10361
10415
|
common.Post("reset-password"),
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10416
|
+
_ts_param23(0, common.Body()),
|
|
10417
|
+
_ts_param23(1, common.Req()),
|
|
10418
|
+
_ts_metadata42("design:type", Function),
|
|
10419
|
+
_ts_metadata42("design:paramtypes", [
|
|
10366
10420
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
|
|
10367
10421
|
typeof Request === "undefined" ? Object : Request
|
|
10368
10422
|
]),
|
|
10369
|
-
|
|
10423
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10370
10424
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
10371
|
-
|
|
10425
|
+
_ts_decorate43([
|
|
10372
10426
|
Authenticated(),
|
|
10373
10427
|
common.UseGuards(exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
10374
10428
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
10375
10429
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
10376
10430
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
10377
10431
|
common.Post("change"),
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
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", [
|
|
10383
10437
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
10384
10438
|
typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
|
|
10385
10439
|
typeof Request === "undefined" ? Object : Request
|
|
10386
10440
|
]),
|
|
10387
|
-
|
|
10441
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10388
10442
|
], PasswordResetController.prototype, "changePassword", null);
|
|
10389
|
-
|
|
10443
|
+
_ts_decorate43([
|
|
10390
10444
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
10391
10445
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
10392
10446
|
common.HttpCode(common.HttpStatus.OK),
|
|
10393
10447
|
common.Post("verify-otp"),
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10448
|
+
_ts_param23(0, common.Body()),
|
|
10449
|
+
_ts_param23(1, common.Req()),
|
|
10450
|
+
_ts_metadata42("design:type", Function),
|
|
10451
|
+
_ts_metadata42("design:paramtypes", [
|
|
10398
10452
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
|
|
10399
10453
|
typeof Request === "undefined" ? Object : Request
|
|
10400
10454
|
]),
|
|
10401
|
-
|
|
10455
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10402
10456
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
10403
|
-
|
|
10457
|
+
_ts_decorate43([
|
|
10404
10458
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
10405
10459
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
10406
10460
|
common.HttpCode(common.HttpStatus.OK),
|
|
10407
10461
|
common.Post("resend-otp"),
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10462
|
+
_ts_param23(0, common.Body()),
|
|
10463
|
+
_ts_param23(1, common.Req()),
|
|
10464
|
+
_ts_metadata42("design:type", Function),
|
|
10465
|
+
_ts_metadata42("design:paramtypes", [
|
|
10412
10466
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
|
|
10413
10467
|
typeof Request === "undefined" ? Object : Request
|
|
10414
10468
|
]),
|
|
10415
|
-
|
|
10469
|
+
_ts_metadata42("design:returntype", Promise)
|
|
10416
10470
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
10417
|
-
PasswordResetController =
|
|
10471
|
+
PasswordResetController = _ts_decorate43([
|
|
10418
10472
|
Public(),
|
|
10419
10473
|
common.UseInterceptors(NoStoreInterceptor),
|
|
10420
10474
|
common.Controller("password"),
|
|
10421
10475
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
10422
10476
|
common.UsePipes(createAuthValidationPipe()),
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
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", [
|
|
10427
10481
|
typeof exports.PasswordResetService === "undefined" ? Object : exports.PasswordResetService,
|
|
10428
10482
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
10429
10483
|
])
|
|
10430
10484
|
], PasswordResetController);
|
|
10431
|
-
function
|
|
10485
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
10432
10486
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10433
10487
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10434
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;
|
|
10435
10489
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10436
10490
|
}
|
|
10437
|
-
__name(
|
|
10438
|
-
function
|
|
10491
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
10492
|
+
function _ts_metadata43(k, v) {
|
|
10439
10493
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10440
10494
|
}
|
|
10441
|
-
__name(
|
|
10495
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
10442
10496
|
var PlatformLoginDto = class {
|
|
10443
10497
|
static {
|
|
10444
10498
|
__name(this, "PlatformLoginDto");
|
|
@@ -10466,14 +10520,14 @@ var PlatformLoginDto = class {
|
|
|
10466
10520
|
*/
|
|
10467
10521
|
password;
|
|
10468
10522
|
};
|
|
10469
|
-
|
|
10523
|
+
_ts_decorate44([
|
|
10470
10524
|
classTransformer.Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
10471
10525
|
classValidator.IsEmail(),
|
|
10472
10526
|
classValidator.IsNotEmpty(),
|
|
10473
10527
|
classValidator.MaxLength(255),
|
|
10474
|
-
|
|
10528
|
+
_ts_metadata43("design:type", String)
|
|
10475
10529
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
10476
|
-
|
|
10530
|
+
_ts_decorate44([
|
|
10477
10531
|
classValidator.IsString(),
|
|
10478
10532
|
classValidator.IsNotEmpty(),
|
|
10479
10533
|
classValidator.Matches(/\S/, {
|
|
@@ -10481,38 +10535,38 @@ _ts_decorate43([
|
|
|
10481
10535
|
}),
|
|
10482
10536
|
classValidator.MinLength(1),
|
|
10483
10537
|
classValidator.MaxLength(128),
|
|
10484
|
-
|
|
10538
|
+
_ts_metadata43("design:type", String)
|
|
10485
10539
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
10486
|
-
function
|
|
10540
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
10487
10541
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10488
10542
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10489
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;
|
|
10490
10544
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10491
10545
|
}
|
|
10492
|
-
__name(
|
|
10493
|
-
function
|
|
10546
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
10547
|
+
function _ts_metadata44(k, v) {
|
|
10494
10548
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10495
10549
|
}
|
|
10496
|
-
__name(
|
|
10497
|
-
function
|
|
10550
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
10551
|
+
function _ts_param24(paramIndex, decorator) {
|
|
10498
10552
|
return function(target, key) {
|
|
10499
10553
|
decorator(target, key, paramIndex);
|
|
10500
10554
|
};
|
|
10501
10555
|
}
|
|
10502
|
-
__name(
|
|
10556
|
+
__name(_ts_param24, "_ts_param");
|
|
10503
10557
|
exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
10504
10558
|
static {
|
|
10505
10559
|
__name(this, "JwtPlatformGuard");
|
|
10506
10560
|
}
|
|
10507
10561
|
jwtService;
|
|
10508
10562
|
tokenDelivery;
|
|
10509
|
-
|
|
10563
|
+
revocation;
|
|
10510
10564
|
reflector;
|
|
10511
10565
|
options;
|
|
10512
|
-
constructor(jwtService, tokenDelivery,
|
|
10566
|
+
constructor(jwtService, tokenDelivery, revocation, reflector, options) {
|
|
10513
10567
|
this.jwtService = jwtService;
|
|
10514
10568
|
this.tokenDelivery = tokenDelivery;
|
|
10515
|
-
this.
|
|
10569
|
+
this.revocation = revocation;
|
|
10516
10570
|
this.reflector = reflector;
|
|
10517
10571
|
this.options = options;
|
|
10518
10572
|
}
|
|
@@ -10538,51 +10592,46 @@ exports.JwtPlatformGuard = class JwtPlatformGuard {
|
|
|
10538
10592
|
if (payload.type !== "platform") {
|
|
10539
10593
|
throw new AuthException(AUTH_ERROR_CODES.PLATFORM_AUTH_REQUIRED);
|
|
10540
10594
|
}
|
|
10541
|
-
|
|
10542
|
-
if (revoked !== null) {
|
|
10543
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10544
|
-
}
|
|
10545
|
-
const epoch = await this.redis.getUserTokenEpoch(payload.sub, "platform");
|
|
10546
|
-
if (readStampedEpoch(payload) < epoch) {
|
|
10595
|
+
if (await this.revocation.isAccessTokenRevoked(payload, "platform")) {
|
|
10547
10596
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
10548
10597
|
}
|
|
10549
10598
|
request.user = payload;
|
|
10550
10599
|
return true;
|
|
10551
10600
|
}
|
|
10552
10601
|
};
|
|
10553
|
-
exports.JwtPlatformGuard =
|
|
10602
|
+
exports.JwtPlatformGuard = _ts_decorate45([
|
|
10554
10603
|
common.Injectable(),
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
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", [
|
|
10562
10611
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
10563
10612
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
10564
|
-
typeof
|
|
10613
|
+
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
10565
10614
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
10566
10615
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
10567
10616
|
])
|
|
10568
10617
|
], exports.JwtPlatformGuard);
|
|
10569
|
-
function
|
|
10618
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
10570
10619
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10571
10620
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10572
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;
|
|
10573
10622
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10574
10623
|
}
|
|
10575
|
-
__name(
|
|
10576
|
-
function
|
|
10624
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
10625
|
+
function _ts_metadata45(k, v) {
|
|
10577
10626
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10578
10627
|
}
|
|
10579
|
-
__name(
|
|
10580
|
-
function
|
|
10628
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
10629
|
+
function _ts_param25(paramIndex, decorator) {
|
|
10581
10630
|
return function(target, key) {
|
|
10582
10631
|
decorator(target, key, paramIndex);
|
|
10583
10632
|
};
|
|
10584
10633
|
}
|
|
10585
|
-
__name(
|
|
10634
|
+
__name(_ts_param25, "_ts_param");
|
|
10586
10635
|
exports.PlatformAuthService = class _PlatformAuthService {
|
|
10587
10636
|
static {
|
|
10588
10637
|
__name(this, "PlatformAuthService");
|
|
@@ -10804,16 +10853,16 @@ exports.PlatformAuthService = class _PlatformAuthService {
|
|
|
10804
10853
|
await this.redis.bumpUserTokenEpoch(userId, "platform");
|
|
10805
10854
|
}
|
|
10806
10855
|
};
|
|
10807
|
-
exports.PlatformAuthService =
|
|
10856
|
+
exports.PlatformAuthService = _ts_decorate46([
|
|
10808
10857
|
common.Injectable(),
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
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", [
|
|
10817
10866
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
10818
10867
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
10819
10868
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -10824,23 +10873,23 @@ exports.PlatformAuthService = _ts_decorate45([
|
|
|
10824
10873
|
], exports.PlatformAuthService);
|
|
10825
10874
|
|
|
10826
10875
|
// src/server/controllers/platform-auth.controller.ts
|
|
10827
|
-
function
|
|
10876
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
10828
10877
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10829
10878
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10830
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;
|
|
10831
10880
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10832
10881
|
}
|
|
10833
|
-
__name(
|
|
10834
|
-
function
|
|
10882
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
10883
|
+
function _ts_metadata46(k, v) {
|
|
10835
10884
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10836
10885
|
}
|
|
10837
|
-
__name(
|
|
10838
|
-
function
|
|
10886
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
10887
|
+
function _ts_param26(paramIndex, decorator) {
|
|
10839
10888
|
return function(target, key) {
|
|
10840
10889
|
decorator(target, key, paramIndex);
|
|
10841
10890
|
};
|
|
10842
10891
|
}
|
|
10843
|
-
__name(
|
|
10892
|
+
__name(_ts_param26, "_ts_param");
|
|
10844
10893
|
function isPlatformResult2(result) {
|
|
10845
10894
|
return "admin" in result;
|
|
10846
10895
|
}
|
|
@@ -11000,117 +11049,117 @@ var PlatformAuthController = class {
|
|
|
11000
11049
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
11001
11050
|
}
|
|
11002
11051
|
};
|
|
11003
|
-
|
|
11052
|
+
_ts_decorate47([
|
|
11004
11053
|
Public(),
|
|
11005
11054
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
11006
11055
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
11007
11056
|
common.HttpCode(common.HttpStatus.OK),
|
|
11008
11057
|
common.Post("login"),
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11058
|
+
_ts_param26(0, common.Body()),
|
|
11059
|
+
_ts_param26(1, common.Req()),
|
|
11060
|
+
_ts_metadata46("design:type", Function),
|
|
11061
|
+
_ts_metadata46("design:paramtypes", [
|
|
11013
11062
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
11014
11063
|
typeof Request === "undefined" ? Object : Request
|
|
11015
11064
|
]),
|
|
11016
|
-
|
|
11065
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11017
11066
|
], PlatformAuthController.prototype, "login", null);
|
|
11018
|
-
|
|
11067
|
+
_ts_decorate47([
|
|
11019
11068
|
Public(),
|
|
11020
11069
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11021
11070
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
11022
11071
|
common.HttpCode(common.HttpStatus.OK),
|
|
11023
11072
|
common.Post("mfa/challenge"),
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11073
|
+
_ts_param26(0, common.Body()),
|
|
11074
|
+
_ts_param26(1, common.Req()),
|
|
11075
|
+
_ts_metadata46("design:type", Function),
|
|
11076
|
+
_ts_metadata46("design:paramtypes", [
|
|
11028
11077
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
11029
11078
|
typeof Request === "undefined" ? Object : Request
|
|
11030
11079
|
]),
|
|
11031
|
-
|
|
11080
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11032
11081
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
11033
|
-
|
|
11082
|
+
_ts_decorate47([
|
|
11034
11083
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11035
11084
|
common.Get("me"),
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11085
|
+
_ts_param26(0, CurrentUser()),
|
|
11086
|
+
_ts_metadata46("design:type", Function),
|
|
11087
|
+
_ts_metadata46("design:paramtypes", [
|
|
11039
11088
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
11040
11089
|
]),
|
|
11041
|
-
|
|
11090
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11042
11091
|
], PlatformAuthController.prototype, "me", null);
|
|
11043
|
-
|
|
11092
|
+
_ts_decorate47([
|
|
11044
11093
|
Public(),
|
|
11045
11094
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
11046
11095
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
11047
11096
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11048
11097
|
common.Post("logout"),
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11098
|
+
_ts_param26(0, common.Req()),
|
|
11099
|
+
_ts_metadata46("design:type", Function),
|
|
11100
|
+
_ts_metadata46("design:paramtypes", [
|
|
11052
11101
|
typeof Request === "undefined" ? Object : Request
|
|
11053
11102
|
]),
|
|
11054
|
-
|
|
11103
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11055
11104
|
], PlatformAuthController.prototype, "logout", null);
|
|
11056
|
-
|
|
11105
|
+
_ts_decorate47([
|
|
11057
11106
|
Public(),
|
|
11058
11107
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
11059
11108
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
11060
11109
|
common.HttpCode(common.HttpStatus.OK),
|
|
11061
11110
|
common.Post("refresh"),
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11111
|
+
_ts_param26(0, common.Req()),
|
|
11112
|
+
_ts_metadata46("design:type", Function),
|
|
11113
|
+
_ts_metadata46("design:paramtypes", [
|
|
11065
11114
|
typeof Request === "undefined" ? Object : Request
|
|
11066
11115
|
]),
|
|
11067
|
-
|
|
11116
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11068
11117
|
], PlatformAuthController.prototype, "refresh", null);
|
|
11069
|
-
|
|
11118
|
+
_ts_decorate47([
|
|
11070
11119
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11071
11120
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11072
11121
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11073
11122
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11074
11123
|
common.Delete("sessions"),
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11124
|
+
_ts_param26(0, CurrentUser()),
|
|
11125
|
+
_ts_metadata46("design:type", Function),
|
|
11126
|
+
_ts_metadata46("design:paramtypes", [
|
|
11078
11127
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
11079
11128
|
]),
|
|
11080
|
-
|
|
11129
|
+
_ts_metadata46("design:returntype", Promise)
|
|
11081
11130
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
11082
|
-
PlatformAuthController =
|
|
11131
|
+
PlatformAuthController = _ts_decorate47([
|
|
11083
11132
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11084
11133
|
common.Controller("platform"),
|
|
11085
11134
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
11086
11135
|
common.UsePipes(createAuthValidationPipe()),
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
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", [
|
|
11092
11141
|
typeof exports.PlatformAuthService === "undefined" ? Object : exports.PlatformAuthService,
|
|
11093
11142
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService,
|
|
11094
11143
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
11095
11144
|
])
|
|
11096
11145
|
], PlatformAuthController);
|
|
11097
|
-
function
|
|
11146
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
11098
11147
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11099
11148
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11100
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;
|
|
11101
11150
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11102
11151
|
}
|
|
11103
|
-
__name(
|
|
11104
|
-
function
|
|
11152
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
11153
|
+
function _ts_metadata47(k, v) {
|
|
11105
11154
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11106
11155
|
}
|
|
11107
|
-
__name(
|
|
11108
|
-
function
|
|
11156
|
+
__name(_ts_metadata47, "_ts_metadata");
|
|
11157
|
+
function _ts_param27(paramIndex, decorator) {
|
|
11109
11158
|
return function(target, key) {
|
|
11110
11159
|
decorator(target, key, paramIndex);
|
|
11111
11160
|
};
|
|
11112
11161
|
}
|
|
11113
|
-
__name(
|
|
11162
|
+
__name(_ts_param27, "_ts_param");
|
|
11114
11163
|
var PlatformMfaController = class {
|
|
11115
11164
|
static {
|
|
11116
11165
|
__name(this, "PlatformMfaController");
|
|
@@ -11189,101 +11238,101 @@ var PlatformMfaController = class {
|
|
|
11189
11238
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
11190
11239
|
}
|
|
11191
11240
|
};
|
|
11192
|
-
|
|
11241
|
+
_ts_decorate48([
|
|
11193
11242
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11194
11243
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11195
11244
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11196
11245
|
common.Post("setup"),
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11246
|
+
_ts_param27(0, CurrentUser()),
|
|
11247
|
+
_ts_param27(1, common.Body()),
|
|
11248
|
+
_ts_metadata47("design:type", Function),
|
|
11249
|
+
_ts_metadata47("design:paramtypes", [
|
|
11201
11250
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11202
11251
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
11203
11252
|
]),
|
|
11204
|
-
|
|
11253
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11205
11254
|
], PlatformMfaController.prototype, "setup", null);
|
|
11206
|
-
|
|
11255
|
+
_ts_decorate48([
|
|
11207
11256
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11208
11257
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11209
11258
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11210
11259
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11211
11260
|
common.Post("verify-enable"),
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
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", [
|
|
11217
11266
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11218
11267
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
11219
11268
|
typeof Request === "undefined" ? Object : Request
|
|
11220
11269
|
]),
|
|
11221
|
-
|
|
11270
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11222
11271
|
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
11223
|
-
|
|
11272
|
+
_ts_decorate48([
|
|
11224
11273
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11225
11274
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11226
11275
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11227
11276
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11228
11277
|
common.Post("disable"),
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
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", [
|
|
11234
11283
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11235
11284
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
11236
11285
|
typeof Request === "undefined" ? Object : Request
|
|
11237
11286
|
]),
|
|
11238
|
-
|
|
11287
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11239
11288
|
], PlatformMfaController.prototype, "disable", null);
|
|
11240
|
-
|
|
11289
|
+
_ts_decorate48([
|
|
11241
11290
|
common.UseGuards(exports.JwtPlatformGuard),
|
|
11242
11291
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11243
11292
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11244
11293
|
common.HttpCode(common.HttpStatus.OK),
|
|
11245
11294
|
common.Post("recovery-codes"),
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
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", [
|
|
11251
11300
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
11252
11301
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
11253
11302
|
typeof Request === "undefined" ? Object : Request
|
|
11254
11303
|
]),
|
|
11255
|
-
|
|
11304
|
+
_ts_metadata47("design:returntype", Promise)
|
|
11256
11305
|
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
11257
|
-
PlatformMfaController =
|
|
11306
|
+
PlatformMfaController = _ts_decorate48([
|
|
11258
11307
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11259
11308
|
common.Controller("platform/mfa"),
|
|
11260
11309
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard),
|
|
11261
11310
|
common.UsePipes(createAuthValidationPipe({
|
|
11262
11311
|
forbidUnknownValues: true
|
|
11263
11312
|
})),
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11313
|
+
_ts_param27(0, common.Inject(exports.MfaService)),
|
|
11314
|
+
_ts_metadata47("design:type", Function),
|
|
11315
|
+
_ts_metadata47("design:paramtypes", [
|
|
11267
11316
|
typeof exports.MfaService === "undefined" ? Object : exports.MfaService
|
|
11268
11317
|
])
|
|
11269
11318
|
], PlatformMfaController);
|
|
11270
|
-
function
|
|
11319
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
11271
11320
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11272
11321
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11273
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;
|
|
11274
11323
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11275
11324
|
}
|
|
11276
|
-
__name(
|
|
11277
|
-
function
|
|
11325
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
11326
|
+
function _ts_metadata48(k, v) {
|
|
11278
11327
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11279
11328
|
}
|
|
11280
|
-
__name(
|
|
11281
|
-
function
|
|
11329
|
+
__name(_ts_metadata48, "_ts_metadata");
|
|
11330
|
+
function _ts_param28(paramIndex, decorator) {
|
|
11282
11331
|
return function(target, key) {
|
|
11283
11332
|
decorator(target, key, paramIndex);
|
|
11284
11333
|
};
|
|
11285
11334
|
}
|
|
11286
|
-
__name(
|
|
11335
|
+
__name(_ts_param28, "_ts_param");
|
|
11287
11336
|
var SessionController = class {
|
|
11288
11337
|
static {
|
|
11289
11338
|
__name(this, "SessionController");
|
|
@@ -11359,77 +11408,77 @@ var SessionController = class {
|
|
|
11359
11408
|
await this.sessionService.revokeOtherSession(user.sub, id);
|
|
11360
11409
|
}
|
|
11361
11410
|
};
|
|
11362
|
-
|
|
11411
|
+
_ts_decorate49([
|
|
11363
11412
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
11364
11413
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
11365
11414
|
common.Get(),
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11415
|
+
_ts_param28(0, CurrentUser()),
|
|
11416
|
+
_ts_param28(1, common.Req()),
|
|
11417
|
+
_ts_metadata48("design:type", Function),
|
|
11418
|
+
_ts_metadata48("design:paramtypes", [
|
|
11370
11419
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11371
11420
|
typeof Request === "undefined" ? Object : Request
|
|
11372
11421
|
]),
|
|
11373
|
-
|
|
11422
|
+
_ts_metadata48("design:returntype", Promise)
|
|
11374
11423
|
], SessionController.prototype, "listSessions", null);
|
|
11375
|
-
|
|
11424
|
+
_ts_decorate49([
|
|
11376
11425
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11377
11426
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
11378
11427
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11379
11428
|
common.Delete("all"),
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11429
|
+
_ts_param28(0, CurrentUser()),
|
|
11430
|
+
_ts_param28(1, common.Req()),
|
|
11431
|
+
_ts_metadata48("design:type", Function),
|
|
11432
|
+
_ts_metadata48("design:paramtypes", [
|
|
11384
11433
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11385
11434
|
typeof Request === "undefined" ? Object : Request
|
|
11386
11435
|
]),
|
|
11387
|
-
|
|
11436
|
+
_ts_metadata48("design:returntype", Promise)
|
|
11388
11437
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
11389
|
-
|
|
11438
|
+
_ts_decorate49([
|
|
11390
11439
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
11391
11440
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
11392
11441
|
common.HttpCode(common.HttpStatus.NO_CONTENT),
|
|
11393
11442
|
common.Delete(":id"),
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11443
|
+
_ts_param28(0, CurrentUser()),
|
|
11444
|
+
_ts_param28(1, common.Param("id")),
|
|
11445
|
+
_ts_metadata48("design:type", Function),
|
|
11446
|
+
_ts_metadata48("design:paramtypes", [
|
|
11398
11447
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11399
11448
|
String
|
|
11400
11449
|
]),
|
|
11401
|
-
|
|
11450
|
+
_ts_metadata48("design:returntype", Promise)
|
|
11402
11451
|
], SessionController.prototype, "revokeSession", null);
|
|
11403
|
-
SessionController =
|
|
11452
|
+
SessionController = _ts_decorate49([
|
|
11404
11453
|
common.UseInterceptors(NoStoreInterceptor),
|
|
11405
11454
|
common.Controller("sessions"),
|
|
11406
11455
|
common.UseGuards(exports.TrustedOriginGuard, exports.AuthRateLimitGuard, exports.JwtAuthGuard, exports.UserStatusGuard),
|
|
11407
11456
|
common.UsePipes(createAuthValidationPipe()),
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
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", [
|
|
11412
11461
|
typeof exports.SessionService === "undefined" ? Object : exports.SessionService,
|
|
11413
11462
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService
|
|
11414
11463
|
])
|
|
11415
11464
|
], SessionController);
|
|
11416
|
-
function
|
|
11465
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
11417
11466
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11418
11467
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11419
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;
|
|
11420
11469
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11421
11470
|
}
|
|
11422
|
-
__name(
|
|
11423
|
-
function
|
|
11471
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
11472
|
+
function _ts_metadata49(k, v) {
|
|
11424
11473
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11425
11474
|
}
|
|
11426
|
-
__name(
|
|
11427
|
-
function
|
|
11475
|
+
__name(_ts_metadata49, "_ts_metadata");
|
|
11476
|
+
function _ts_param29(paramIndex, decorator) {
|
|
11428
11477
|
return function(target, key) {
|
|
11429
11478
|
decorator(target, key, paramIndex);
|
|
11430
11479
|
};
|
|
11431
11480
|
}
|
|
11432
|
-
__name(
|
|
11481
|
+
__name(_ts_param29, "_ts_param");
|
|
11433
11482
|
exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
11434
11483
|
static {
|
|
11435
11484
|
__name(this, "MfaRequiredGuard");
|
|
@@ -11456,11 +11505,11 @@ exports.MfaRequiredGuard = class MfaRequiredGuard {
|
|
|
11456
11505
|
return true;
|
|
11457
11506
|
}
|
|
11458
11507
|
};
|
|
11459
|
-
exports.MfaRequiredGuard =
|
|
11508
|
+
exports.MfaRequiredGuard = _ts_decorate50([
|
|
11460
11509
|
common.Injectable(),
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11510
|
+
_ts_param29(0, common.Inject(core.Reflector)),
|
|
11511
|
+
_ts_metadata49("design:type", Function),
|
|
11512
|
+
_ts_metadata49("design:paramtypes", [
|
|
11464
11513
|
typeof core.Reflector === "undefined" ? Object : core.Reflector
|
|
11465
11514
|
])
|
|
11466
11515
|
], exports.MfaRequiredGuard);
|
|
@@ -11468,23 +11517,23 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
11468
11517
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
11469
11518
|
|
|
11470
11519
|
// src/server/guards/platform-roles.guard.ts
|
|
11471
|
-
function
|
|
11520
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
11472
11521
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11473
11522
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11474
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;
|
|
11475
11524
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11476
11525
|
}
|
|
11477
|
-
__name(
|
|
11478
|
-
function
|
|
11526
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
11527
|
+
function _ts_metadata50(k, v) {
|
|
11479
11528
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11480
11529
|
}
|
|
11481
|
-
__name(
|
|
11482
|
-
function
|
|
11530
|
+
__name(_ts_metadata50, "_ts_metadata");
|
|
11531
|
+
function _ts_param30(paramIndex, decorator) {
|
|
11483
11532
|
return function(target, key) {
|
|
11484
11533
|
decorator(target, key, paramIndex);
|
|
11485
11534
|
};
|
|
11486
11535
|
}
|
|
11487
|
-
__name(
|
|
11536
|
+
__name(_ts_param30, "_ts_param");
|
|
11488
11537
|
exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
11489
11538
|
static {
|
|
11490
11539
|
__name(this, "PlatformRolesGuard");
|
|
@@ -11518,12 +11567,12 @@ exports.PlatformRolesGuard = class PlatformRolesGuard {
|
|
|
11518
11567
|
return true;
|
|
11519
11568
|
}
|
|
11520
11569
|
};
|
|
11521
|
-
exports.PlatformRolesGuard =
|
|
11570
|
+
exports.PlatformRolesGuard = _ts_decorate51([
|
|
11522
11571
|
common.Injectable(),
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
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", [
|
|
11527
11576
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
11528
11577
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11529
11578
|
])
|
|
@@ -11532,23 +11581,23 @@ var ROLES_KEY = "roles";
|
|
|
11532
11581
|
var Roles = /* @__PURE__ */ __name((...roles) => common.SetMetadata(ROLES_KEY, roles), "Roles");
|
|
11533
11582
|
|
|
11534
11583
|
// src/server/guards/roles.guard.ts
|
|
11535
|
-
function
|
|
11584
|
+
function _ts_decorate52(decorators, target, key, desc) {
|
|
11536
11585
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11537
11586
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11538
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;
|
|
11539
11588
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11540
11589
|
}
|
|
11541
|
-
__name(
|
|
11542
|
-
function
|
|
11590
|
+
__name(_ts_decorate52, "_ts_decorate");
|
|
11591
|
+
function _ts_metadata51(k, v) {
|
|
11543
11592
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11544
11593
|
}
|
|
11545
|
-
__name(
|
|
11546
|
-
function
|
|
11594
|
+
__name(_ts_metadata51, "_ts_metadata");
|
|
11595
|
+
function _ts_param31(paramIndex, decorator) {
|
|
11547
11596
|
return function(target, key) {
|
|
11548
11597
|
decorator(target, key, paramIndex);
|
|
11549
11598
|
};
|
|
11550
11599
|
}
|
|
11551
|
-
__name(
|
|
11600
|
+
__name(_ts_param31, "_ts_param");
|
|
11552
11601
|
exports.RolesGuard = class RolesGuard {
|
|
11553
11602
|
static {
|
|
11554
11603
|
__name(this, "RolesGuard");
|
|
@@ -11578,23 +11627,23 @@ exports.RolesGuard = class RolesGuard {
|
|
|
11578
11627
|
return true;
|
|
11579
11628
|
}
|
|
11580
11629
|
};
|
|
11581
|
-
exports.RolesGuard =
|
|
11630
|
+
exports.RolesGuard = _ts_decorate52([
|
|
11582
11631
|
common.Injectable(),
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11586
|
-
|
|
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", [
|
|
11587
11636
|
typeof core.Reflector === "undefined" ? Object : core.Reflector,
|
|
11588
11637
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11589
11638
|
])
|
|
11590
11639
|
], exports.RolesGuard);
|
|
11591
|
-
function
|
|
11640
|
+
function _ts_decorate53(decorators, target, key, desc) {
|
|
11592
11641
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11593
11642
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11594
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;
|
|
11595
11644
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11596
11645
|
}
|
|
11597
|
-
__name(
|
|
11646
|
+
__name(_ts_decorate53, "_ts_decorate");
|
|
11598
11647
|
exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
11599
11648
|
static {
|
|
11600
11649
|
__name(this, "NoOpAuthHooks");
|
|
@@ -11637,7 +11686,7 @@ exports.NoOpAuthHooks = class NoOpAuthHooks {
|
|
|
11637
11686
|
};
|
|
11638
11687
|
}
|
|
11639
11688
|
};
|
|
11640
|
-
exports.NoOpAuthHooks =
|
|
11689
|
+
exports.NoOpAuthHooks = _ts_decorate53([
|
|
11641
11690
|
common.Injectable()
|
|
11642
11691
|
], exports.NoOpAuthHooks);
|
|
11643
11692
|
|
|
@@ -11650,23 +11699,23 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
|
11650
11699
|
var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
|
|
11651
11700
|
|
|
11652
11701
|
// src/server/oauth/oauth.service.ts
|
|
11653
|
-
function
|
|
11702
|
+
function _ts_decorate54(decorators, target, key, desc) {
|
|
11654
11703
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11655
11704
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11656
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;
|
|
11657
11706
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11658
11707
|
}
|
|
11659
|
-
__name(
|
|
11660
|
-
function
|
|
11708
|
+
__name(_ts_decorate54, "_ts_decorate");
|
|
11709
|
+
function _ts_metadata52(k, v) {
|
|
11661
11710
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11662
11711
|
}
|
|
11663
|
-
__name(
|
|
11664
|
-
function
|
|
11712
|
+
__name(_ts_metadata52, "_ts_metadata");
|
|
11713
|
+
function _ts_param32(paramIndex, decorator) {
|
|
11665
11714
|
return function(target, key) {
|
|
11666
11715
|
decorator(target, key, paramIndex);
|
|
11667
11716
|
};
|
|
11668
11717
|
}
|
|
11669
|
-
__name(
|
|
11718
|
+
__name(_ts_param32, "_ts_param");
|
|
11670
11719
|
var OAUTH_STATE_TTL_SECONDS = 600;
|
|
11671
11720
|
function isStoredOAuthState(value) {
|
|
11672
11721
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -11926,18 +11975,18 @@ exports.OAuthService = class _OAuthService {
|
|
|
11926
11975
|
return plugin;
|
|
11927
11976
|
}
|
|
11928
11977
|
};
|
|
11929
|
-
exports.OAuthService =
|
|
11978
|
+
exports.OAuthService = _ts_decorate54([
|
|
11930
11979
|
common.Injectable(),
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
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", [
|
|
11941
11990
|
Array,
|
|
11942
11991
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
11943
11992
|
Object,
|
|
@@ -11947,17 +11996,17 @@ exports.OAuthService = _ts_decorate53([
|
|
|
11947
11996
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11948
11997
|
])
|
|
11949
11998
|
], exports.OAuthService);
|
|
11950
|
-
function
|
|
11999
|
+
function _ts_decorate55(decorators, target, key, desc) {
|
|
11951
12000
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11952
12001
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11953
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;
|
|
11954
12003
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11955
12004
|
}
|
|
11956
|
-
__name(
|
|
11957
|
-
function
|
|
12005
|
+
__name(_ts_decorate55, "_ts_decorate");
|
|
12006
|
+
function _ts_metadata53(k, v) {
|
|
11958
12007
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11959
12008
|
}
|
|
11960
|
-
__name(
|
|
12009
|
+
__name(_ts_metadata53, "_ts_metadata");
|
|
11961
12010
|
var OAuthCallbackQueryDto = class {
|
|
11962
12011
|
static {
|
|
11963
12012
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -12037,78 +12086,78 @@ var OAuthCallbackQueryDto = class {
|
|
|
12037
12086
|
*/
|
|
12038
12087
|
hd;
|
|
12039
12088
|
};
|
|
12040
|
-
|
|
12089
|
+
_ts_decorate55([
|
|
12041
12090
|
classValidator.ValidateIf((query) => query.error === void 0),
|
|
12042
12091
|
classValidator.IsString(),
|
|
12043
12092
|
classValidator.IsNotEmpty(),
|
|
12044
12093
|
classValidator.MaxLength(2048),
|
|
12045
|
-
|
|
12094
|
+
_ts_metadata53("design:type", String)
|
|
12046
12095
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
12047
|
-
|
|
12096
|
+
_ts_decorate55([
|
|
12048
12097
|
classValidator.IsOptional(),
|
|
12049
12098
|
classValidator.IsString(),
|
|
12050
12099
|
classValidator.MaxLength(128),
|
|
12051
|
-
|
|
12100
|
+
_ts_metadata53("design:type", String)
|
|
12052
12101
|
], OAuthCallbackQueryDto.prototype, "error", void 0);
|
|
12053
|
-
|
|
12102
|
+
_ts_decorate55([
|
|
12054
12103
|
classValidator.IsOptional(),
|
|
12055
12104
|
classValidator.IsString(),
|
|
12056
12105
|
classValidator.MaxLength(512),
|
|
12057
|
-
|
|
12106
|
+
_ts_metadata53("design:type", String)
|
|
12058
12107
|
], OAuthCallbackQueryDto.prototype, "error_description", void 0);
|
|
12059
|
-
|
|
12108
|
+
_ts_decorate55([
|
|
12060
12109
|
classValidator.IsOptional(),
|
|
12061
12110
|
classValidator.IsString(),
|
|
12062
12111
|
classValidator.MaxLength(512),
|
|
12063
|
-
|
|
12112
|
+
_ts_metadata53("design:type", String)
|
|
12064
12113
|
], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
|
|
12065
|
-
|
|
12114
|
+
_ts_decorate55([
|
|
12066
12115
|
classValidator.IsString(),
|
|
12067
12116
|
classValidator.IsNotEmpty(),
|
|
12068
12117
|
classValidator.MaxLength(128),
|
|
12069
|
-
|
|
12118
|
+
_ts_metadata53("design:type", String)
|
|
12070
12119
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
12071
|
-
|
|
12120
|
+
_ts_decorate55([
|
|
12072
12121
|
classValidator.IsOptional(),
|
|
12073
12122
|
classValidator.IsString(),
|
|
12074
12123
|
classValidator.MaxLength(512),
|
|
12075
|
-
|
|
12124
|
+
_ts_metadata53("design:type", String)
|
|
12076
12125
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
12077
|
-
|
|
12126
|
+
_ts_decorate55([
|
|
12078
12127
|
classValidator.IsOptional(),
|
|
12079
12128
|
classValidator.IsString(),
|
|
12080
12129
|
classValidator.MaxLength(2048),
|
|
12081
|
-
|
|
12130
|
+
_ts_metadata53("design:type", String)
|
|
12082
12131
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
12083
|
-
|
|
12132
|
+
_ts_decorate55([
|
|
12084
12133
|
classValidator.IsOptional(),
|
|
12085
12134
|
classValidator.IsString(),
|
|
12086
12135
|
classValidator.MaxLength(16),
|
|
12087
|
-
|
|
12136
|
+
_ts_metadata53("design:type", String)
|
|
12088
12137
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
12089
|
-
|
|
12138
|
+
_ts_decorate55([
|
|
12090
12139
|
classValidator.IsOptional(),
|
|
12091
12140
|
classValidator.IsString(),
|
|
12092
12141
|
classValidator.MaxLength(64),
|
|
12093
|
-
|
|
12142
|
+
_ts_metadata53("design:type", String)
|
|
12094
12143
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
12095
|
-
|
|
12144
|
+
_ts_decorate55([
|
|
12096
12145
|
classValidator.IsOptional(),
|
|
12097
12146
|
classValidator.IsString(),
|
|
12098
12147
|
classValidator.MaxLength(253),
|
|
12099
|
-
|
|
12148
|
+
_ts_metadata53("design:type", String)
|
|
12100
12149
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
12101
|
-
function
|
|
12150
|
+
function _ts_decorate56(decorators, target, key, desc) {
|
|
12102
12151
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12103
12152
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12104
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;
|
|
12105
12154
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12106
12155
|
}
|
|
12107
|
-
__name(
|
|
12108
|
-
function
|
|
12156
|
+
__name(_ts_decorate56, "_ts_decorate");
|
|
12157
|
+
function _ts_metadata54(k, v) {
|
|
12109
12158
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12110
12159
|
}
|
|
12111
|
-
__name(
|
|
12160
|
+
__name(_ts_metadata54, "_ts_metadata");
|
|
12112
12161
|
var OAuthInitiateQueryDto = class {
|
|
12113
12162
|
static {
|
|
12114
12163
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -12125,7 +12174,7 @@ var OAuthInitiateQueryDto = class {
|
|
|
12125
12174
|
*/
|
|
12126
12175
|
tenantId;
|
|
12127
12176
|
};
|
|
12128
|
-
|
|
12177
|
+
_ts_decorate56([
|
|
12129
12178
|
classValidator.IsOptional(),
|
|
12130
12179
|
classValidator.IsString(),
|
|
12131
12180
|
classValidator.IsNotEmpty(),
|
|
@@ -12133,27 +12182,27 @@ _ts_decorate55([
|
|
|
12133
12182
|
classValidator.Matches(NO_CONTROL_CHARACTERS, {
|
|
12134
12183
|
message: "tenantId must not contain control characters"
|
|
12135
12184
|
}),
|
|
12136
|
-
|
|
12185
|
+
_ts_metadata54("design:type", String)
|
|
12137
12186
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
12138
12187
|
|
|
12139
12188
|
// src/server/oauth/oauth.controller.ts
|
|
12140
|
-
function
|
|
12189
|
+
function _ts_decorate57(decorators, target, key, desc) {
|
|
12141
12190
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12142
12191
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12143
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;
|
|
12144
12193
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12145
12194
|
}
|
|
12146
|
-
__name(
|
|
12147
|
-
function
|
|
12195
|
+
__name(_ts_decorate57, "_ts_decorate");
|
|
12196
|
+
function _ts_metadata55(k, v) {
|
|
12148
12197
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12149
12198
|
}
|
|
12150
|
-
__name(
|
|
12151
|
-
function
|
|
12199
|
+
__name(_ts_metadata55, "_ts_metadata");
|
|
12200
|
+
function _ts_param33(paramIndex, decorator) {
|
|
12152
12201
|
return function(target, key) {
|
|
12153
12202
|
decorator(target, key, paramIndex);
|
|
12154
12203
|
};
|
|
12155
12204
|
}
|
|
12156
|
-
__name(
|
|
12205
|
+
__name(_ts_param33, "_ts_param");
|
|
12157
12206
|
function isOAuthMfaChallenge(result) {
|
|
12158
12207
|
return "mfaRequired" in result && result.mfaRequired === true;
|
|
12159
12208
|
}
|
|
@@ -12371,46 +12420,46 @@ var OAuthController = class _OAuthController {
|
|
|
12371
12420
|
});
|
|
12372
12421
|
}
|
|
12373
12422
|
};
|
|
12374
|
-
|
|
12423
|
+
_ts_decorate57([
|
|
12375
12424
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
12376
12425
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
12377
12426
|
common.Get(":provider"),
|
|
12378
|
-
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
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({
|
|
12382
12431
|
passthrough: true
|
|
12383
12432
|
})),
|
|
12384
|
-
|
|
12385
|
-
|
|
12433
|
+
_ts_metadata55("design:type", Function),
|
|
12434
|
+
_ts_metadata55("design:paramtypes", [
|
|
12386
12435
|
String,
|
|
12387
12436
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
12388
12437
|
typeof Request === "undefined" ? Object : Request,
|
|
12389
12438
|
typeof Response === "undefined" ? Object : Response
|
|
12390
12439
|
]),
|
|
12391
|
-
|
|
12440
|
+
_ts_metadata55("design:returntype", Promise)
|
|
12392
12441
|
], OAuthController.prototype, "initiate", null);
|
|
12393
|
-
|
|
12442
|
+
_ts_decorate57([
|
|
12394
12443
|
throttler.Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
12395
12444
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
12396
12445
|
common.HttpCode(common.HttpStatus.OK),
|
|
12397
12446
|
common.Get(":provider/callback"),
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
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({
|
|
12402
12451
|
passthrough: true
|
|
12403
12452
|
})),
|
|
12404
|
-
|
|
12405
|
-
|
|
12453
|
+
_ts_metadata55("design:type", Function),
|
|
12454
|
+
_ts_metadata55("design:paramtypes", [
|
|
12406
12455
|
String,
|
|
12407
12456
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
12408
12457
|
typeof Request === "undefined" ? Object : Request,
|
|
12409
12458
|
typeof Response === "undefined" ? Object : Response
|
|
12410
12459
|
]),
|
|
12411
|
-
|
|
12460
|
+
_ts_metadata55("design:returntype", Promise)
|
|
12412
12461
|
], OAuthController.prototype, "callback", null);
|
|
12413
|
-
OAuthController =
|
|
12462
|
+
OAuthController = _ts_decorate57([
|
|
12414
12463
|
Public(),
|
|
12415
12464
|
SkipMfa(),
|
|
12416
12465
|
common.UseInterceptors(NoStoreInterceptor),
|
|
@@ -12419,11 +12468,11 @@ OAuthController = _ts_decorate56([
|
|
|
12419
12468
|
common.UsePipes(createAuthValidationPipe({
|
|
12420
12469
|
forbidUnknownValues: true
|
|
12421
12470
|
})),
|
|
12422
|
-
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12426
|
-
|
|
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", [
|
|
12427
12476
|
typeof exports.OAuthService === "undefined" ? Object : exports.OAuthService,
|
|
12428
12477
|
typeof exports.TokenDeliveryService === "undefined" ? Object : exports.TokenDeliveryService,
|
|
12429
12478
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -12562,13 +12611,13 @@ var GoogleOAuthPlugin = class {
|
|
|
12562
12611
|
};
|
|
12563
12612
|
|
|
12564
12613
|
// src/server/oauth/oauth.module.ts
|
|
12565
|
-
function
|
|
12614
|
+
function _ts_decorate58(decorators, target, key, desc) {
|
|
12566
12615
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12567
12616
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12568
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;
|
|
12569
12618
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12570
12619
|
}
|
|
12571
|
-
__name(
|
|
12620
|
+
__name(_ts_decorate58, "_ts_decorate");
|
|
12572
12621
|
function buildOAuthPlugins(options) {
|
|
12573
12622
|
const plugins = [];
|
|
12574
12623
|
if (options.oauth?.google) {
|
|
@@ -12638,26 +12687,26 @@ var OAuthModule = class _OAuthModule {
|
|
|
12638
12687
|
};
|
|
12639
12688
|
}
|
|
12640
12689
|
};
|
|
12641
|
-
OAuthModule =
|
|
12690
|
+
OAuthModule = _ts_decorate58([
|
|
12642
12691
|
common.Module({})
|
|
12643
12692
|
], OAuthModule);
|
|
12644
|
-
function
|
|
12693
|
+
function _ts_decorate59(decorators, target, key, desc) {
|
|
12645
12694
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12646
12695
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12647
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;
|
|
12648
12697
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12649
12698
|
}
|
|
12650
|
-
__name(
|
|
12651
|
-
function
|
|
12699
|
+
__name(_ts_decorate59, "_ts_decorate");
|
|
12700
|
+
function _ts_metadata56(k, v) {
|
|
12652
12701
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12653
12702
|
}
|
|
12654
|
-
__name(
|
|
12655
|
-
function
|
|
12703
|
+
__name(_ts_metadata56, "_ts_metadata");
|
|
12704
|
+
function _ts_param34(paramIndex, decorator) {
|
|
12656
12705
|
return function(target, key) {
|
|
12657
12706
|
decorator(target, key, paramIndex);
|
|
12658
12707
|
};
|
|
12659
12708
|
}
|
|
12660
|
-
__name(
|
|
12709
|
+
__name(_ts_param34, "_ts_param");
|
|
12661
12710
|
var COMMON_BASE_WORDS = [
|
|
12662
12711
|
// The perennial top of every published list.
|
|
12663
12712
|
"password",
|
|
@@ -12963,68 +13012,68 @@ exports.CommonPasswordChecker = class CommonPasswordChecker {
|
|
|
12963
13012
|
return false;
|
|
12964
13013
|
}
|
|
12965
13014
|
};
|
|
12966
|
-
exports.CommonPasswordChecker =
|
|
13015
|
+
exports.CommonPasswordChecker = _ts_decorate59([
|
|
12967
13016
|
common.Injectable(),
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
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", [
|
|
12972
13021
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
12973
13022
|
])
|
|
12974
13023
|
], exports.CommonPasswordChecker);
|
|
12975
|
-
function
|
|
13024
|
+
function _ts_decorate60(decorators, target, key, desc) {
|
|
12976
13025
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12977
13026
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12978
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;
|
|
12979
13028
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12980
13029
|
}
|
|
12981
|
-
__name(
|
|
13030
|
+
__name(_ts_decorate60, "_ts_decorate");
|
|
12982
13031
|
exports.NoOpEmailProvider = class _NoOpEmailProvider {
|
|
12983
13032
|
static {
|
|
12984
13033
|
__name(this, "NoOpEmailProvider");
|
|
12985
13034
|
}
|
|
12986
13035
|
logger = new common.Logger(_NoOpEmailProvider.name);
|
|
12987
13036
|
/** @inheritdoc */
|
|
12988
|
-
async sendPasswordResetToken(email, _token, _locale) {
|
|
13037
|
+
async sendPasswordResetToken(_tenantId, email, _token, _locale) {
|
|
12989
13038
|
this.logger.log(`sendPasswordResetToken \u2192 ${maskEmail(email)} (no-op)`);
|
|
12990
13039
|
}
|
|
12991
13040
|
/** @inheritdoc */
|
|
12992
|
-
async sendPasswordResetOtp(email, _otp, _locale) {
|
|
13041
|
+
async sendPasswordResetOtp(_tenantId, email, _otp, _locale) {
|
|
12993
13042
|
this.logger.log(`sendPasswordResetOtp \u2192 ${maskEmail(email)} (no-op)`);
|
|
12994
13043
|
}
|
|
12995
13044
|
/** @inheritdoc */
|
|
12996
|
-
async sendEmailVerificationOtp(email, _otp, _locale) {
|
|
13045
|
+
async sendEmailVerificationOtp(_tenantId, email, _otp, _locale) {
|
|
12997
13046
|
this.logger.log(`sendEmailVerificationOtp \u2192 ${maskEmail(email)} (no-op)`);
|
|
12998
13047
|
}
|
|
12999
13048
|
/** @inheritdoc */
|
|
13000
|
-
async sendMfaEnabledNotification(email, _locale) {
|
|
13049
|
+
async sendMfaEnabledNotification(_tenantId, email, _locale) {
|
|
13001
13050
|
this.logger.log(`sendMfaEnabledNotification \u2192 ${maskEmail(email)} (no-op)`);
|
|
13002
13051
|
}
|
|
13003
13052
|
/** @inheritdoc */
|
|
13004
|
-
async sendMfaDisabledNotification(email, _locale) {
|
|
13053
|
+
async sendMfaDisabledNotification(_tenantId, email, _locale) {
|
|
13005
13054
|
this.logger.log(`sendMfaDisabledNotification \u2192 ${maskEmail(email)} (no-op)`);
|
|
13006
13055
|
}
|
|
13007
13056
|
/** @inheritdoc */
|
|
13008
|
-
async sendNewSessionAlert(email, _sessionInfo, _locale) {
|
|
13057
|
+
async sendNewSessionAlert(_tenantId, email, _sessionInfo, _locale) {
|
|
13009
13058
|
this.logger.log(`sendNewSessionAlert \u2192 ${maskEmail(email)} (no-op)`);
|
|
13010
13059
|
}
|
|
13011
13060
|
/** @inheritdoc */
|
|
13012
|
-
async sendInvitation(email, _inviteData, _locale) {
|
|
13061
|
+
async sendInvitation(_tenantId, email, _inviteData, _locale) {
|
|
13013
13062
|
this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
|
|
13014
13063
|
}
|
|
13015
13064
|
};
|
|
13016
|
-
exports.NoOpEmailProvider =
|
|
13065
|
+
exports.NoOpEmailProvider = _ts_decorate60([
|
|
13017
13066
|
common.Injectable()
|
|
13018
13067
|
], exports.NoOpEmailProvider);
|
|
13019
13068
|
|
|
13020
13069
|
// src/server/bymax-auth.module.ts
|
|
13021
|
-
function
|
|
13070
|
+
function _ts_decorate61(decorators, target, key, desc) {
|
|
13022
13071
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13023
13072
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13024
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;
|
|
13025
13074
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13026
13075
|
}
|
|
13027
|
-
__name(
|
|
13076
|
+
__name(_ts_decorate61, "_ts_decorate");
|
|
13028
13077
|
function hasProviderToken(providers, token) {
|
|
13029
13078
|
return providers.some((p) => {
|
|
13030
13079
|
if (typeof p === "function") return false;
|
|
@@ -13208,6 +13257,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
13208
13257
|
// BYMAX_AUTH_REDIS_CLIENT and BYMAX_AUTH_OPTIONS provided via extraProviders
|
|
13209
13258
|
// are visible in the same module scope.
|
|
13210
13259
|
AuthRedisService,
|
|
13260
|
+
exports.AuthRevocationService,
|
|
13211
13261
|
PasswordService,
|
|
13212
13262
|
TokenManagerService,
|
|
13213
13263
|
exports.TokenDeliveryService,
|
|
@@ -13295,6 +13345,10 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
13295
13345
|
// NestJS auto-registers @UseGuards() guards as local providers in the controller's
|
|
13296
13346
|
// module; all constructor deps must be resolvable from that module's context.
|
|
13297
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,
|
|
13298
13352
|
// Same reason, for the two exported guards whose remaining constructor deps are not
|
|
13299
13353
|
// covered by the entries above. Exporting the guard class is necessary but not
|
|
13300
13354
|
// sufficient: because @UseGuards() re-instantiates the guard in the *consumer's*
|
|
@@ -13319,20 +13373,229 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
13319
13373
|
};
|
|
13320
13374
|
}
|
|
13321
13375
|
};
|
|
13322
|
-
exports.BymaxAuthModule =
|
|
13376
|
+
exports.BymaxAuthModule = _ts_decorate61([
|
|
13323
13377
|
common.Module({})
|
|
13324
13378
|
], exports.BymaxAuthModule);
|
|
13325
|
-
|
|
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) {
|
|
13326
13589
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13327
13590
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13328
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;
|
|
13329
13592
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13330
13593
|
}
|
|
13331
|
-
__name(
|
|
13332
|
-
function
|
|
13594
|
+
__name(_ts_decorate62, "_ts_decorate");
|
|
13595
|
+
function _ts_metadata57(k, v) {
|
|
13333
13596
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13334
13597
|
}
|
|
13335
|
-
__name(
|
|
13598
|
+
__name(_ts_metadata57, "_ts_metadata");
|
|
13336
13599
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
13337
13600
|
var PREFIX_LENGTH = 5;
|
|
13338
13601
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -13389,10 +13652,10 @@ exports.HibpBreachChecker = class _HibpBreachChecker {
|
|
|
13389
13652
|
}
|
|
13390
13653
|
}
|
|
13391
13654
|
};
|
|
13392
|
-
exports.HibpBreachChecker =
|
|
13655
|
+
exports.HibpBreachChecker = _ts_decorate62([
|
|
13393
13656
|
common.Injectable(),
|
|
13394
|
-
|
|
13395
|
-
|
|
13657
|
+
_ts_metadata57("design:type", Function),
|
|
13658
|
+
_ts_metadata57("design:paramtypes", [
|
|
13396
13659
|
Number
|
|
13397
13660
|
])
|
|
13398
13661
|
], exports.HibpBreachChecker);
|
|
@@ -13405,16 +13668,16 @@ exports.AllowAllBreachChecker = class AllowAllBreachChecker {
|
|
|
13405
13668
|
return false;
|
|
13406
13669
|
}
|
|
13407
13670
|
};
|
|
13408
|
-
exports.AllowAllBreachChecker =
|
|
13671
|
+
exports.AllowAllBreachChecker = _ts_decorate62([
|
|
13409
13672
|
common.Injectable()
|
|
13410
13673
|
], exports.AllowAllBreachChecker);
|
|
13411
|
-
function
|
|
13674
|
+
function _ts_decorate63(decorators, target, key, desc) {
|
|
13412
13675
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13413
13676
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13414
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;
|
|
13415
13678
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13416
13679
|
}
|
|
13417
|
-
__name(
|
|
13680
|
+
__name(_ts_decorate63, "_ts_decorate");
|
|
13418
13681
|
exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard {
|
|
13419
13682
|
static {
|
|
13420
13683
|
__name(this, "OptionalAuthGuard");
|
|
@@ -13429,26 +13692,26 @@ exports.OptionalAuthGuard = class OptionalAuthGuard extends exports.JwtAuthGuard
|
|
|
13429
13692
|
return super.canActivate(context);
|
|
13430
13693
|
}
|
|
13431
13694
|
};
|
|
13432
|
-
exports.OptionalAuthGuard =
|
|
13695
|
+
exports.OptionalAuthGuard = _ts_decorate63([
|
|
13433
13696
|
common.Injectable()
|
|
13434
13697
|
], exports.OptionalAuthGuard);
|
|
13435
|
-
function
|
|
13698
|
+
function _ts_decorate64(decorators, target, key, desc) {
|
|
13436
13699
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13437
13700
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13438
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;
|
|
13439
13702
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13440
13703
|
}
|
|
13441
|
-
__name(
|
|
13442
|
-
function
|
|
13704
|
+
__name(_ts_decorate64, "_ts_decorate");
|
|
13705
|
+
function _ts_metadata58(k, v) {
|
|
13443
13706
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13444
13707
|
}
|
|
13445
|
-
__name(
|
|
13446
|
-
function
|
|
13708
|
+
__name(_ts_metadata58, "_ts_metadata");
|
|
13709
|
+
function _ts_param35(paramIndex, decorator) {
|
|
13447
13710
|
return function(target, key) {
|
|
13448
13711
|
decorator(target, key, paramIndex);
|
|
13449
13712
|
};
|
|
13450
13713
|
}
|
|
13451
|
-
__name(
|
|
13714
|
+
__name(_ts_param35, "_ts_param");
|
|
13452
13715
|
exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
13453
13716
|
static {
|
|
13454
13717
|
__name(this, "SelfOrAdminGuard");
|
|
@@ -13478,11 +13741,11 @@ exports.SelfOrAdminGuard = class SelfOrAdminGuard {
|
|
|
13478
13741
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE, common.HttpStatus.FORBIDDEN);
|
|
13479
13742
|
}
|
|
13480
13743
|
};
|
|
13481
|
-
exports.SelfOrAdminGuard =
|
|
13744
|
+
exports.SelfOrAdminGuard = _ts_decorate64([
|
|
13482
13745
|
common.Injectable(),
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13746
|
+
_ts_param35(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13747
|
+
_ts_metadata58("design:type", Function),
|
|
13748
|
+
_ts_metadata58("design:paramtypes", [
|
|
13486
13749
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13487
13750
|
])
|
|
13488
13751
|
], exports.SelfOrAdminGuard);
|
|
@@ -13495,34 +13758,34 @@ function isHexLooking(value) {
|
|
|
13495
13758
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
13496
13759
|
}
|
|
13497
13760
|
__name(isHexLooking, "isHexLooking");
|
|
13498
|
-
function
|
|
13761
|
+
function _ts_decorate65(decorators, target, key, desc) {
|
|
13499
13762
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13500
13763
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13501
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;
|
|
13502
13765
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13503
13766
|
}
|
|
13504
|
-
__name(
|
|
13505
|
-
function
|
|
13767
|
+
__name(_ts_decorate65, "_ts_decorate");
|
|
13768
|
+
function _ts_metadata59(k, v) {
|
|
13506
13769
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
13507
13770
|
}
|
|
13508
|
-
__name(
|
|
13509
|
-
function
|
|
13771
|
+
__name(_ts_metadata59, "_ts_metadata");
|
|
13772
|
+
function _ts_param36(paramIndex, decorator) {
|
|
13510
13773
|
return function(target, key) {
|
|
13511
13774
|
decorator(target, key, paramIndex);
|
|
13512
13775
|
};
|
|
13513
13776
|
}
|
|
13514
|
-
__name(
|
|
13777
|
+
__name(_ts_param36, "_ts_param");
|
|
13515
13778
|
exports.WsJwtGuard = class WsJwtGuard {
|
|
13516
13779
|
static {
|
|
13517
13780
|
__name(this, "WsJwtGuard");
|
|
13518
13781
|
}
|
|
13519
13782
|
jwtService;
|
|
13520
|
-
|
|
13783
|
+
revocation;
|
|
13521
13784
|
wsTickets;
|
|
13522
13785
|
options;
|
|
13523
|
-
constructor(jwtService,
|
|
13786
|
+
constructor(jwtService, revocation, wsTickets, options) {
|
|
13524
13787
|
this.jwtService = jwtService;
|
|
13525
|
-
this.
|
|
13788
|
+
this.revocation = revocation;
|
|
13526
13789
|
this.wsTickets = wsTickets;
|
|
13527
13790
|
this.options = options;
|
|
13528
13791
|
}
|
|
@@ -13561,29 +13824,24 @@ exports.WsJwtGuard = class WsJwtGuard {
|
|
|
13561
13824
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
13562
13825
|
}
|
|
13563
13826
|
assertTokenType(payload, "dashboard");
|
|
13564
|
-
const revoked = await this.redis.get(`rv:${payload.jti}`);
|
|
13565
|
-
if (revoked !== null) {
|
|
13566
|
-
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
13567
|
-
}
|
|
13568
13827
|
assertValidSub(payload.sub);
|
|
13569
|
-
|
|
13570
|
-
if (readStampedEpoch(payload) < epoch) {
|
|
13828
|
+
if (await this.revocation.isAccessTokenRevoked(payload)) {
|
|
13571
13829
|
throw new AuthException(AUTH_ERROR_CODES.TOKEN_INVALID);
|
|
13572
13830
|
}
|
|
13573
13831
|
client.data.user = payload;
|
|
13574
13832
|
return true;
|
|
13575
13833
|
}
|
|
13576
13834
|
};
|
|
13577
|
-
exports.WsJwtGuard =
|
|
13835
|
+
exports.WsJwtGuard = _ts_decorate65([
|
|
13578
13836
|
common.Injectable(),
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
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", [
|
|
13585
13843
|
typeof jwt.JwtService === "undefined" ? Object : jwt.JwtService,
|
|
13586
|
-
typeof
|
|
13844
|
+
typeof exports.AuthRevocationService === "undefined" ? Object : exports.AuthRevocationService,
|
|
13587
13845
|
typeof exports.WsTicketService === "undefined" ? Object : exports.WsTicketService,
|
|
13588
13846
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13589
13847
|
])
|
|
@@ -13614,13 +13872,13 @@ function readUpgradeTicket(client) {
|
|
|
13614
13872
|
return all.length === 1 && all[0] !== "" ? all[0] : void 0;
|
|
13615
13873
|
}
|
|
13616
13874
|
__name(readUpgradeTicket, "readUpgradeTicket");
|
|
13617
|
-
function
|
|
13875
|
+
function _ts_decorate66(decorators, target, key, desc) {
|
|
13618
13876
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13619
13877
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13620
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;
|
|
13621
13879
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13622
13880
|
}
|
|
13623
|
-
__name(
|
|
13881
|
+
__name(_ts_decorate66, "_ts_decorate");
|
|
13624
13882
|
function isAuthEnvelope(body) {
|
|
13625
13883
|
if (typeof body !== "object" || body === null) return false;
|
|
13626
13884
|
const error = body.error;
|
|
@@ -13672,7 +13930,7 @@ exports.AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
13672
13930
|
});
|
|
13673
13931
|
}
|
|
13674
13932
|
};
|
|
13675
|
-
exports.AuthExceptionFilter =
|
|
13933
|
+
exports.AuthExceptionFilter = _ts_decorate66([
|
|
13676
13934
|
common.Catch()
|
|
13677
13935
|
], exports.AuthExceptionFilter);
|
|
13678
13936
|
|
|
@@ -13693,6 +13951,7 @@ exports.BYMAX_AUTH_USER_REPOSITORY = BYMAX_AUTH_USER_REPOSITORY;
|
|
|
13693
13951
|
exports.ChangePasswordDto = ChangePasswordDto;
|
|
13694
13952
|
exports.CreateInvitationDto = CreateInvitationDto;
|
|
13695
13953
|
exports.CurrentUser = CurrentUser;
|
|
13954
|
+
exports.DefaultAuthEmailProvider = DefaultAuthEmailProvider;
|
|
13696
13955
|
exports.ForgotPasswordDto = ForgotPasswordDto;
|
|
13697
13956
|
exports.IS_PUBLIC_KEY = IS_PUBLIC_KEY;
|
|
13698
13957
|
exports.LoginDto = LoginDto;
|