@bymax-one/nest-auth 1.4.16 → 1.4.18
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 +126 -1
- package/dist/server/index.cjs +1061 -726
- package/dist/server/index.d.cts +182 -16
- package/dist/server/index.d.ts +182 -16
- package/dist/server/index.mjs +1062 -728
- package/package.json +3 -1
package/dist/server/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createParamDecorator, HttpException, HttpStatus, Injectable, Inject, Logger, Optional, ValidationPipe, Post, Body, Req, Res, HttpCode, UseGuards, Get, UseInterceptors, Controller, UsePipes, Delete, Param, Query, Module, SetMetadata, Catch, applyDecorators } from '@nestjs/common';
|
|
1
|
+
import { createParamDecorator, HttpException, HttpStatus, Injectable, Inject, Logger, Optional, ValidationPipe, Post, Body, Req, Res, HttpCode, UseGuards, Get, UseInterceptors, Controller, UsePipes, Delete, Param, Query, Module, SetMetadata, Catch, BadRequestException, applyDecorators } from '@nestjs/common';
|
|
2
2
|
import { Reflector, DiscoveryService, MetadataScanner, DiscoveryModule } from '@nestjs/core';
|
|
3
3
|
import { JwtService, JwtModule } from '@nestjs/jwt';
|
|
4
4
|
import { randomInt, scrypt as scrypt$1, randomBytes, timingSafeEqual, randomUUID, createHash, createHmac, createCipheriv, createDecipheriv } from 'crypto';
|
|
@@ -187,6 +187,10 @@ var LIBRARY_READ_HEADERS = [
|
|
|
187
187
|
// The cross-site request checks of `TrustedOriginGuard`.
|
|
188
188
|
"origin",
|
|
189
189
|
"sec-fetch-site",
|
|
190
|
+
// The compressed-body refusal of `RequestEncodingGuard`, and the check of whether a body is present.
|
|
191
|
+
"content-encoding",
|
|
192
|
+
"content-length",
|
|
193
|
+
"transfer-encoding",
|
|
190
194
|
// What the client address (`request.ip`) is derived from behind a trusted proxy.
|
|
191
195
|
"x-forwarded-for",
|
|
192
196
|
"x-forwarded-host",
|
|
@@ -351,6 +355,7 @@ function resolveOptions(userOptions) {
|
|
|
351
355
|
validateOAuthErrorRedirectUrl(userOptions);
|
|
352
356
|
validateRefreshCookiePath(userOptions.routePrefix, userOptions.cookies);
|
|
353
357
|
validateSameSiteNoneRequiresSecure(userOptions);
|
|
358
|
+
validateProductionCookiesAreSecure(userOptions);
|
|
354
359
|
validateCookiePrefixes(userOptions);
|
|
355
360
|
validateTrustedOrigins(userOptions);
|
|
356
361
|
validateRefreshGraceWindow(userOptions.jwt);
|
|
@@ -911,6 +916,11 @@ function validateSameSiteNoneRequiresSecure(userOptions) {
|
|
|
911
916
|
}
|
|
912
917
|
}
|
|
913
918
|
__name(validateSameSiteNoneRequiresSecure, "validateSameSiteNoneRequiresSecure");
|
|
919
|
+
function validateProductionCookiesAreSecure(userOptions) {
|
|
920
|
+
if (userOptions.secureCookies !== false || !isProductionDeployment(userOptions)) return;
|
|
921
|
+
throw new Error(`[BymaxAuthModule] secureCookies is false but environment is 'production' (the default when unset). A session cookie without the Secure attribute is sent over plain HTTP. Set secureCookies: true (a TLS-terminating proxy still serves HTTPS to the browser), or declare environment: 'development' or 'test' for local HTTP.`);
|
|
922
|
+
}
|
|
923
|
+
__name(validateProductionCookiesAreSecure, "validateProductionCookiesAreSecure");
|
|
914
924
|
function validateTrustedOrigins(userOptions) {
|
|
915
925
|
const sameSite = userOptions.cookies?.sameSite ?? DEFAULT_OPTIONS.cookies.sameSite;
|
|
916
926
|
const trustedOrigins = userOptions.cookies?.trustedOrigins ?? [];
|
|
@@ -1257,6 +1267,8 @@ var CurrentUser = createParamDecorator((property, ctx) => {
|
|
|
1257
1267
|
});
|
|
1258
1268
|
var IS_PUBLIC_KEY = /* @__PURE__ */ Symbol("bymax:isPublic");
|
|
1259
1269
|
var Public = /* @__PURE__ */ __name(() => SetMetadata(IS_PUBLIC_KEY, true), "Public");
|
|
1270
|
+
var REQUEST_ENCODING_KEY = /* @__PURE__ */ Symbol("bymax:requestEncoding");
|
|
1271
|
+
var RequestEncoding = /* @__PURE__ */ __name((policy) => SetMetadata(REQUEST_ENCODING_KEY, policy), "RequestEncoding");
|
|
1260
1272
|
|
|
1261
1273
|
// src/server/dto/no-control-characters.ts
|
|
1262
1274
|
var NO_CONTROL_CHARACTERS = /^[^\u0000-\u001F\u007F-\u009F]+$/;
|
|
@@ -3854,6 +3866,78 @@ function _ts_metadata10(metadataKey, metadataValue) {
|
|
|
3854
3866
|
}
|
|
3855
3867
|
}
|
|
3856
3868
|
__name(_ts_metadata10, "_ts_metadata");
|
|
3869
|
+
var BODYLESS_METHODS = /* @__PURE__ */ new Set([
|
|
3870
|
+
"GET",
|
|
3871
|
+
"HEAD",
|
|
3872
|
+
"OPTIONS",
|
|
3873
|
+
"DELETE"
|
|
3874
|
+
]);
|
|
3875
|
+
var UNSUPPORTED_MEDIA_TYPE_MESSAGE = "Unsupported media type";
|
|
3876
|
+
var RequestEncodingGuard = class {
|
|
3877
|
+
static {
|
|
3878
|
+
__name(this, "RequestEncodingGuard");
|
|
3879
|
+
}
|
|
3880
|
+
reflector;
|
|
3881
|
+
constructor(reflector) {
|
|
3882
|
+
this.reflector = reflector;
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
* @param context - The execution context of the request.
|
|
3886
|
+
* @returns `true` when the route does not check, the request declares no encoding or only
|
|
3887
|
+
* `identity`, or the route checks only requests with a body and this one has none.
|
|
3888
|
+
* @throws {@link HttpException} `415` in the `auth.validation` envelope otherwise.
|
|
3889
|
+
*/
|
|
3890
|
+
canActivate(context) {
|
|
3891
|
+
const request = context.switchToHttp().getRequest();
|
|
3892
|
+
if (BODYLESS_METHODS.has(request.method)) return true;
|
|
3893
|
+
const policy = this.reflector.get(REQUEST_ENCODING_KEY, context.getHandler());
|
|
3894
|
+
if (policy === "unchecked") return true;
|
|
3895
|
+
const header = request.headers["content-encoding"];
|
|
3896
|
+
if (header === void 0) return true;
|
|
3897
|
+
const encodings = header.split(",").map((encoding) => encoding.trim().toLowerCase()).filter((encoding) => encoding.length > 0);
|
|
3898
|
+
if (encodings.every((encoding) => encoding === "identity")) return true;
|
|
3899
|
+
if (policy === "when-body" && !carriesBody(request)) return true;
|
|
3900
|
+
throw new HttpException({
|
|
3901
|
+
error: {
|
|
3902
|
+
code: AUTH_ERROR_CODES.VALIDATION,
|
|
3903
|
+
message: UNSUPPORTED_MEDIA_TYPE_MESSAGE,
|
|
3904
|
+
details: null
|
|
3905
|
+
}
|
|
3906
|
+
}, HttpStatus.UNSUPPORTED_MEDIA_TYPE);
|
|
3907
|
+
}
|
|
3908
|
+
};
|
|
3909
|
+
RequestEncodingGuard = _ts_decorate10([
|
|
3910
|
+
Injectable(),
|
|
3911
|
+
_ts_metadata10("design:type", Function),
|
|
3912
|
+
_ts_metadata10("design:paramtypes", [
|
|
3913
|
+
typeof Reflector === "undefined" ? Object : Reflector
|
|
3914
|
+
])
|
|
3915
|
+
], RequestEncodingGuard);
|
|
3916
|
+
function carriesBody(request) {
|
|
3917
|
+
const length = request.headers["content-length"];
|
|
3918
|
+
return request.headers["transfer-encoding"] !== void 0 || length !== void 0 && length !== "0";
|
|
3919
|
+
}
|
|
3920
|
+
__name(carriesBody, "carriesBody");
|
|
3921
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
3922
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3923
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3924
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3925
|
+
} else {
|
|
3926
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
3927
|
+
if (d = decorators[i]) {
|
|
3928
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3933
|
+
}
|
|
3934
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
3935
|
+
function _ts_metadata11(metadataKey, metadataValue) {
|
|
3936
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3937
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
3857
3941
|
function _ts_param6(paramIndex, decorator) {
|
|
3858
3942
|
return function(target, key) {
|
|
3859
3943
|
decorator(target, key, paramIndex);
|
|
@@ -3897,15 +3981,15 @@ var TrustedOriginGuard = class {
|
|
|
3897
3981
|
return true;
|
|
3898
3982
|
}
|
|
3899
3983
|
};
|
|
3900
|
-
TrustedOriginGuard =
|
|
3984
|
+
TrustedOriginGuard = _ts_decorate11([
|
|
3901
3985
|
Injectable(),
|
|
3902
3986
|
_ts_param6(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
3903
|
-
|
|
3904
|
-
|
|
3987
|
+
_ts_metadata11("design:type", Function),
|
|
3988
|
+
_ts_metadata11("design:paramtypes", [
|
|
3905
3989
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
3906
3990
|
])
|
|
3907
3991
|
], TrustedOriginGuard);
|
|
3908
|
-
function
|
|
3992
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
3909
3993
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3910
3994
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3911
3995
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3918,13 +4002,13 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
3918
4002
|
}
|
|
3919
4003
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3920
4004
|
}
|
|
3921
|
-
__name(
|
|
3922
|
-
function
|
|
4005
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
4006
|
+
function _ts_metadata12(metadataKey, metadataValue) {
|
|
3923
4007
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3924
4008
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3925
4009
|
}
|
|
3926
4010
|
}
|
|
3927
|
-
__name(
|
|
4011
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
3928
4012
|
function _ts_param7(paramIndex, decorator) {
|
|
3929
4013
|
return function(target, key) {
|
|
3930
4014
|
decorator(target, key, paramIndex);
|
|
@@ -4071,15 +4155,15 @@ var AccountStatusService = class {
|
|
|
4071
4155
|
assertNotBlocked(admin.status, this.options.blockedStatuses);
|
|
4072
4156
|
}
|
|
4073
4157
|
};
|
|
4074
|
-
AccountStatusService =
|
|
4158
|
+
AccountStatusService = _ts_decorate12([
|
|
4075
4159
|
Injectable(),
|
|
4076
4160
|
_ts_param7(0, Inject(AuthRedisService)),
|
|
4077
4161
|
_ts_param7(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
4078
4162
|
_ts_param7(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
4079
4163
|
_ts_param7(3, Optional()),
|
|
4080
4164
|
_ts_param7(3, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
4081
|
-
|
|
4082
|
-
|
|
4165
|
+
_ts_metadata12("design:type", Function),
|
|
4166
|
+
_ts_metadata12("design:paramtypes", [
|
|
4083
4167
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
4084
4168
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
4085
4169
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -4088,7 +4172,7 @@ AccountStatusService = _ts_decorate11([
|
|
|
4088
4172
|
], AccountStatusService);
|
|
4089
4173
|
|
|
4090
4174
|
// src/server/guards/user-status.guard.ts
|
|
4091
|
-
function
|
|
4175
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
4092
4176
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4093
4177
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4094
4178
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4101,13 +4185,13 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
4101
4185
|
}
|
|
4102
4186
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4103
4187
|
}
|
|
4104
|
-
__name(
|
|
4105
|
-
function
|
|
4188
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
4189
|
+
function _ts_metadata13(metadataKey, metadataValue) {
|
|
4106
4190
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4107
4191
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4108
4192
|
}
|
|
4109
4193
|
}
|
|
4110
|
-
__name(
|
|
4194
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
4111
4195
|
function _ts_param8(paramIndex, decorator) {
|
|
4112
4196
|
return function(target, key) {
|
|
4113
4197
|
decorator(target, key, paramIndex);
|
|
@@ -4142,15 +4226,15 @@ var UserStatusGuard = class {
|
|
|
4142
4226
|
return true;
|
|
4143
4227
|
}
|
|
4144
4228
|
};
|
|
4145
|
-
UserStatusGuard =
|
|
4229
|
+
UserStatusGuard = _ts_decorate13([
|
|
4146
4230
|
Injectable(),
|
|
4147
4231
|
_ts_param8(0, Inject(AccountStatusService)),
|
|
4148
|
-
|
|
4149
|
-
|
|
4232
|
+
_ts_metadata13("design:type", Function),
|
|
4233
|
+
_ts_metadata13("design:paramtypes", [
|
|
4150
4234
|
typeof AccountStatusService === "undefined" ? Object : AccountStatusService
|
|
4151
4235
|
])
|
|
4152
4236
|
], UserStatusGuard);
|
|
4153
|
-
function
|
|
4237
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
4154
4238
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4155
4239
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4156
4240
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4163,7 +4247,7 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
4163
4247
|
}
|
|
4164
4248
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4165
4249
|
}
|
|
4166
|
-
__name(
|
|
4250
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
4167
4251
|
var NoStoreInterceptor = class {
|
|
4168
4252
|
static {
|
|
4169
4253
|
__name(this, "NoStoreInterceptor");
|
|
@@ -4178,7 +4262,7 @@ var NoStoreInterceptor = class {
|
|
|
4178
4262
|
return next.handle();
|
|
4179
4263
|
}
|
|
4180
4264
|
};
|
|
4181
|
-
NoStoreInterceptor =
|
|
4265
|
+
NoStoreInterceptor = _ts_decorate14([
|
|
4182
4266
|
Injectable()
|
|
4183
4267
|
], NoStoreInterceptor);
|
|
4184
4268
|
function flattenValidationErrors(errors, parentPath = "") {
|
|
@@ -4218,7 +4302,7 @@ function createAuthValidationPipe(options = {}) {
|
|
|
4218
4302
|
});
|
|
4219
4303
|
}
|
|
4220
4304
|
__name(createAuthValidationPipe, "createAuthValidationPipe");
|
|
4221
|
-
function
|
|
4305
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
4222
4306
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4223
4307
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4224
4308
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4231,13 +4315,13 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
4231
4315
|
}
|
|
4232
4316
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4233
4317
|
}
|
|
4234
|
-
__name(
|
|
4235
|
-
function
|
|
4318
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
4319
|
+
function _ts_metadata14(metadataKey, metadataValue) {
|
|
4236
4320
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4237
4321
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4238
4322
|
}
|
|
4239
4323
|
}
|
|
4240
|
-
__name(
|
|
4324
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
4241
4325
|
function _ts_param9(paramIndex, decorator) {
|
|
4242
4326
|
return function(target, key) {
|
|
4243
4327
|
decorator(target, key, paramIndex);
|
|
@@ -4333,17 +4417,17 @@ var BruteForceService = class _BruteForceService {
|
|
|
4333
4417
|
}
|
|
4334
4418
|
}
|
|
4335
4419
|
};
|
|
4336
|
-
BruteForceService =
|
|
4420
|
+
BruteForceService = _ts_decorate15([
|
|
4337
4421
|
Injectable(),
|
|
4338
4422
|
_ts_param9(0, Inject(AuthRedisService)),
|
|
4339
4423
|
_ts_param9(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
4340
|
-
|
|
4341
|
-
|
|
4424
|
+
_ts_metadata14("design:type", Function),
|
|
4425
|
+
_ts_metadata14("design:paramtypes", [
|
|
4342
4426
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
4343
4427
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
4344
4428
|
])
|
|
4345
4429
|
], BruteForceService);
|
|
4346
|
-
function
|
|
4430
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
4347
4431
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4348
4432
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4349
4433
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4356,13 +4440,13 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
4356
4440
|
}
|
|
4357
4441
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4358
4442
|
}
|
|
4359
|
-
__name(
|
|
4360
|
-
function
|
|
4443
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
4444
|
+
function _ts_metadata15(metadataKey, metadataValue) {
|
|
4361
4445
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4362
4446
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4363
4447
|
}
|
|
4364
4448
|
}
|
|
4365
|
-
__name(
|
|
4449
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
4366
4450
|
function _ts_param10(paramIndex, decorator) {
|
|
4367
4451
|
return function(target, key) {
|
|
4368
4452
|
decorator(target, key, paramIndex);
|
|
@@ -4526,17 +4610,17 @@ var OtpService = class {
|
|
|
4526
4610
|
await sleep(Math.max(0, MIN_VERIFY_MS - (Date.now() - start)));
|
|
4527
4611
|
}
|
|
4528
4612
|
};
|
|
4529
|
-
OtpService =
|
|
4613
|
+
OtpService = _ts_decorate16([
|
|
4530
4614
|
Injectable(),
|
|
4531
4615
|
_ts_param10(0, Inject(AuthRedisService)),
|
|
4532
4616
|
_ts_param10(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
4533
|
-
|
|
4534
|
-
|
|
4617
|
+
_ts_metadata15("design:type", Function),
|
|
4618
|
+
_ts_metadata15("design:paramtypes", [
|
|
4535
4619
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
4536
4620
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
4537
4621
|
])
|
|
4538
4622
|
], OtpService);
|
|
4539
|
-
function
|
|
4623
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4540
4624
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4541
4625
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4542
4626
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4549,13 +4633,13 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
4549
4633
|
}
|
|
4550
4634
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4551
4635
|
}
|
|
4552
|
-
__name(
|
|
4553
|
-
function
|
|
4636
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
4637
|
+
function _ts_metadata16(metadataKey, metadataValue) {
|
|
4554
4638
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4555
4639
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4556
4640
|
}
|
|
4557
4641
|
}
|
|
4558
|
-
__name(
|
|
4642
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
4559
4643
|
function _ts_param11(paramIndex, decorator) {
|
|
4560
4644
|
return function(target, key) {
|
|
4561
4645
|
decorator(target, key, paramIndex);
|
|
@@ -4850,12 +4934,12 @@ var PasswordService = class _PasswordService {
|
|
|
4850
4934
|
return timingSafeEqual(candidate, DUMMY_EXPECTED);
|
|
4851
4935
|
}
|
|
4852
4936
|
};
|
|
4853
|
-
PasswordService =
|
|
4937
|
+
PasswordService = _ts_decorate17([
|
|
4854
4938
|
Injectable(),
|
|
4855
4939
|
_ts_param11(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
4856
4940
|
_ts_param11(1, Inject(BYMAX_AUTH_BREACH_CHECKER)),
|
|
4857
|
-
|
|
4858
|
-
|
|
4941
|
+
_ts_metadata16("design:type", Function),
|
|
4942
|
+
_ts_metadata16("design:paramtypes", [
|
|
4859
4943
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
4860
4944
|
typeof IPasswordBreachChecker === "undefined" ? Object : IPasswordBreachChecker
|
|
4861
4945
|
])
|
|
@@ -4888,7 +4972,7 @@ function settleAfter(first, followUps) {
|
|
|
4888
4972
|
__name(settleAfter, "settleAfter");
|
|
4889
4973
|
|
|
4890
4974
|
// src/server/services/session.service.ts
|
|
4891
|
-
function
|
|
4975
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
4892
4976
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4893
4977
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
4894
4978
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4901,13 +4985,13 @@ function _ts_decorate17(decorators, target, key, desc) {
|
|
|
4901
4985
|
}
|
|
4902
4986
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4903
4987
|
}
|
|
4904
|
-
__name(
|
|
4905
|
-
function
|
|
4988
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
4989
|
+
function _ts_metadata17(metadataKey, metadataValue) {
|
|
4906
4990
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
4907
4991
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
4908
4992
|
}
|
|
4909
4993
|
}
|
|
4910
|
-
__name(
|
|
4994
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
4911
4995
|
function _ts_param12(paramIndex, decorator) {
|
|
4912
4996
|
return function(target, key) {
|
|
4913
4997
|
decorator(target, key, paramIndex);
|
|
@@ -5238,16 +5322,35 @@ var SessionService = class _SessionService {
|
|
|
5238
5322
|
* Refuses a session hash that names no live session of this user.
|
|
5239
5323
|
*
|
|
5240
5324
|
* For an operation that keeps one session and ends the rest and so has to be told which one,
|
|
5241
|
-
* checked before it changes anything. The membership test is the
|
|
5242
|
-
*
|
|
5325
|
+
* checked before it changes anything. The membership test is the one {@link resolveLiveSession}
|
|
5326
|
+
* applies, so a token that has just rotated is accepted here exactly as it is there.
|
|
5243
5327
|
*
|
|
5244
5328
|
* @param params - See {@link LiveSessionParams}.
|
|
5245
5329
|
* @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is not a live session.
|
|
5246
5330
|
*/
|
|
5247
|
-
async assertLiveSession(
|
|
5331
|
+
async assertLiveSession(params) {
|
|
5332
|
+
await this.resolveLiveSession(params);
|
|
5333
|
+
}
|
|
5334
|
+
/**
|
|
5335
|
+
* Names the live session a presented refresh-token hash stands for.
|
|
5336
|
+
*
|
|
5337
|
+
* The hash itself when it is a live session. When it is a token that rotated away moments ago,
|
|
5338
|
+
* the session the rotation produced: the rotation grace pointer `rp:{hash}` names that successor,
|
|
5339
|
+
* and the presented token still identifies the same device. A request that carries a refresh
|
|
5340
|
+
* token can lose a race to a refresh of the same session, and an operation that must keep "the
|
|
5341
|
+
* caller's session" would otherwise refuse the caller for having been refreshed. The pointer is
|
|
5342
|
+
* read, never consumed, and the successor has to be live in the index too, so a pointer left
|
|
5343
|
+
* behind by a session that was since revoked names nothing.
|
|
5344
|
+
*
|
|
5345
|
+
* @param params - See {@link LiveSessionParams}.
|
|
5346
|
+
* @returns The hash of the live session to keep: `sessionHash`, or its live successor.
|
|
5347
|
+
* @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is neither a live session nor
|
|
5348
|
+
* the predecessor of one.
|
|
5349
|
+
*/
|
|
5350
|
+
async resolveLiveSession({ userId, tenantId, sessionHash }) {
|
|
5248
5351
|
this.assertTenant(tenantId);
|
|
5249
5352
|
this.assertValidSessionHash(sessionHash, "sessionHash");
|
|
5250
|
-
this.
|
|
5353
|
+
return this.resolveLiveMember(await this.redis.smembers(this.indexKey(userId, tenantId)), sessionHash);
|
|
5251
5354
|
}
|
|
5252
5355
|
/**
|
|
5253
5356
|
* Revokes all sessions for a user except the caller's current session.
|
|
@@ -5284,11 +5387,11 @@ var SessionService = class _SessionService {
|
|
|
5284
5387
|
this.assertTenant(tenantId);
|
|
5285
5388
|
this.assertValidSessionHash(currentSessionHash, "currentSessionHash");
|
|
5286
5389
|
const members = await this.redis.smembers(this.indexKey(userId, tenantId));
|
|
5287
|
-
this.
|
|
5390
|
+
const keptHash = await this.resolveLiveMember(members, currentSessionHash);
|
|
5288
5391
|
const rtMembers = members.filter((m) => m.startsWith("rt:"));
|
|
5289
5392
|
for (const member of rtMembers) {
|
|
5290
5393
|
const hash = member.slice(3);
|
|
5291
|
-
if (timingSafeCompare(hash,
|
|
5394
|
+
if (timingSafeCompare(hash, keptHash)) continue;
|
|
5292
5395
|
try {
|
|
5293
5396
|
await this.revokeSession({
|
|
5294
5397
|
userId,
|
|
@@ -5409,13 +5512,33 @@ var SessionService = class _SessionService {
|
|
|
5409
5512
|
}
|
|
5410
5513
|
}
|
|
5411
5514
|
/**
|
|
5412
|
-
*
|
|
5515
|
+
* The hash of the live refresh session `sessionHash` stands for within `members`.
|
|
5413
5516
|
*
|
|
5414
5517
|
* @throws {@link AuthException} `SESSION_NOT_FOUND`.
|
|
5415
5518
|
*/
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5519
|
+
async resolveLiveMember(members, sessionHash) {
|
|
5520
|
+
if (this.isLiveMember(members, sessionHash)) return sessionHash;
|
|
5521
|
+
const successor = await this.graceSuccessor(sessionHash);
|
|
5522
|
+
if (successor !== void 0 && this.isLiveMember(members, successor)) return successor;
|
|
5523
|
+
throw new AuthException(AUTH_ERROR_CODES.SESSION_NOT_FOUND);
|
|
5524
|
+
}
|
|
5525
|
+
/** Whether `members` holds a live refresh session with this hash. */
|
|
5526
|
+
isLiveMember(members, sessionHash) {
|
|
5527
|
+
return members.some((member) => member.startsWith("rt:") && timingSafeCompare(member.slice(3), sessionHash));
|
|
5528
|
+
}
|
|
5529
|
+
/**
|
|
5530
|
+
* The successor hash a rotation grace pointer names, or `undefined` when there is none.
|
|
5531
|
+
*
|
|
5532
|
+
* The pointer's value is `{successorHash}:{record}`, split on the first colon exactly as the
|
|
5533
|
+
* rotation script writes it.
|
|
5534
|
+
*/
|
|
5535
|
+
async graceSuccessor(sessionHash) {
|
|
5536
|
+
const pointer = await this.redis.get(`rp:${sessionHash}`);
|
|
5537
|
+
if (pointer === null) return void 0;
|
|
5538
|
+
const separator = pointer.indexOf(":");
|
|
5539
|
+
if (separator < 0) return void 0;
|
|
5540
|
+
const successor = pointer.slice(0, separator);
|
|
5541
|
+
return SESSION_HASH_RE.test(successor) ? successor : void 0;
|
|
5419
5542
|
}
|
|
5420
5543
|
/**
|
|
5421
5544
|
* The Redis key of this user's session index.
|
|
@@ -5460,28 +5583,18 @@ var SessionService = class _SessionService {
|
|
|
5460
5583
|
const rtMembers = members.filter((m) => m.startsWith("rt:"));
|
|
5461
5584
|
const limit = await this.resolveSessionLimit(userId, tenantId);
|
|
5462
5585
|
if (rtMembers.length <= limit) return;
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
try {
|
|
5467
|
-
const raw = await this.redis.get(`sd:${memberHash}`);
|
|
5468
|
-
if (raw !== null) {
|
|
5469
|
-
const parsed = JSON.parse(raw);
|
|
5470
|
-
if (
|
|
5471
|
-
// Stryker disable next-line ConditionalExpression: defensive `parsed !== null` guard masked by the surrounding try/catch fallback, yielding the same result
|
|
5472
|
-
parsed !== null && typeof parsed === "object" && "createdAt" in parsed && typeof parsed["createdAt"] === "number"
|
|
5473
|
-
) {
|
|
5474
|
-
createdAt = parsed.createdAt;
|
|
5475
|
-
}
|
|
5476
|
-
}
|
|
5477
|
-
} catch {
|
|
5478
|
-
}
|
|
5479
|
-
return {
|
|
5586
|
+
let withTimestamps;
|
|
5587
|
+
try {
|
|
5588
|
+
withTimestamps = await Promise.all(rtMembers.map(async (member) => ({
|
|
5480
5589
|
member,
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5590
|
+
// member is "rt:{hash}" — extract just the hash portion.
|
|
5591
|
+
memberHash: member.slice(3),
|
|
5592
|
+
createdAt: await this.readCreatedAt(member.slice(3))
|
|
5593
|
+
})));
|
|
5594
|
+
} catch (err) {
|
|
5595
|
+
this.logger.error(`enforceSessionLimit: eviction skipped for user ${logSafe(userId)}, a session record could not be read: ${describeChannelStatus(err)}`);
|
|
5596
|
+
return;
|
|
5597
|
+
}
|
|
5485
5598
|
withTimestamps.sort((a, b) => a.createdAt - b.createdAt);
|
|
5486
5599
|
const evictCount = rtMembers.length - limit;
|
|
5487
5600
|
const toEvict = withTimestamps.filter((entry) => entry.memberHash !== newHash).slice(0, evictCount);
|
|
@@ -5510,6 +5623,29 @@ var SessionService = class _SessionService {
|
|
|
5510
5623
|
}
|
|
5511
5624
|
}
|
|
5512
5625
|
/**
|
|
5626
|
+
* The creation time of a session, for ranking sessions by age.
|
|
5627
|
+
*
|
|
5628
|
+
* An absent record and one that is not a detail record both rank as `0`, the oldest: a state the
|
|
5629
|
+
* store reported, not a fault. A read the store fails propagates, because no age can be named.
|
|
5630
|
+
*
|
|
5631
|
+
* @param memberHash - SHA-256 hash of the session's refresh token.
|
|
5632
|
+
*/
|
|
5633
|
+
async readCreatedAt(memberHash) {
|
|
5634
|
+
const raw = await this.redis.get(`sd:${memberHash}`);
|
|
5635
|
+
if (raw === null) return 0;
|
|
5636
|
+
try {
|
|
5637
|
+
const parsed = JSON.parse(raw);
|
|
5638
|
+
if (
|
|
5639
|
+
// Stryker disable next-line ConditionalExpression: defensive `parsed !== null` guard masked by the surrounding try/catch fallback, yielding the same result
|
|
5640
|
+
parsed !== null && typeof parsed === "object" && "createdAt" in parsed && typeof parsed["createdAt"] === "number"
|
|
5641
|
+
) {
|
|
5642
|
+
return parsed.createdAt;
|
|
5643
|
+
}
|
|
5644
|
+
} catch {
|
|
5645
|
+
}
|
|
5646
|
+
return 0;
|
|
5647
|
+
}
|
|
5648
|
+
/**
|
|
5513
5649
|
* Resolves the maximum number of concurrent sessions allowed for a user.
|
|
5514
5650
|
*
|
|
5515
5651
|
* When `options.sessions.maxSessionsResolver` is configured, it is called with
|
|
@@ -5552,15 +5688,15 @@ var SessionService = class _SessionService {
|
|
|
5552
5688
|
}
|
|
5553
5689
|
}
|
|
5554
5690
|
};
|
|
5555
|
-
SessionService =
|
|
5691
|
+
SessionService = _ts_decorate18([
|
|
5556
5692
|
Injectable(),
|
|
5557
5693
|
_ts_param12(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
5558
5694
|
_ts_param12(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
5559
5695
|
_ts_param12(2, Inject(BYMAX_AUTH_HOOKS)),
|
|
5560
5696
|
_ts_param12(2, Optional()),
|
|
5561
5697
|
_ts_param12(3, Inject(AuthRedisService)),
|
|
5562
|
-
|
|
5563
|
-
|
|
5698
|
+
_ts_metadata17("design:type", Function),
|
|
5699
|
+
_ts_metadata17("design:paramtypes", [
|
|
5564
5700
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
5565
5701
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
5566
5702
|
Object,
|
|
@@ -5583,7 +5719,7 @@ function ownerFragment(ownerId) {
|
|
|
5583
5719
|
__name(ownerFragment, "ownerFragment");
|
|
5584
5720
|
|
|
5585
5721
|
// src/server/services/token-manager.service.ts
|
|
5586
|
-
function
|
|
5722
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
5587
5723
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5588
5724
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
5589
5725
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -5596,13 +5732,13 @@ function _ts_decorate18(decorators, target, key, desc) {
|
|
|
5596
5732
|
}
|
|
5597
5733
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5598
5734
|
}
|
|
5599
|
-
__name(
|
|
5600
|
-
function
|
|
5735
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
5736
|
+
function _ts_metadata18(metadataKey, metadataValue) {
|
|
5601
5737
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
5602
5738
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
5603
5739
|
}
|
|
5604
5740
|
}
|
|
5605
|
-
__name(
|
|
5741
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
5606
5742
|
function _ts_param13(paramIndex, decorator) {
|
|
5607
5743
|
return function(target, key) {
|
|
5608
5744
|
decorator(target, key, paramIndex);
|
|
@@ -6512,15 +6648,15 @@ var TokenManagerService = class _TokenManagerService {
|
|
|
6512
6648
|
return await this.redis.del(`mfa:${sha256(jti)}`);
|
|
6513
6649
|
}
|
|
6514
6650
|
};
|
|
6515
|
-
TokenManagerService =
|
|
6651
|
+
TokenManagerService = _ts_decorate19([
|
|
6516
6652
|
Injectable(),
|
|
6517
6653
|
_ts_param13(0, Inject(JwtService)),
|
|
6518
6654
|
_ts_param13(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
6519
6655
|
_ts_param13(2, Inject(AuthRedisService)),
|
|
6520
6656
|
_ts_param13(3, Inject(BYMAX_AUTH_HOOKS)),
|
|
6521
6657
|
_ts_param13(3, Optional()),
|
|
6522
|
-
|
|
6523
|
-
|
|
6658
|
+
_ts_metadata18("design:type", Function),
|
|
6659
|
+
_ts_metadata18("design:paramtypes", [
|
|
6524
6660
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
6525
6661
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
6526
6662
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -6528,6 +6664,18 @@ TokenManagerService = _ts_decorate18([
|
|
|
6528
6664
|
])
|
|
6529
6665
|
], TokenManagerService);
|
|
6530
6666
|
|
|
6667
|
+
// src/server/constants/logout-pending.ts
|
|
6668
|
+
var LOGOUT_PENDING_MIN_TTL_SECONDS = 300;
|
|
6669
|
+
function logoutPendingKey(plane, sessionHash) {
|
|
6670
|
+
return `${plane === "dashboard" ? "lp" : "plp"}:${sessionHash}`;
|
|
6671
|
+
}
|
|
6672
|
+
__name(logoutPendingKey, "logoutPendingKey");
|
|
6673
|
+
function logoutPendingTtlSeconds(accessExpiresIn) {
|
|
6674
|
+
const lifetime = accessExpiresIn === void 0 ? void 0 : durationToSeconds(accessExpiresIn);
|
|
6675
|
+
return Math.max(LOGOUT_PENDING_MIN_TTL_SECONDS, Math.ceil(lifetime ?? 0));
|
|
6676
|
+
}
|
|
6677
|
+
__name(logoutPendingTtlSeconds, "logoutPendingTtlSeconds");
|
|
6678
|
+
|
|
6531
6679
|
// src/server/utils/mask-email.ts
|
|
6532
6680
|
function maskEmail(email) {
|
|
6533
6681
|
const atIndex = email.indexOf("@");
|
|
@@ -6542,6 +6690,29 @@ function normalizeEmail(email) {
|
|
|
6542
6690
|
}
|
|
6543
6691
|
__name(normalizeEmail, "normalizeEmail");
|
|
6544
6692
|
|
|
6693
|
+
// src/server/utils/pending-logout.ts
|
|
6694
|
+
async function rememberPendingLogout(redis, key, owner, ttlSeconds, logger) {
|
|
6695
|
+
try {
|
|
6696
|
+
await redis.set(key, JSON.stringify({
|
|
6697
|
+
userId: owner.userId,
|
|
6698
|
+
tenantId: owner.tenantId
|
|
6699
|
+
}), ttlSeconds);
|
|
6700
|
+
} catch (err) {
|
|
6701
|
+
logger.warn(`logout: the owner could not be kept for a retry \u2014 ${describeChannelStatus(err)}`);
|
|
6702
|
+
}
|
|
6703
|
+
}
|
|
6704
|
+
__name(rememberPendingLogout, "rememberPendingLogout");
|
|
6705
|
+
async function settlePendingLogout(redis, key, fromSession, logger) {
|
|
6706
|
+
try {
|
|
6707
|
+
const removed = await redis.del(key);
|
|
6708
|
+
return fromSession || removed;
|
|
6709
|
+
} catch (err) {
|
|
6710
|
+
logger.warn(`logout: the retry marker could not be cleared \u2014 ${describeChannelStatus(err)}`);
|
|
6711
|
+
return fromSession;
|
|
6712
|
+
}
|
|
6713
|
+
}
|
|
6714
|
+
__name(settlePendingLogout, "settlePendingLogout");
|
|
6715
|
+
|
|
6545
6716
|
// src/server/utils/resolve-tenant-id.ts
|
|
6546
6717
|
async function resolveTenantId(dtoTenantId, req, resolver) {
|
|
6547
6718
|
if (resolver) {
|
|
@@ -6588,7 +6759,7 @@ function tenantScoped(user, tenantId) {
|
|
|
6588
6759
|
__name(tenantScoped, "tenantScoped");
|
|
6589
6760
|
|
|
6590
6761
|
// src/server/services/auth.service.ts
|
|
6591
|
-
function
|
|
6762
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
6592
6763
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6593
6764
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
6594
6765
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6601,13 +6772,13 @@ function _ts_decorate19(decorators, target, key, desc) {
|
|
|
6601
6772
|
}
|
|
6602
6773
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6603
6774
|
}
|
|
6604
|
-
__name(
|
|
6605
|
-
function
|
|
6775
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
6776
|
+
function _ts_metadata19(metadataKey, metadataValue) {
|
|
6606
6777
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
6607
6778
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
6608
6779
|
}
|
|
6609
6780
|
}
|
|
6610
|
-
__name(
|
|
6781
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
6611
6782
|
function _ts_param14(paramIndex, decorator) {
|
|
6612
6783
|
return function(target, key) {
|
|
6613
6784
|
decorator(target, key, paramIndex);
|
|
@@ -6982,39 +7153,83 @@ var AuthService = class _AuthService {
|
|
|
6982
7153
|
*/
|
|
6983
7154
|
async logout(accessToken, rawRefreshToken) {
|
|
6984
7155
|
const sessionHash = sha256(rawRefreshToken);
|
|
6985
|
-
const
|
|
7156
|
+
const markerKey = logoutPendingKey("dashboard", sessionHash);
|
|
7157
|
+
const live = await this.redis.readSessionOwner(`rt:${sessionHash}`);
|
|
7158
|
+
const fromSession = live.userId !== "";
|
|
7159
|
+
const { userId, tenantId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
|
|
6986
7160
|
this.logger.log(`logout: userId=${logSafe(userId || "(no live session)")}`);
|
|
6987
|
-
|
|
7161
|
+
const failures = await settleWrites([
|
|
7162
|
+
...this.blacklistWrites(accessToken),
|
|
7163
|
+
() => this.redis.del(`rt:${sessionHash}`),
|
|
7164
|
+
() => this.redis.del(`rp:${sessionHash}`)
|
|
7165
|
+
]);
|
|
7166
|
+
await this.revokeSessionMetadata(userId, tenantId, sessionHash);
|
|
7167
|
+
if (failures.length > 0 && fromSession) {
|
|
7168
|
+
await rememberPendingLogout(this.redis, markerKey, {
|
|
7169
|
+
userId,
|
|
7170
|
+
tenantId
|
|
7171
|
+
}, logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn), this.logger);
|
|
7172
|
+
}
|
|
7173
|
+
raiseFirst(failures);
|
|
7174
|
+
if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, this.logger)) {
|
|
7175
|
+
this.emitLogout(userId, tenantId);
|
|
7176
|
+
}
|
|
7177
|
+
return userId;
|
|
7178
|
+
}
|
|
7179
|
+
/**
|
|
7180
|
+
* The access-token blacklist write for a logout, or none when there is nothing to revoke.
|
|
7181
|
+
*
|
|
7182
|
+
* Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
|
|
7183
|
+
* forged one must not blacklist an id it does not own. Only the verification is tolerant.
|
|
7184
|
+
*
|
|
7185
|
+
* @param accessToken - Raw access token; absent, malformed or expired yields no write.
|
|
7186
|
+
* @returns The writes to hand to `settleWrites`.
|
|
7187
|
+
*/
|
|
7188
|
+
blacklistWrites(accessToken) {
|
|
6988
7189
|
try {
|
|
6989
7190
|
const payload = this.tokenManager.verifyIgnoringExpiry(accessToken);
|
|
6990
7191
|
const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
|
|
6991
7192
|
if (remainingTtl > 0) {
|
|
6992
|
-
|
|
7193
|
+
return [
|
|
6993
7194
|
() => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
|
|
6994
7195
|
];
|
|
6995
7196
|
}
|
|
6996
7197
|
} catch {
|
|
6997
7198
|
}
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7199
|
+
return [];
|
|
7200
|
+
}
|
|
7201
|
+
/**
|
|
7202
|
+
* Cleans up the session's metadata through `SessionService.revokeSession()`.
|
|
7203
|
+
*
|
|
7204
|
+
* It performs an atomic SISMEMBER ownership check before deleting `sd:{hash}` and SREMing from
|
|
7205
|
+
* `sess:{userId}`. The `rt:{hash}` DEL already ran — revokeSession's internal DEL is a no-op
|
|
7206
|
+
* (Redis DEL is idempotent when the key is absent). SESSION_NOT_FOUND means the session was
|
|
7207
|
+
* evicted, already revoked, or the refresh token does not belong to this user — in all cases
|
|
7208
|
+
* authentication is already invalidated.
|
|
7209
|
+
*
|
|
7210
|
+
* The tenant is REQUIRED to name the index, and it comes off the record rather than from the
|
|
7211
|
+
* caller. A record without one is a pre-upgrade write: the contract lists `tenantId` among the
|
|
7212
|
+
* refresh session's fields, so a live record always has it. Skipping the call is the honest end
|
|
7213
|
+
* for one that does not — `rt:{hash}` is already deleted, so the session is dead either way, and
|
|
7214
|
+
* guessing a tenant would name an index belonging to nobody while reading like a revocation that
|
|
7215
|
+
* happened.
|
|
7216
|
+
*
|
|
7217
|
+
* @param userId - The owner, empty when none is known.
|
|
7218
|
+
* @param tenantId - The owner's tenant, absent when the record carried none.
|
|
7219
|
+
* @param sessionHash - The SHA-256 of the raw refresh token.
|
|
7220
|
+
*/
|
|
7221
|
+
async revokeSessionMetadata(userId, tenantId, sessionHash) {
|
|
7222
|
+
if (!this.options.sessions.enabled || !userId || tenantId === void 0) return;
|
|
7223
|
+
await this.sessionService.revokeSession({
|
|
7224
|
+
userId,
|
|
7225
|
+
tenantId,
|
|
7226
|
+
sessionHash
|
|
7227
|
+
}).catch((err) => {
|
|
7228
|
+
const errCode = err instanceof AuthException ? err.getResponse().error.code : void 0;
|
|
7229
|
+
if (errCode !== AUTH_ERROR_CODES.SESSION_NOT_FOUND) {
|
|
7230
|
+
this.logger.warn(`logout: session cleanup failed \u2014 ${describeChannelStatus(err)}`);
|
|
7231
|
+
}
|
|
7232
|
+
});
|
|
7018
7233
|
}
|
|
7019
7234
|
/**
|
|
7020
7235
|
* Announces a completed logout, the only hook `AuthService.logout` emits.
|
|
@@ -7604,7 +7819,7 @@ var AuthService = class _AuthService {
|
|
|
7604
7819
|
})();
|
|
7605
7820
|
}
|
|
7606
7821
|
};
|
|
7607
|
-
AuthService =
|
|
7822
|
+
AuthService = _ts_decorate20([
|
|
7608
7823
|
Injectable(),
|
|
7609
7824
|
_ts_param14(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7610
7825
|
_ts_param14(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -7619,8 +7834,8 @@ AuthService = _ts_decorate19([
|
|
|
7619
7834
|
_ts_param14(8, Inject(OtpService)),
|
|
7620
7835
|
_ts_param14(9, Inject(SessionService)),
|
|
7621
7836
|
_ts_param14(10, Inject(AccountStatusService)),
|
|
7622
|
-
|
|
7623
|
-
|
|
7837
|
+
_ts_metadata19("design:type", Function),
|
|
7838
|
+
_ts_metadata19("design:paramtypes", [
|
|
7624
7839
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
7625
7840
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
7626
7841
|
Object,
|
|
@@ -7644,7 +7859,7 @@ __name(toSafeUser2, "toSafeUser");
|
|
|
7644
7859
|
var WS_TICKET_TTL_SECONDS = 30;
|
|
7645
7860
|
|
|
7646
7861
|
// src/server/services/ws-ticket.service.ts
|
|
7647
|
-
function
|
|
7862
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
7648
7863
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7649
7864
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7650
7865
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -7657,13 +7872,13 @@ function _ts_decorate20(decorators, target, key, desc) {
|
|
|
7657
7872
|
}
|
|
7658
7873
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7659
7874
|
}
|
|
7660
|
-
__name(
|
|
7661
|
-
function
|
|
7875
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
7876
|
+
function _ts_metadata20(metadataKey, metadataValue) {
|
|
7662
7877
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7663
7878
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
7664
7879
|
}
|
|
7665
7880
|
}
|
|
7666
|
-
__name(
|
|
7881
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
7667
7882
|
function _ts_param15(paramIndex, decorator) {
|
|
7668
7883
|
return function(target, key) {
|
|
7669
7884
|
decorator(target, key, paramIndex);
|
|
@@ -7803,14 +8018,14 @@ var WsTicketService = class _WsTicketService {
|
|
|
7803
8018
|
return snapshot;
|
|
7804
8019
|
}
|
|
7805
8020
|
};
|
|
7806
|
-
WsTicketService =
|
|
8021
|
+
WsTicketService = _ts_decorate21([
|
|
7807
8022
|
Injectable(),
|
|
7808
8023
|
_ts_param15(0, Inject(AuthRedisService)),
|
|
7809
8024
|
_ts_param15(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
7810
8025
|
_ts_param15(2, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
7811
8026
|
_ts_param15(3, Inject(AuthRevocationService)),
|
|
7812
|
-
|
|
7813
|
-
|
|
8027
|
+
_ts_metadata20("design:type", Function),
|
|
8028
|
+
_ts_metadata20("design:paramtypes", [
|
|
7814
8029
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
7815
8030
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
7816
8031
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
@@ -7819,7 +8034,7 @@ WsTicketService = _ts_decorate20([
|
|
|
7819
8034
|
], WsTicketService);
|
|
7820
8035
|
|
|
7821
8036
|
// src/server/controllers/auth.controller.ts
|
|
7822
|
-
function
|
|
8037
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
7823
8038
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7824
8039
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
7825
8040
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -7832,13 +8047,13 @@ function _ts_decorate21(decorators, target, key, desc) {
|
|
|
7832
8047
|
}
|
|
7833
8048
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7834
8049
|
}
|
|
7835
|
-
__name(
|
|
7836
|
-
function
|
|
8050
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
8051
|
+
function _ts_metadata21(metadataKey, metadataValue) {
|
|
7837
8052
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
7838
8053
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
7839
8054
|
}
|
|
7840
8055
|
}
|
|
7841
|
-
__name(
|
|
8056
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
7842
8057
|
function _ts_param16(paramIndex, decorator) {
|
|
7843
8058
|
return function(target, key) {
|
|
7844
8059
|
decorator(target, key, paramIndex);
|
|
@@ -7997,7 +8212,7 @@ var AuthController = class {
|
|
|
7997
8212
|
await this.authService.resendVerificationEmail(dto.tenantId, dto.email, req);
|
|
7998
8213
|
}
|
|
7999
8214
|
};
|
|
8000
|
-
|
|
8215
|
+
_ts_decorate22([
|
|
8001
8216
|
Public(),
|
|
8002
8217
|
Throttle(AUTH_THROTTLE_CONFIGS.register),
|
|
8003
8218
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.register),
|
|
@@ -8007,15 +8222,15 @@ _ts_decorate21([
|
|
|
8007
8222
|
_ts_param16(2, Res({
|
|
8008
8223
|
passthrough: true
|
|
8009
8224
|
})),
|
|
8010
|
-
|
|
8011
|
-
|
|
8225
|
+
_ts_metadata21("design:type", Function),
|
|
8226
|
+
_ts_metadata21("design:paramtypes", [
|
|
8012
8227
|
typeof RegisterDto === "undefined" ? Object : RegisterDto,
|
|
8013
8228
|
typeof Request === "undefined" ? Object : Request,
|
|
8014
8229
|
typeof Response === "undefined" ? Object : Response
|
|
8015
8230
|
]),
|
|
8016
|
-
|
|
8231
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8017
8232
|
], AuthController.prototype, "register", null);
|
|
8018
|
-
|
|
8233
|
+
_ts_decorate22([
|
|
8019
8234
|
Public(),
|
|
8020
8235
|
Throttle(AUTH_THROTTLE_CONFIGS.login),
|
|
8021
8236
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.login),
|
|
@@ -8026,72 +8241,75 @@ _ts_decorate21([
|
|
|
8026
8241
|
_ts_param16(2, Res({
|
|
8027
8242
|
passthrough: true
|
|
8028
8243
|
})),
|
|
8029
|
-
|
|
8030
|
-
|
|
8244
|
+
_ts_metadata21("design:type", Function),
|
|
8245
|
+
_ts_metadata21("design:paramtypes", [
|
|
8031
8246
|
typeof LoginDto === "undefined" ? Object : LoginDto,
|
|
8032
8247
|
typeof Request === "undefined" ? Object : Request,
|
|
8033
8248
|
typeof Response === "undefined" ? Object : Response
|
|
8034
8249
|
]),
|
|
8035
|
-
|
|
8250
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8036
8251
|
], AuthController.prototype, "login", null);
|
|
8037
|
-
|
|
8252
|
+
_ts_decorate22([
|
|
8038
8253
|
Public(),
|
|
8039
8254
|
Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
8040
8255
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
8041
8256
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
8257
|
+
RequestEncoding("unchecked"),
|
|
8042
8258
|
Post("logout"),
|
|
8043
8259
|
_ts_param16(0, Req()),
|
|
8044
8260
|
_ts_param16(1, Res({
|
|
8045
8261
|
passthrough: true
|
|
8046
8262
|
})),
|
|
8047
|
-
|
|
8048
|
-
|
|
8263
|
+
_ts_metadata21("design:type", Function),
|
|
8264
|
+
_ts_metadata21("design:paramtypes", [
|
|
8049
8265
|
typeof Request === "undefined" ? Object : Request,
|
|
8050
8266
|
typeof Response === "undefined" ? Object : Response
|
|
8051
8267
|
]),
|
|
8052
|
-
|
|
8268
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8053
8269
|
], AuthController.prototype, "logout", null);
|
|
8054
|
-
|
|
8270
|
+
_ts_decorate22([
|
|
8055
8271
|
Public(),
|
|
8056
8272
|
Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
8057
8273
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
8058
8274
|
HttpCode(HttpStatus.OK),
|
|
8275
|
+
RequestEncoding("unchecked"),
|
|
8059
8276
|
Post("refresh"),
|
|
8060
8277
|
_ts_param16(0, Req()),
|
|
8061
8278
|
_ts_param16(1, Res({
|
|
8062
8279
|
passthrough: true
|
|
8063
8280
|
})),
|
|
8064
|
-
|
|
8065
|
-
|
|
8281
|
+
_ts_metadata21("design:type", Function),
|
|
8282
|
+
_ts_metadata21("design:paramtypes", [
|
|
8066
8283
|
typeof Request === "undefined" ? Object : Request,
|
|
8067
8284
|
typeof Response === "undefined" ? Object : Response
|
|
8068
8285
|
]),
|
|
8069
|
-
|
|
8286
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8070
8287
|
], AuthController.prototype, "refresh", null);
|
|
8071
|
-
|
|
8288
|
+
_ts_decorate22([
|
|
8072
8289
|
UseGuards(JwtAuthGuard),
|
|
8073
8290
|
Get("me"),
|
|
8074
8291
|
_ts_param16(0, CurrentUser()),
|
|
8075
|
-
|
|
8076
|
-
|
|
8292
|
+
_ts_metadata21("design:type", Function),
|
|
8293
|
+
_ts_metadata21("design:paramtypes", [
|
|
8077
8294
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
8078
8295
|
]),
|
|
8079
|
-
|
|
8296
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8080
8297
|
], AuthController.prototype, "me", null);
|
|
8081
|
-
|
|
8298
|
+
_ts_decorate22([
|
|
8082
8299
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
8083
8300
|
Throttle(AUTH_THROTTLE_CONFIGS.wsTicket),
|
|
8084
8301
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.wsTicket),
|
|
8302
|
+
RequestEncoding("unchecked"),
|
|
8085
8303
|
Post("ws-ticket"),
|
|
8086
8304
|
HttpCode(HttpStatus.OK),
|
|
8087
8305
|
_ts_param16(0, CurrentUser()),
|
|
8088
|
-
|
|
8089
|
-
|
|
8306
|
+
_ts_metadata21("design:type", Function),
|
|
8307
|
+
_ts_metadata21("design:paramtypes", [
|
|
8090
8308
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
8091
8309
|
]),
|
|
8092
|
-
|
|
8310
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8093
8311
|
], AuthController.prototype, "wsTicket", null);
|
|
8094
|
-
|
|
8312
|
+
_ts_decorate22([
|
|
8095
8313
|
Public(),
|
|
8096
8314
|
Throttle(AUTH_THROTTLE_CONFIGS.verifyEmail),
|
|
8097
8315
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyEmail),
|
|
@@ -8099,14 +8317,14 @@ _ts_decorate21([
|
|
|
8099
8317
|
Post("verify-email"),
|
|
8100
8318
|
_ts_param16(0, Body()),
|
|
8101
8319
|
_ts_param16(1, Req()),
|
|
8102
|
-
|
|
8103
|
-
|
|
8320
|
+
_ts_metadata21("design:type", Function),
|
|
8321
|
+
_ts_metadata21("design:paramtypes", [
|
|
8104
8322
|
typeof VerifyEmailDto === "undefined" ? Object : VerifyEmailDto,
|
|
8105
8323
|
typeof Request === "undefined" ? Object : Request
|
|
8106
8324
|
]),
|
|
8107
|
-
|
|
8325
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8108
8326
|
], AuthController.prototype, "verifyEmail", null);
|
|
8109
|
-
|
|
8327
|
+
_ts_decorate22([
|
|
8110
8328
|
Public(),
|
|
8111
8329
|
Throttle(AUTH_THROTTLE_CONFIGS.resendVerification),
|
|
8112
8330
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendVerification),
|
|
@@ -8114,29 +8332,29 @@ _ts_decorate21([
|
|
|
8114
8332
|
Post("resend-verification"),
|
|
8115
8333
|
_ts_param16(0, Body()),
|
|
8116
8334
|
_ts_param16(1, Req()),
|
|
8117
|
-
|
|
8118
|
-
|
|
8335
|
+
_ts_metadata21("design:type", Function),
|
|
8336
|
+
_ts_metadata21("design:paramtypes", [
|
|
8119
8337
|
typeof ResendVerificationDto === "undefined" ? Object : ResendVerificationDto,
|
|
8120
8338
|
typeof Request === "undefined" ? Object : Request
|
|
8121
8339
|
]),
|
|
8122
|
-
|
|
8340
|
+
_ts_metadata21("design:returntype", Promise)
|
|
8123
8341
|
], AuthController.prototype, "resendVerification", null);
|
|
8124
|
-
AuthController =
|
|
8342
|
+
AuthController = _ts_decorate22([
|
|
8125
8343
|
UseInterceptors(NoStoreInterceptor),
|
|
8126
8344
|
Controller(),
|
|
8127
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
8345
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
8128
8346
|
UsePipes(createAuthValidationPipe()),
|
|
8129
8347
|
_ts_param16(0, Inject(AuthService)),
|
|
8130
8348
|
_ts_param16(1, Inject(TokenDeliveryService)),
|
|
8131
8349
|
_ts_param16(2, Inject(WsTicketService)),
|
|
8132
|
-
|
|
8133
|
-
|
|
8350
|
+
_ts_metadata21("design:type", Function),
|
|
8351
|
+
_ts_metadata21("design:paramtypes", [
|
|
8134
8352
|
typeof AuthService === "undefined" ? Object : AuthService,
|
|
8135
8353
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
8136
8354
|
typeof WsTicketService === "undefined" ? Object : WsTicketService
|
|
8137
8355
|
])
|
|
8138
8356
|
], AuthController);
|
|
8139
|
-
function
|
|
8357
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
8140
8358
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8141
8359
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8142
8360
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8149,13 +8367,13 @@ function _ts_decorate22(decorators, target, key, desc) {
|
|
|
8149
8367
|
}
|
|
8150
8368
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8151
8369
|
}
|
|
8152
|
-
__name(
|
|
8153
|
-
function
|
|
8370
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
8371
|
+
function _ts_metadata22(metadataKey, metadataValue) {
|
|
8154
8372
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8155
8373
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8156
8374
|
}
|
|
8157
8375
|
}
|
|
8158
|
-
__name(
|
|
8376
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
8159
8377
|
var ChangeEmailDto = class {
|
|
8160
8378
|
static {
|
|
8161
8379
|
__name(this, "ChangeEmailDto");
|
|
@@ -8175,20 +8393,20 @@ var ChangeEmailDto = class {
|
|
|
8175
8393
|
*/
|
|
8176
8394
|
currentPassword;
|
|
8177
8395
|
};
|
|
8178
|
-
|
|
8396
|
+
_ts_decorate23([
|
|
8179
8397
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
8180
8398
|
IsEmail(),
|
|
8181
8399
|
IsNotEmpty(),
|
|
8182
8400
|
MaxLength(255),
|
|
8183
|
-
|
|
8401
|
+
_ts_metadata22("design:type", String)
|
|
8184
8402
|
], ChangeEmailDto.prototype, "newEmail", void 0);
|
|
8185
|
-
|
|
8403
|
+
_ts_decorate23([
|
|
8186
8404
|
IsString(),
|
|
8187
8405
|
MinLength(1),
|
|
8188
8406
|
MaxLength(128),
|
|
8189
|
-
|
|
8407
|
+
_ts_metadata22("design:type", String)
|
|
8190
8408
|
], ChangeEmailDto.prototype, "currentPassword", void 0);
|
|
8191
|
-
function
|
|
8409
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
8192
8410
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8193
8411
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8194
8412
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8201,13 +8419,13 @@ function _ts_decorate23(decorators, target, key, desc) {
|
|
|
8201
8419
|
}
|
|
8202
8420
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8203
8421
|
}
|
|
8204
|
-
__name(
|
|
8205
|
-
function
|
|
8422
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
8423
|
+
function _ts_metadata23(metadataKey, metadataValue) {
|
|
8206
8424
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8207
8425
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8208
8426
|
}
|
|
8209
8427
|
}
|
|
8210
|
-
__name(
|
|
8428
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
8211
8429
|
var ConfirmEmailChangeDto = class {
|
|
8212
8430
|
static {
|
|
8213
8431
|
__name(this, "ConfirmEmailChangeDto");
|
|
@@ -8220,13 +8438,13 @@ var ConfirmEmailChangeDto = class {
|
|
|
8220
8438
|
*/
|
|
8221
8439
|
token;
|
|
8222
8440
|
};
|
|
8223
|
-
|
|
8441
|
+
_ts_decorate24([
|
|
8224
8442
|
IsString(),
|
|
8225
8443
|
IsNotEmpty(),
|
|
8226
8444
|
Length(64, 64),
|
|
8227
|
-
|
|
8445
|
+
_ts_metadata23("design:type", String)
|
|
8228
8446
|
], ConfirmEmailChangeDto.prototype, "token", void 0);
|
|
8229
|
-
function
|
|
8447
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
8230
8448
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8231
8449
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8232
8450
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8239,13 +8457,13 @@ function _ts_decorate24(decorators, target, key, desc) {
|
|
|
8239
8457
|
}
|
|
8240
8458
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8241
8459
|
}
|
|
8242
|
-
__name(
|
|
8243
|
-
function
|
|
8460
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
8461
|
+
function _ts_metadata24(metadataKey, metadataValue) {
|
|
8244
8462
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8245
8463
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8246
8464
|
}
|
|
8247
8465
|
}
|
|
8248
|
-
__name(
|
|
8466
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
8249
8467
|
function _ts_param17(paramIndex, decorator) {
|
|
8250
8468
|
return function(target, key) {
|
|
8251
8469
|
decorator(target, key, paramIndex);
|
|
@@ -8483,7 +8701,7 @@ var EmailChangeService = class _EmailChangeService {
|
|
|
8483
8701
|
}
|
|
8484
8702
|
}
|
|
8485
8703
|
};
|
|
8486
|
-
EmailChangeService =
|
|
8704
|
+
EmailChangeService = _ts_decorate25([
|
|
8487
8705
|
Injectable(),
|
|
8488
8706
|
_ts_param17(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
8489
8707
|
_ts_param17(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -8491,8 +8709,8 @@ EmailChangeService = _ts_decorate24([
|
|
|
8491
8709
|
_ts_param17(3, Inject(PasswordService)),
|
|
8492
8710
|
_ts_param17(4, Inject(AuthRedisService)),
|
|
8493
8711
|
_ts_param17(5, Inject(BruteForceService)),
|
|
8494
|
-
|
|
8495
|
-
|
|
8712
|
+
_ts_metadata24("design:type", Function),
|
|
8713
|
+
_ts_metadata24("design:paramtypes", [
|
|
8496
8714
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
8497
8715
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
8498
8716
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
@@ -8503,7 +8721,7 @@ EmailChangeService = _ts_decorate24([
|
|
|
8503
8721
|
], EmailChangeService);
|
|
8504
8722
|
|
|
8505
8723
|
// src/server/controllers/email-change.controller.ts
|
|
8506
|
-
function
|
|
8724
|
+
function _ts_decorate26(decorators, target, key, desc) {
|
|
8507
8725
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8508
8726
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8509
8727
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8516,13 +8734,13 @@ function _ts_decorate25(decorators, target, key, desc) {
|
|
|
8516
8734
|
}
|
|
8517
8735
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8518
8736
|
}
|
|
8519
|
-
__name(
|
|
8520
|
-
function
|
|
8737
|
+
__name(_ts_decorate26, "_ts_decorate");
|
|
8738
|
+
function _ts_metadata25(metadataKey, metadataValue) {
|
|
8521
8739
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8522
8740
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8523
8741
|
}
|
|
8524
8742
|
}
|
|
8525
|
-
__name(
|
|
8743
|
+
__name(_ts_metadata25, "_ts_metadata");
|
|
8526
8744
|
function _ts_param18(paramIndex, decorator) {
|
|
8527
8745
|
return function(target, key) {
|
|
8528
8746
|
decorator(target, key, paramIndex);
|
|
@@ -8575,7 +8793,7 @@ var EmailChangeController = class {
|
|
|
8575
8793
|
await this.emailChangeService.confirmChange(dto);
|
|
8576
8794
|
}
|
|
8577
8795
|
};
|
|
8578
|
-
|
|
8796
|
+
_ts_decorate26([
|
|
8579
8797
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
8580
8798
|
Throttle(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
|
|
8581
8799
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeRequest),
|
|
@@ -8583,38 +8801,38 @@ _ts_decorate25([
|
|
|
8583
8801
|
Post("change"),
|
|
8584
8802
|
_ts_param18(0, Body()),
|
|
8585
8803
|
_ts_param18(1, CurrentUser()),
|
|
8586
|
-
|
|
8587
|
-
|
|
8804
|
+
_ts_metadata25("design:type", Function),
|
|
8805
|
+
_ts_metadata25("design:paramtypes", [
|
|
8588
8806
|
typeof ChangeEmailDto === "undefined" ? Object : ChangeEmailDto,
|
|
8589
8807
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
8590
8808
|
]),
|
|
8591
|
-
|
|
8809
|
+
_ts_metadata25("design:returntype", Promise)
|
|
8592
8810
|
], EmailChangeController.prototype, "requestChange", null);
|
|
8593
|
-
|
|
8811
|
+
_ts_decorate26([
|
|
8594
8812
|
Public(),
|
|
8595
8813
|
Throttle(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
|
|
8596
8814
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.emailChangeConfirm),
|
|
8597
8815
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
8598
8816
|
Post("change/confirm"),
|
|
8599
8817
|
_ts_param18(0, Body()),
|
|
8600
|
-
|
|
8601
|
-
|
|
8818
|
+
_ts_metadata25("design:type", Function),
|
|
8819
|
+
_ts_metadata25("design:paramtypes", [
|
|
8602
8820
|
typeof ConfirmEmailChangeDto === "undefined" ? Object : ConfirmEmailChangeDto
|
|
8603
8821
|
]),
|
|
8604
|
-
|
|
8822
|
+
_ts_metadata25("design:returntype", Promise)
|
|
8605
8823
|
], EmailChangeController.prototype, "confirmChange", null);
|
|
8606
|
-
EmailChangeController =
|
|
8824
|
+
EmailChangeController = _ts_decorate26([
|
|
8607
8825
|
UseInterceptors(NoStoreInterceptor),
|
|
8608
8826
|
Controller("email"),
|
|
8609
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
8827
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
8610
8828
|
UsePipes(createAuthValidationPipe()),
|
|
8611
8829
|
_ts_param18(0, Inject(EmailChangeService)),
|
|
8612
|
-
|
|
8613
|
-
|
|
8830
|
+
_ts_metadata25("design:type", Function),
|
|
8831
|
+
_ts_metadata25("design:paramtypes", [
|
|
8614
8832
|
typeof EmailChangeService === "undefined" ? Object : EmailChangeService
|
|
8615
8833
|
])
|
|
8616
8834
|
], EmailChangeController);
|
|
8617
|
-
function
|
|
8835
|
+
function _ts_decorate27(decorators, target, key, desc) {
|
|
8618
8836
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8619
8837
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8620
8838
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8627,13 +8845,13 @@ function _ts_decorate26(decorators, target, key, desc) {
|
|
|
8627
8845
|
}
|
|
8628
8846
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8629
8847
|
}
|
|
8630
|
-
__name(
|
|
8631
|
-
function
|
|
8848
|
+
__name(_ts_decorate27, "_ts_decorate");
|
|
8849
|
+
function _ts_metadata26(metadataKey, metadataValue) {
|
|
8632
8850
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8633
8851
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8634
8852
|
}
|
|
8635
8853
|
}
|
|
8636
|
-
__name(
|
|
8854
|
+
__name(_ts_metadata26, "_ts_metadata");
|
|
8637
8855
|
var AcceptInvitationDto = class {
|
|
8638
8856
|
static {
|
|
8639
8857
|
__name(this, "AcceptInvitationDto");
|
|
@@ -8672,24 +8890,24 @@ var AcceptInvitationDto = class {
|
|
|
8672
8890
|
*/
|
|
8673
8891
|
password;
|
|
8674
8892
|
};
|
|
8675
|
-
|
|
8893
|
+
_ts_decorate27([
|
|
8676
8894
|
IsString(),
|
|
8677
8895
|
IsNotEmpty(),
|
|
8678
8896
|
Length(64, 64),
|
|
8679
|
-
|
|
8897
|
+
_ts_metadata26("design:type", String)
|
|
8680
8898
|
], AcceptInvitationDto.prototype, "token", void 0);
|
|
8681
|
-
|
|
8899
|
+
_ts_decorate27([
|
|
8682
8900
|
IsString(),
|
|
8683
8901
|
IsNotEmpty(),
|
|
8684
8902
|
Length(2, 100),
|
|
8685
|
-
|
|
8903
|
+
_ts_metadata26("design:type", String)
|
|
8686
8904
|
], AcceptInvitationDto.prototype, "name", void 0);
|
|
8687
|
-
|
|
8905
|
+
_ts_decorate27([
|
|
8688
8906
|
IsString(),
|
|
8689
8907
|
Length(8, 128),
|
|
8690
|
-
|
|
8908
|
+
_ts_metadata26("design:type", String)
|
|
8691
8909
|
], AcceptInvitationDto.prototype, "password", void 0);
|
|
8692
|
-
function
|
|
8910
|
+
function _ts_decorate28(decorators, target, key, desc) {
|
|
8693
8911
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8694
8912
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8695
8913
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8702,13 +8920,13 @@ function _ts_decorate27(decorators, target, key, desc) {
|
|
|
8702
8920
|
}
|
|
8703
8921
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8704
8922
|
}
|
|
8705
|
-
__name(
|
|
8706
|
-
function
|
|
8923
|
+
__name(_ts_decorate28, "_ts_decorate");
|
|
8924
|
+
function _ts_metadata27(metadataKey, metadataValue) {
|
|
8707
8925
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8708
8926
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8709
8927
|
}
|
|
8710
8928
|
}
|
|
8711
|
-
__name(
|
|
8929
|
+
__name(_ts_metadata27, "_ts_metadata");
|
|
8712
8930
|
var CreateInvitationDto = class {
|
|
8713
8931
|
static {
|
|
8714
8932
|
__name(this, "CreateInvitationDto");
|
|
@@ -8739,27 +8957,27 @@ var CreateInvitationDto = class {
|
|
|
8739
8957
|
*/
|
|
8740
8958
|
tenantName;
|
|
8741
8959
|
};
|
|
8742
|
-
|
|
8960
|
+
_ts_decorate28([
|
|
8743
8961
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
8744
8962
|
IsEmail(),
|
|
8745
8963
|
IsNotEmpty(),
|
|
8746
8964
|
MaxLength(255),
|
|
8747
|
-
|
|
8965
|
+
_ts_metadata27("design:type", String)
|
|
8748
8966
|
], CreateInvitationDto.prototype, "email", void 0);
|
|
8749
|
-
|
|
8967
|
+
_ts_decorate28([
|
|
8750
8968
|
IsString(),
|
|
8751
8969
|
IsNotEmpty(),
|
|
8752
8970
|
MaxLength(64),
|
|
8753
|
-
|
|
8971
|
+
_ts_metadata27("design:type", String)
|
|
8754
8972
|
], CreateInvitationDto.prototype, "role", void 0);
|
|
8755
|
-
|
|
8973
|
+
_ts_decorate28([
|
|
8756
8974
|
IsOptional(),
|
|
8757
8975
|
IsString(),
|
|
8758
8976
|
IsNotEmpty(),
|
|
8759
8977
|
MaxLength(128),
|
|
8760
|
-
|
|
8978
|
+
_ts_metadata27("design:type", String)
|
|
8761
8979
|
], CreateInvitationDto.prototype, "tenantName", void 0);
|
|
8762
|
-
function
|
|
8980
|
+
function _ts_decorate29(decorators, target, key, desc) {
|
|
8763
8981
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8764
8982
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8765
8983
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8772,13 +8990,13 @@ function _ts_decorate28(decorators, target, key, desc) {
|
|
|
8772
8990
|
}
|
|
8773
8991
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8774
8992
|
}
|
|
8775
|
-
__name(
|
|
8776
|
-
function
|
|
8993
|
+
__name(_ts_decorate29, "_ts_decorate");
|
|
8994
|
+
function _ts_metadata28(metadataKey, metadataValue) {
|
|
8777
8995
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8778
8996
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8779
8997
|
}
|
|
8780
8998
|
}
|
|
8781
|
-
__name(
|
|
8999
|
+
__name(_ts_metadata28, "_ts_metadata");
|
|
8782
9000
|
var RevokeInvitationDto = class {
|
|
8783
9001
|
static {
|
|
8784
9002
|
__name(this, "RevokeInvitationDto");
|
|
@@ -8790,14 +9008,14 @@ var RevokeInvitationDto = class {
|
|
|
8790
9008
|
*/
|
|
8791
9009
|
email;
|
|
8792
9010
|
};
|
|
8793
|
-
|
|
9011
|
+
_ts_decorate29([
|
|
8794
9012
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
8795
9013
|
IsEmail(),
|
|
8796
9014
|
IsNotEmpty(),
|
|
8797
9015
|
MaxLength(255),
|
|
8798
|
-
|
|
9016
|
+
_ts_metadata28("design:type", String)
|
|
8799
9017
|
], RevokeInvitationDto.prototype, "email", void 0);
|
|
8800
|
-
function
|
|
9018
|
+
function _ts_decorate30(decorators, target, key, desc) {
|
|
8801
9019
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8802
9020
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
8803
9021
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8810,13 +9028,13 @@ function _ts_decorate29(decorators, target, key, desc) {
|
|
|
8810
9028
|
}
|
|
8811
9029
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8812
9030
|
}
|
|
8813
|
-
__name(
|
|
8814
|
-
function
|
|
9031
|
+
__name(_ts_decorate30, "_ts_decorate");
|
|
9032
|
+
function _ts_metadata29(metadataKey, metadataValue) {
|
|
8815
9033
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
8816
9034
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
8817
9035
|
}
|
|
8818
9036
|
}
|
|
8819
|
-
__name(
|
|
9037
|
+
__name(_ts_metadata29, "_ts_metadata");
|
|
8820
9038
|
function _ts_param19(paramIndex, decorator) {
|
|
8821
9039
|
return function(target, key) {
|
|
8822
9040
|
decorator(target, key, paramIndex);
|
|
@@ -9299,7 +9517,7 @@ var InvitationService = class _InvitationService {
|
|
|
9299
9517
|
return result;
|
|
9300
9518
|
}
|
|
9301
9519
|
};
|
|
9302
|
-
InvitationService =
|
|
9520
|
+
InvitationService = _ts_decorate30([
|
|
9303
9521
|
Injectable(),
|
|
9304
9522
|
_ts_param19(0, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
9305
9523
|
_ts_param19(1, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
@@ -9309,8 +9527,8 @@ InvitationService = _ts_decorate29([
|
|
|
9309
9527
|
_ts_param19(5, Inject(SessionService)),
|
|
9310
9528
|
_ts_param19(6, Inject(TokenManagerService)),
|
|
9311
9529
|
_ts_param19(7, Inject(BYMAX_AUTH_OPTIONS)),
|
|
9312
|
-
|
|
9313
|
-
|
|
9530
|
+
_ts_metadata29("design:type", Function),
|
|
9531
|
+
_ts_metadata29("design:paramtypes", [
|
|
9314
9532
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
9315
9533
|
typeof IEmailProvider === "undefined" ? Object : IEmailProvider,
|
|
9316
9534
|
typeof IAuthHooks === "undefined" ? Object : IAuthHooks,
|
|
@@ -9323,7 +9541,7 @@ InvitationService = _ts_decorate29([
|
|
|
9323
9541
|
], InvitationService);
|
|
9324
9542
|
|
|
9325
9543
|
// src/server/controllers/invitation.controller.ts
|
|
9326
|
-
function
|
|
9544
|
+
function _ts_decorate31(decorators, target, key, desc) {
|
|
9327
9545
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9328
9546
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9329
9547
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9336,13 +9554,13 @@ function _ts_decorate30(decorators, target, key, desc) {
|
|
|
9336
9554
|
}
|
|
9337
9555
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9338
9556
|
}
|
|
9339
|
-
__name(
|
|
9340
|
-
function
|
|
9557
|
+
__name(_ts_decorate31, "_ts_decorate");
|
|
9558
|
+
function _ts_metadata30(metadataKey, metadataValue) {
|
|
9341
9559
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9342
9560
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9343
9561
|
}
|
|
9344
9562
|
}
|
|
9345
|
-
__name(
|
|
9563
|
+
__name(_ts_metadata30, "_ts_metadata");
|
|
9346
9564
|
function _ts_param20(paramIndex, decorator) {
|
|
9347
9565
|
return function(target, key) {
|
|
9348
9566
|
decorator(target, key, paramIndex);
|
|
@@ -9424,7 +9642,7 @@ var InvitationController = class {
|
|
|
9424
9642
|
return this.tokenDelivery.deliverAuthResponse(res, result, req);
|
|
9425
9643
|
}
|
|
9426
9644
|
};
|
|
9427
|
-
|
|
9645
|
+
_ts_decorate31([
|
|
9428
9646
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
9429
9647
|
Throttle(AUTH_THROTTLE_CONFIGS.invitationCreate),
|
|
9430
9648
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationCreate),
|
|
@@ -9432,14 +9650,14 @@ _ts_decorate30([
|
|
|
9432
9650
|
Post(),
|
|
9433
9651
|
_ts_param20(0, Body()),
|
|
9434
9652
|
_ts_param20(1, CurrentUser()),
|
|
9435
|
-
|
|
9436
|
-
|
|
9653
|
+
_ts_metadata30("design:type", Function),
|
|
9654
|
+
_ts_metadata30("design:paramtypes", [
|
|
9437
9655
|
typeof CreateInvitationDto === "undefined" ? Object : CreateInvitationDto,
|
|
9438
9656
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
9439
9657
|
]),
|
|
9440
|
-
|
|
9658
|
+
_ts_metadata30("design:returntype", Promise)
|
|
9441
9659
|
], InvitationController.prototype, "invite", null);
|
|
9442
|
-
|
|
9660
|
+
_ts_decorate31([
|
|
9443
9661
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
9444
9662
|
Throttle(AUTH_THROTTLE_CONFIGS.invitationRevoke),
|
|
9445
9663
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationRevoke),
|
|
@@ -9447,14 +9665,14 @@ _ts_decorate30([
|
|
|
9447
9665
|
Post("revoke"),
|
|
9448
9666
|
_ts_param20(0, Body()),
|
|
9449
9667
|
_ts_param20(1, CurrentUser()),
|
|
9450
|
-
|
|
9451
|
-
|
|
9668
|
+
_ts_metadata30("design:type", Function),
|
|
9669
|
+
_ts_metadata30("design:paramtypes", [
|
|
9452
9670
|
typeof RevokeInvitationDto === "undefined" ? Object : RevokeInvitationDto,
|
|
9453
9671
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload
|
|
9454
9672
|
]),
|
|
9455
|
-
|
|
9673
|
+
_ts_metadata30("design:returntype", Promise)
|
|
9456
9674
|
], InvitationController.prototype, "revoke", null);
|
|
9457
|
-
|
|
9675
|
+
_ts_decorate31([
|
|
9458
9676
|
Public(),
|
|
9459
9677
|
Throttle(AUTH_THROTTLE_CONFIGS.invitationAccept),
|
|
9460
9678
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.invitationAccept),
|
|
@@ -9465,23 +9683,23 @@ _ts_decorate30([
|
|
|
9465
9683
|
_ts_param20(2, Res({
|
|
9466
9684
|
passthrough: true
|
|
9467
9685
|
})),
|
|
9468
|
-
|
|
9469
|
-
|
|
9686
|
+
_ts_metadata30("design:type", Function),
|
|
9687
|
+
_ts_metadata30("design:paramtypes", [
|
|
9470
9688
|
typeof AcceptInvitationDto === "undefined" ? Object : AcceptInvitationDto,
|
|
9471
9689
|
typeof Request === "undefined" ? Object : Request,
|
|
9472
9690
|
typeof Response === "undefined" ? Object : Response
|
|
9473
9691
|
]),
|
|
9474
|
-
|
|
9692
|
+
_ts_metadata30("design:returntype", Promise)
|
|
9475
9693
|
], InvitationController.prototype, "accept", null);
|
|
9476
|
-
InvitationController =
|
|
9694
|
+
InvitationController = _ts_decorate31([
|
|
9477
9695
|
UseInterceptors(NoStoreInterceptor),
|
|
9478
9696
|
Controller("invitations"),
|
|
9479
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
9697
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
9480
9698
|
UsePipes(createAuthValidationPipe()),
|
|
9481
9699
|
_ts_param20(0, Inject(InvitationService)),
|
|
9482
9700
|
_ts_param20(1, Inject(TokenDeliveryService)),
|
|
9483
|
-
|
|
9484
|
-
|
|
9701
|
+
_ts_metadata30("design:type", Function),
|
|
9702
|
+
_ts_metadata30("design:paramtypes", [
|
|
9485
9703
|
typeof InvitationService === "undefined" ? Object : InvitationService,
|
|
9486
9704
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
9487
9705
|
])
|
|
@@ -9492,7 +9710,7 @@ var MFA_TEMP_COOKIE_NAME = "mfa_temp_token";
|
|
|
9492
9710
|
var MFA_TEMP_COOKIE_MAX_AGE_SECONDS = 300;
|
|
9493
9711
|
var SKIP_MFA_KEY = /* @__PURE__ */ Symbol("skipMfa");
|
|
9494
9712
|
var SkipMfa = /* @__PURE__ */ __name(() => SetMetadata(SKIP_MFA_KEY, true), "SkipMfa");
|
|
9495
|
-
function
|
|
9713
|
+
function _ts_decorate32(decorators, target, key, desc) {
|
|
9496
9714
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9497
9715
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9498
9716
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9505,13 +9723,13 @@ function _ts_decorate31(decorators, target, key, desc) {
|
|
|
9505
9723
|
}
|
|
9506
9724
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9507
9725
|
}
|
|
9508
|
-
__name(
|
|
9509
|
-
function
|
|
9726
|
+
__name(_ts_decorate32, "_ts_decorate");
|
|
9727
|
+
function _ts_metadata31(metadataKey, metadataValue) {
|
|
9510
9728
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9511
9729
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9512
9730
|
}
|
|
9513
9731
|
}
|
|
9514
|
-
__name(
|
|
9732
|
+
__name(_ts_metadata31, "_ts_metadata");
|
|
9515
9733
|
var MfaChallengeDto = class {
|
|
9516
9734
|
static {
|
|
9517
9735
|
__name(this, "MfaChallengeDto");
|
|
@@ -9547,23 +9765,23 @@ var MfaChallengeDto = class {
|
|
|
9547
9765
|
*/
|
|
9548
9766
|
code;
|
|
9549
9767
|
};
|
|
9550
|
-
|
|
9768
|
+
_ts_decorate32([
|
|
9551
9769
|
IsOptional(),
|
|
9552
9770
|
IsString(),
|
|
9553
9771
|
IsNotEmpty(),
|
|
9554
9772
|
MaxLength(512),
|
|
9555
|
-
|
|
9773
|
+
_ts_metadata31("design:type", String)
|
|
9556
9774
|
], MfaChallengeDto.prototype, "mfaTempToken", void 0);
|
|
9557
|
-
|
|
9775
|
+
_ts_decorate32([
|
|
9558
9776
|
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})$/, {
|
|
9559
9777
|
message: "code must be a 6-digit TOTP code or a recovery code in XXXX-XXXX-XXXX-XXXX-XXXX-XXXX format"
|
|
9560
9778
|
}),
|
|
9561
9779
|
IsString(),
|
|
9562
9780
|
IsNotEmpty(),
|
|
9563
9781
|
MaxLength(29),
|
|
9564
|
-
|
|
9782
|
+
_ts_metadata31("design:type", String)
|
|
9565
9783
|
], MfaChallengeDto.prototype, "code", void 0);
|
|
9566
|
-
function
|
|
9784
|
+
function _ts_decorate33(decorators, target, key, desc) {
|
|
9567
9785
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9568
9786
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9569
9787
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9576,13 +9794,13 @@ function _ts_decorate32(decorators, target, key, desc) {
|
|
|
9576
9794
|
}
|
|
9577
9795
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9578
9796
|
}
|
|
9579
|
-
__name(
|
|
9580
|
-
function
|
|
9797
|
+
__name(_ts_decorate33, "_ts_decorate");
|
|
9798
|
+
function _ts_metadata32(metadataKey, metadataValue) {
|
|
9581
9799
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9582
9800
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9583
9801
|
}
|
|
9584
9802
|
}
|
|
9585
|
-
__name(
|
|
9803
|
+
__name(_ts_metadata32, "_ts_metadata");
|
|
9586
9804
|
var MfaDisableDto = class {
|
|
9587
9805
|
static {
|
|
9588
9806
|
__name(this, "MfaDisableDto");
|
|
@@ -9596,16 +9814,16 @@ var MfaDisableDto = class {
|
|
|
9596
9814
|
*/
|
|
9597
9815
|
code;
|
|
9598
9816
|
};
|
|
9599
|
-
|
|
9817
|
+
_ts_decorate33([
|
|
9600
9818
|
MaxLength(6),
|
|
9601
9819
|
Matches(/^\d{6}$/, {
|
|
9602
9820
|
message: "code must be exactly 6 digits"
|
|
9603
9821
|
}),
|
|
9604
9822
|
IsString(),
|
|
9605
9823
|
IsNotEmpty(),
|
|
9606
|
-
|
|
9824
|
+
_ts_metadata32("design:type", String)
|
|
9607
9825
|
], MfaDisableDto.prototype, "code", void 0);
|
|
9608
|
-
function
|
|
9826
|
+
function _ts_decorate34(decorators, target, key, desc) {
|
|
9609
9827
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9610
9828
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9611
9829
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9618,13 +9836,13 @@ function _ts_decorate33(decorators, target, key, desc) {
|
|
|
9618
9836
|
}
|
|
9619
9837
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9620
9838
|
}
|
|
9621
|
-
__name(
|
|
9622
|
-
function
|
|
9839
|
+
__name(_ts_decorate34, "_ts_decorate");
|
|
9840
|
+
function _ts_metadata33(metadataKey, metadataValue) {
|
|
9623
9841
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9624
9842
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9625
9843
|
}
|
|
9626
9844
|
}
|
|
9627
|
-
__name(
|
|
9845
|
+
__name(_ts_metadata33, "_ts_metadata");
|
|
9628
9846
|
var MfaRegenerateRecoveryCodesDto = class {
|
|
9629
9847
|
static {
|
|
9630
9848
|
__name(this, "MfaRegenerateRecoveryCodesDto");
|
|
@@ -9638,16 +9856,16 @@ var MfaRegenerateRecoveryCodesDto = class {
|
|
|
9638
9856
|
*/
|
|
9639
9857
|
code;
|
|
9640
9858
|
};
|
|
9641
|
-
|
|
9859
|
+
_ts_decorate34([
|
|
9642
9860
|
MaxLength(6),
|
|
9643
9861
|
Matches(/^\d{6}$/, {
|
|
9644
9862
|
message: "code must be exactly 6 digits"
|
|
9645
9863
|
}),
|
|
9646
9864
|
IsString(),
|
|
9647
9865
|
IsNotEmpty(),
|
|
9648
|
-
|
|
9866
|
+
_ts_metadata33("design:type", String)
|
|
9649
9867
|
], MfaRegenerateRecoveryCodesDto.prototype, "code", void 0);
|
|
9650
|
-
function
|
|
9868
|
+
function _ts_decorate35(decorators, target, key, desc) {
|
|
9651
9869
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9652
9870
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9653
9871
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9660,13 +9878,13 @@ function _ts_decorate34(decorators, target, key, desc) {
|
|
|
9660
9878
|
}
|
|
9661
9879
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9662
9880
|
}
|
|
9663
|
-
__name(
|
|
9664
|
-
function
|
|
9881
|
+
__name(_ts_decorate35, "_ts_decorate");
|
|
9882
|
+
function _ts_metadata34(metadataKey, metadataValue) {
|
|
9665
9883
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9666
9884
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9667
9885
|
}
|
|
9668
9886
|
}
|
|
9669
|
-
__name(
|
|
9887
|
+
__name(_ts_metadata34, "_ts_metadata");
|
|
9670
9888
|
var MfaSetupDto = class {
|
|
9671
9889
|
static {
|
|
9672
9890
|
__name(this, "MfaSetupDto");
|
|
@@ -9690,14 +9908,14 @@ var MfaSetupDto = class {
|
|
|
9690
9908
|
*/
|
|
9691
9909
|
password;
|
|
9692
9910
|
};
|
|
9693
|
-
|
|
9911
|
+
_ts_decorate35([
|
|
9694
9912
|
IsOptional(),
|
|
9695
9913
|
IsString(),
|
|
9696
9914
|
MinLength(1),
|
|
9697
9915
|
MaxLength(128),
|
|
9698
|
-
|
|
9916
|
+
_ts_metadata34("design:type", String)
|
|
9699
9917
|
], MfaSetupDto.prototype, "password", void 0);
|
|
9700
|
-
function
|
|
9918
|
+
function _ts_decorate36(decorators, target, key, desc) {
|
|
9701
9919
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9702
9920
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9703
9921
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9710,13 +9928,13 @@ function _ts_decorate35(decorators, target, key, desc) {
|
|
|
9710
9928
|
}
|
|
9711
9929
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9712
9930
|
}
|
|
9713
|
-
__name(
|
|
9714
|
-
function
|
|
9931
|
+
__name(_ts_decorate36, "_ts_decorate");
|
|
9932
|
+
function _ts_metadata35(metadataKey, metadataValue) {
|
|
9715
9933
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9716
9934
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9717
9935
|
}
|
|
9718
9936
|
}
|
|
9719
|
-
__name(
|
|
9937
|
+
__name(_ts_metadata35, "_ts_metadata");
|
|
9720
9938
|
var MfaVerifyDto = class {
|
|
9721
9939
|
static {
|
|
9722
9940
|
__name(this, "MfaVerifyDto");
|
|
@@ -9729,14 +9947,14 @@ var MfaVerifyDto = class {
|
|
|
9729
9947
|
*/
|
|
9730
9948
|
code;
|
|
9731
9949
|
};
|
|
9732
|
-
|
|
9950
|
+
_ts_decorate36([
|
|
9733
9951
|
MaxLength(6),
|
|
9734
9952
|
Matches(/^\d{6}$/, {
|
|
9735
9953
|
message: "code must be exactly 6 digits"
|
|
9736
9954
|
}),
|
|
9737
9955
|
IsString(),
|
|
9738
9956
|
IsNotEmpty(),
|
|
9739
|
-
|
|
9957
|
+
_ts_metadata35("design:type", String)
|
|
9740
9958
|
], MfaVerifyDto.prototype, "code", void 0);
|
|
9741
9959
|
var IV_LENGTH = 12;
|
|
9742
9960
|
var AUTH_TAG_BYTE_LENGTH = 16;
|
|
@@ -9800,7 +10018,7 @@ function runDetached(logger, run, failure) {
|
|
|
9800
10018
|
__name(runDetached, "runDetached");
|
|
9801
10019
|
|
|
9802
10020
|
// src/server/services/mfa.service.ts
|
|
9803
|
-
function
|
|
10021
|
+
function _ts_decorate37(decorators, target, key, desc) {
|
|
9804
10022
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9805
10023
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
9806
10024
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9813,13 +10031,13 @@ function _ts_decorate36(decorators, target, key, desc) {
|
|
|
9813
10031
|
}
|
|
9814
10032
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9815
10033
|
}
|
|
9816
|
-
__name(
|
|
9817
|
-
function
|
|
10034
|
+
__name(_ts_decorate37, "_ts_decorate");
|
|
10035
|
+
function _ts_metadata36(metadataKey, metadataValue) {
|
|
9818
10036
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
9819
10037
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
9820
10038
|
}
|
|
9821
10039
|
}
|
|
9822
|
-
__name(
|
|
10040
|
+
__name(_ts_metadata36, "_ts_metadata");
|
|
9823
10041
|
function _ts_param21(paramIndex, decorator) {
|
|
9824
10042
|
return function(target, key) {
|
|
9825
10043
|
decorator(target, key, paramIndex);
|
|
@@ -9901,29 +10119,28 @@ var MfaService = class _MfaService {
|
|
|
9901
10119
|
* Detached from the challenge it follows: the user is already authenticated and the retired
|
|
9902
10120
|
* key still opens the secret, so a failure here costs the migration and nothing else.
|
|
9903
10121
|
*
|
|
10122
|
+
* The write replaces the whole MFA record, so it runs as a serialized transition and lands only
|
|
10123
|
+
* on a record that still holds this secret. One that no longer does was disabled or re-enrolled
|
|
10124
|
+
* since, and writing the re-encrypted old secret over it would restore a factor the user removed
|
|
10125
|
+
* and unspend the recovery codes they replaced. The comparison is on the decrypted secret, not
|
|
10126
|
+
* the ciphertext: a sibling challenge that only re-encrypted the same secret changes the
|
|
10127
|
+
* ciphertext and nothing else, and must not be mistaken for a re-enrolment.
|
|
10128
|
+
*
|
|
9904
10129
|
* @param userId - The account whose stored secret is being re-encrypted.
|
|
9905
10130
|
* @param context - Which identity plane the account belongs to.
|
|
9906
10131
|
* @param secretBase32 - The decrypted secret.
|
|
9907
|
-
* @param recoveryCodes - The stored recovery digests, written back unchanged.
|
|
9908
10132
|
* @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
|
|
9909
10133
|
*/
|
|
9910
|
-
async reencryptSecret(userId, context, secretBase32,
|
|
9911
|
-
const update = {
|
|
9912
|
-
mfaEnabled: true,
|
|
9913
|
-
mfaSecret: this.encryptSecret(secretBase32),
|
|
9914
|
-
mfaRecoveryCodes: recoveryCodes
|
|
9915
|
-
};
|
|
10134
|
+
async reencryptSecret(userId, context, secretBase32, tenantId) {
|
|
9916
10135
|
try {
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
});
|
|
9926
|
-
}
|
|
10136
|
+
await this.transitionMfaRecord(context, userId, tenantId, (current) => {
|
|
10137
|
+
if (!current.mfaEnabled || !this.holdsSecret(current.mfaSecret, secretBase32)) return null;
|
|
10138
|
+
return {
|
|
10139
|
+
mfaEnabled: true,
|
|
10140
|
+
mfaSecret: this.encryptSecret(secretBase32),
|
|
10141
|
+
mfaRecoveryCodes: current.mfaRecoveryCodes ?? []
|
|
10142
|
+
};
|
|
10143
|
+
});
|
|
9927
10144
|
} catch (err) {
|
|
9928
10145
|
this.logger.error(`re-encryption under the current MFA key failed: ${describeChannelStatus(err)}`);
|
|
9929
10146
|
}
|
|
@@ -10017,6 +10234,20 @@ var MfaService = class _MfaService {
|
|
|
10017
10234
|
}
|
|
10018
10235
|
}
|
|
10019
10236
|
/**
|
|
10237
|
+
* Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
|
|
10238
|
+
*
|
|
10239
|
+
* Compares plaintext, so a record that was only re-encrypted still matches and one holding a
|
|
10240
|
+
* different secret does not. A ciphertext no key opens does not match either.
|
|
10241
|
+
*/
|
|
10242
|
+
holdsSecret(stored, secretBase32) {
|
|
10243
|
+
if (!stored) return false;
|
|
10244
|
+
try {
|
|
10245
|
+
return timingSafeCompare(this.decryptWithRotation(stored).secret, secretBase32);
|
|
10246
|
+
} catch {
|
|
10247
|
+
return false;
|
|
10248
|
+
}
|
|
10249
|
+
}
|
|
10250
|
+
/**
|
|
10020
10251
|
* Encrypts a TOTP secret for storage in the database using AES-256-GCM.
|
|
10021
10252
|
*/
|
|
10022
10253
|
encryptSecret(secret) {
|
|
@@ -10467,6 +10698,7 @@ var MfaService = class _MfaService {
|
|
|
10467
10698
|
[];
|
|
10468
10699
|
await this.transitionMfaRecord(context, userId, tenantId, (current) => {
|
|
10469
10700
|
if (!current.mfaEnabled) return null;
|
|
10701
|
+
if (!this.holdsSecret(current.mfaSecret, secretBase32)) return null;
|
|
10470
10702
|
const currentCodes = current.mfaRecoveryCodes ?? [];
|
|
10471
10703
|
const spentDigest = existingCodes[usedRecoveryIndex] ?? "";
|
|
10472
10704
|
const liveIndex = currentCodes.indexOf(spentDigest);
|
|
@@ -10484,7 +10716,7 @@ var MfaService = class _MfaService {
|
|
|
10484
10716
|
};
|
|
10485
10717
|
});
|
|
10486
10718
|
} else if (encryptedUnderRetiredKey) {
|
|
10487
|
-
void this.reencryptSecret(userId, context, secretBase32,
|
|
10719
|
+
void this.reencryptSecret(userId, context, secretBase32, tenantId);
|
|
10488
10720
|
}
|
|
10489
10721
|
this.logger.log(`challenge: MFA challenge passed userId=${logSafe(userId)} context=${context}`);
|
|
10490
10722
|
if (context === "dashboard") {
|
|
@@ -11049,7 +11281,7 @@ var MfaService = class _MfaService {
|
|
|
11049
11281
|
return admin;
|
|
11050
11282
|
}
|
|
11051
11283
|
};
|
|
11052
|
-
MfaService =
|
|
11284
|
+
MfaService = _ts_decorate37([
|
|
11053
11285
|
Injectable(),
|
|
11054
11286
|
_ts_param21(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
11055
11287
|
_ts_param21(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -11062,8 +11294,8 @@ MfaService = _ts_decorate36([
|
|
|
11062
11294
|
_ts_param21(7, Inject(SessionService)),
|
|
11063
11295
|
_ts_param21(8, Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
11064
11296
|
_ts_param21(9, Inject(BYMAX_AUTH_HOOKS)),
|
|
11065
|
-
|
|
11066
|
-
|
|
11297
|
+
_ts_metadata36("design:type", Function),
|
|
11298
|
+
_ts_metadata36("design:paramtypes", [
|
|
11067
11299
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
11068
11300
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
11069
11301
|
Object,
|
|
@@ -11078,7 +11310,7 @@ MfaService = _ts_decorate36([
|
|
|
11078
11310
|
], MfaService);
|
|
11079
11311
|
|
|
11080
11312
|
// src/server/controllers/mfa.controller.ts
|
|
11081
|
-
function
|
|
11313
|
+
function _ts_decorate38(decorators, target, key, desc) {
|
|
11082
11314
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11083
11315
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11084
11316
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11091,13 +11323,13 @@ function _ts_decorate37(decorators, target, key, desc) {
|
|
|
11091
11323
|
}
|
|
11092
11324
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11093
11325
|
}
|
|
11094
|
-
__name(
|
|
11095
|
-
function
|
|
11326
|
+
__name(_ts_decorate38, "_ts_decorate");
|
|
11327
|
+
function _ts_metadata37(metadataKey, metadataValue) {
|
|
11096
11328
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11097
11329
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11098
11330
|
}
|
|
11099
11331
|
}
|
|
11100
|
-
__name(
|
|
11332
|
+
__name(_ts_metadata37, "_ts_metadata");
|
|
11101
11333
|
function _ts_param22(paramIndex, decorator) {
|
|
11102
11334
|
return function(target, key) {
|
|
11103
11335
|
decorator(target, key, paramIndex);
|
|
@@ -11292,21 +11524,22 @@ var MfaController = class {
|
|
|
11292
11524
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "dashboard", user.tenantId);
|
|
11293
11525
|
}
|
|
11294
11526
|
};
|
|
11295
|
-
|
|
11527
|
+
_ts_decorate38([
|
|
11296
11528
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11297
11529
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11298
11530
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
11531
|
+
RequestEncoding("when-body"),
|
|
11299
11532
|
Post("setup"),
|
|
11300
11533
|
_ts_param22(0, CurrentUser()),
|
|
11301
11534
|
_ts_param22(1, Body()),
|
|
11302
|
-
|
|
11303
|
-
|
|
11535
|
+
_ts_metadata37("design:type", Function),
|
|
11536
|
+
_ts_metadata37("design:paramtypes", [
|
|
11304
11537
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11305
11538
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
11306
11539
|
]),
|
|
11307
|
-
|
|
11540
|
+
_ts_metadata37("design:returntype", Promise)
|
|
11308
11541
|
], MfaController.prototype, "setup", null);
|
|
11309
|
-
|
|
11542
|
+
_ts_decorate38([
|
|
11310
11543
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11311
11544
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
11312
11545
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
@@ -11315,15 +11548,15 @@ _ts_decorate37([
|
|
|
11315
11548
|
_ts_param22(0, CurrentUser()),
|
|
11316
11549
|
_ts_param22(1, Body()),
|
|
11317
11550
|
_ts_param22(2, Req()),
|
|
11318
|
-
|
|
11319
|
-
|
|
11551
|
+
_ts_metadata37("design:type", Function),
|
|
11552
|
+
_ts_metadata37("design:paramtypes", [
|
|
11320
11553
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11321
11554
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
11322
11555
|
typeof Request === "undefined" ? Object : Request
|
|
11323
11556
|
]),
|
|
11324
|
-
|
|
11557
|
+
_ts_metadata37("design:returntype", Promise)
|
|
11325
11558
|
], MfaController.prototype, "verifyEnable", null);
|
|
11326
|
-
|
|
11559
|
+
_ts_decorate38([
|
|
11327
11560
|
Public(),
|
|
11328
11561
|
SkipMfa(),
|
|
11329
11562
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
@@ -11335,15 +11568,15 @@ _ts_decorate37([
|
|
|
11335
11568
|
_ts_param22(2, Res({
|
|
11336
11569
|
passthrough: true
|
|
11337
11570
|
})),
|
|
11338
|
-
|
|
11339
|
-
|
|
11571
|
+
_ts_metadata37("design:type", Function),
|
|
11572
|
+
_ts_metadata37("design:paramtypes", [
|
|
11340
11573
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
11341
11574
|
typeof Request === "undefined" ? Object : Request,
|
|
11342
11575
|
typeof Response === "undefined" ? Object : Response
|
|
11343
11576
|
]),
|
|
11344
|
-
|
|
11577
|
+
_ts_metadata37("design:returntype", Promise)
|
|
11345
11578
|
], MfaController.prototype, "challenge", null);
|
|
11346
|
-
|
|
11579
|
+
_ts_decorate38([
|
|
11347
11580
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11348
11581
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11349
11582
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
@@ -11352,15 +11585,15 @@ _ts_decorate37([
|
|
|
11352
11585
|
_ts_param22(0, CurrentUser()),
|
|
11353
11586
|
_ts_param22(1, Body()),
|
|
11354
11587
|
_ts_param22(2, Req()),
|
|
11355
|
-
|
|
11356
|
-
|
|
11588
|
+
_ts_metadata37("design:type", Function),
|
|
11589
|
+
_ts_metadata37("design:paramtypes", [
|
|
11357
11590
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11358
11591
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
11359
11592
|
typeof Request === "undefined" ? Object : Request
|
|
11360
11593
|
]),
|
|
11361
|
-
|
|
11594
|
+
_ts_metadata37("design:returntype", Promise)
|
|
11362
11595
|
], MfaController.prototype, "disable", null);
|
|
11363
|
-
|
|
11596
|
+
_ts_decorate38([
|
|
11364
11597
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
11365
11598
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
11366
11599
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
@@ -11369,33 +11602,33 @@ _ts_decorate37([
|
|
|
11369
11602
|
_ts_param22(0, CurrentUser()),
|
|
11370
11603
|
_ts_param22(1, Body()),
|
|
11371
11604
|
_ts_param22(2, Req()),
|
|
11372
|
-
|
|
11373
|
-
|
|
11605
|
+
_ts_metadata37("design:type", Function),
|
|
11606
|
+
_ts_metadata37("design:paramtypes", [
|
|
11374
11607
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
11375
11608
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
11376
11609
|
typeof Request === "undefined" ? Object : Request
|
|
11377
11610
|
]),
|
|
11378
|
-
|
|
11611
|
+
_ts_metadata37("design:returntype", Promise)
|
|
11379
11612
|
], MfaController.prototype, "regenerateRecoveryCodes", null);
|
|
11380
|
-
MfaController =
|
|
11613
|
+
MfaController = _ts_decorate38([
|
|
11381
11614
|
UseInterceptors(NoStoreInterceptor),
|
|
11382
11615
|
Controller("mfa"),
|
|
11383
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
11616
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
11384
11617
|
UsePipes(createAuthValidationPipe({
|
|
11385
11618
|
forbidUnknownValues: true
|
|
11386
11619
|
})),
|
|
11387
11620
|
_ts_param22(0, Inject(MfaService)),
|
|
11388
11621
|
_ts_param22(1, Inject(TokenDeliveryService)),
|
|
11389
11622
|
_ts_param22(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
11390
|
-
|
|
11391
|
-
|
|
11623
|
+
_ts_metadata37("design:type", Function),
|
|
11624
|
+
_ts_metadata37("design:paramtypes", [
|
|
11392
11625
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
11393
11626
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
11394
11627
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
11395
11628
|
])
|
|
11396
11629
|
], MfaController);
|
|
11397
11630
|
var Authenticated = /* @__PURE__ */ __name(() => SetMetadata(IS_PUBLIC_KEY, false), "Authenticated");
|
|
11398
|
-
function
|
|
11631
|
+
function _ts_decorate39(decorators, target, key, desc) {
|
|
11399
11632
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11400
11633
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11401
11634
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11408,13 +11641,13 @@ function _ts_decorate38(decorators, target, key, desc) {
|
|
|
11408
11641
|
}
|
|
11409
11642
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11410
11643
|
}
|
|
11411
|
-
__name(
|
|
11412
|
-
function
|
|
11644
|
+
__name(_ts_decorate39, "_ts_decorate");
|
|
11645
|
+
function _ts_metadata38(metadataKey, metadataValue) {
|
|
11413
11646
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11414
11647
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11415
11648
|
}
|
|
11416
11649
|
}
|
|
11417
|
-
__name(
|
|
11650
|
+
__name(_ts_metadata38, "_ts_metadata");
|
|
11418
11651
|
var ChangePasswordDto = class {
|
|
11419
11652
|
static {
|
|
11420
11653
|
__name(this, "ChangePasswordDto");
|
|
@@ -11467,26 +11700,26 @@ var ChangePasswordDto = class {
|
|
|
11467
11700
|
*/
|
|
11468
11701
|
refreshToken;
|
|
11469
11702
|
};
|
|
11470
|
-
|
|
11703
|
+
_ts_decorate39([
|
|
11471
11704
|
IsString(),
|
|
11472
11705
|
MinLength(1),
|
|
11473
11706
|
MaxLength(128),
|
|
11474
|
-
|
|
11707
|
+
_ts_metadata38("design:type", String)
|
|
11475
11708
|
], ChangePasswordDto.prototype, "currentPassword", void 0);
|
|
11476
|
-
|
|
11709
|
+
_ts_decorate39([
|
|
11477
11710
|
IsString(),
|
|
11478
11711
|
MinLength(8),
|
|
11479
11712
|
MaxLength(128),
|
|
11480
|
-
|
|
11713
|
+
_ts_metadata38("design:type", String)
|
|
11481
11714
|
], ChangePasswordDto.prototype, "newPassword", void 0);
|
|
11482
|
-
|
|
11715
|
+
_ts_decorate39([
|
|
11483
11716
|
IsOptional(),
|
|
11484
11717
|
IsString(),
|
|
11485
11718
|
IsNotEmpty(),
|
|
11486
11719
|
MaxLength(2048),
|
|
11487
|
-
|
|
11720
|
+
_ts_metadata38("design:type", String)
|
|
11488
11721
|
], ChangePasswordDto.prototype, "refreshToken", void 0);
|
|
11489
|
-
function
|
|
11722
|
+
function _ts_decorate40(decorators, target, key, desc) {
|
|
11490
11723
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11491
11724
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11492
11725
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11499,13 +11732,13 @@ function _ts_decorate39(decorators, target, key, desc) {
|
|
|
11499
11732
|
}
|
|
11500
11733
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11501
11734
|
}
|
|
11502
|
-
__name(
|
|
11503
|
-
function
|
|
11735
|
+
__name(_ts_decorate40, "_ts_decorate");
|
|
11736
|
+
function _ts_metadata39(metadataKey, metadataValue) {
|
|
11504
11737
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11505
11738
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11506
11739
|
}
|
|
11507
11740
|
}
|
|
11508
|
-
__name(
|
|
11741
|
+
__name(_ts_metadata39, "_ts_metadata");
|
|
11509
11742
|
var ForgotPasswordDto = class {
|
|
11510
11743
|
static {
|
|
11511
11744
|
__name(this, "ForgotPasswordDto");
|
|
@@ -11521,13 +11754,13 @@ var ForgotPasswordDto = class {
|
|
|
11521
11754
|
*/
|
|
11522
11755
|
tenantId;
|
|
11523
11756
|
};
|
|
11524
|
-
|
|
11757
|
+
_ts_decorate40([
|
|
11525
11758
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11526
11759
|
IsEmail(),
|
|
11527
11760
|
MaxLength(255),
|
|
11528
|
-
|
|
11761
|
+
_ts_metadata39("design:type", String)
|
|
11529
11762
|
], ForgotPasswordDto.prototype, "email", void 0);
|
|
11530
|
-
|
|
11763
|
+
_ts_decorate40([
|
|
11531
11764
|
IsOptional(),
|
|
11532
11765
|
IsString(),
|
|
11533
11766
|
IsNotEmpty(),
|
|
@@ -11535,9 +11768,9 @@ _ts_decorate39([
|
|
|
11535
11768
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11536
11769
|
message: "tenantId must not contain control characters"
|
|
11537
11770
|
}),
|
|
11538
|
-
|
|
11771
|
+
_ts_metadata39("design:type", String)
|
|
11539
11772
|
], ForgotPasswordDto.prototype, "tenantId", void 0);
|
|
11540
|
-
function
|
|
11773
|
+
function _ts_decorate41(decorators, target, key, desc) {
|
|
11541
11774
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11542
11775
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11543
11776
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11550,13 +11783,13 @@ function _ts_decorate40(decorators, target, key, desc) {
|
|
|
11550
11783
|
}
|
|
11551
11784
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11552
11785
|
}
|
|
11553
|
-
__name(
|
|
11554
|
-
function
|
|
11786
|
+
__name(_ts_decorate41, "_ts_decorate");
|
|
11787
|
+
function _ts_metadata40(metadataKey, metadataValue) {
|
|
11555
11788
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11556
11789
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11557
11790
|
}
|
|
11558
11791
|
}
|
|
11559
|
-
__name(
|
|
11792
|
+
__name(_ts_metadata40, "_ts_metadata");
|
|
11560
11793
|
var ResendOtpDto = class {
|
|
11561
11794
|
static {
|
|
11562
11795
|
__name(this, "ResendOtpDto");
|
|
@@ -11571,13 +11804,13 @@ var ResendOtpDto = class {
|
|
|
11571
11804
|
*/
|
|
11572
11805
|
tenantId;
|
|
11573
11806
|
};
|
|
11574
|
-
|
|
11807
|
+
_ts_decorate41([
|
|
11575
11808
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11576
11809
|
IsEmail(),
|
|
11577
11810
|
MaxLength(255),
|
|
11578
|
-
|
|
11811
|
+
_ts_metadata40("design:type", String)
|
|
11579
11812
|
], ResendOtpDto.prototype, "email", void 0);
|
|
11580
|
-
|
|
11813
|
+
_ts_decorate41([
|
|
11581
11814
|
IsOptional(),
|
|
11582
11815
|
IsString(),
|
|
11583
11816
|
IsNotEmpty(),
|
|
@@ -11585,9 +11818,9 @@ _ts_decorate40([
|
|
|
11585
11818
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11586
11819
|
message: "tenantId must not contain control characters"
|
|
11587
11820
|
}),
|
|
11588
|
-
|
|
11821
|
+
_ts_metadata40("design:type", String)
|
|
11589
11822
|
], ResendOtpDto.prototype, "tenantId", void 0);
|
|
11590
|
-
function
|
|
11823
|
+
function _ts_decorate42(decorators, target, key, desc) {
|
|
11591
11824
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11592
11825
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11593
11826
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11600,13 +11833,13 @@ function _ts_decorate41(decorators, target, key, desc) {
|
|
|
11600
11833
|
}
|
|
11601
11834
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11602
11835
|
}
|
|
11603
|
-
__name(
|
|
11604
|
-
function
|
|
11836
|
+
__name(_ts_decorate42, "_ts_decorate");
|
|
11837
|
+
function _ts_metadata41(metadataKey, metadataValue) {
|
|
11605
11838
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11606
11839
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11607
11840
|
}
|
|
11608
11841
|
}
|
|
11609
|
-
__name(
|
|
11842
|
+
__name(_ts_metadata41, "_ts_metadata");
|
|
11610
11843
|
var ResetPasswordDto = class {
|
|
11611
11844
|
static {
|
|
11612
11845
|
__name(this, "ResetPasswordDto");
|
|
@@ -11653,38 +11886,38 @@ var ResetPasswordDto = class {
|
|
|
11653
11886
|
*/
|
|
11654
11887
|
tenantId;
|
|
11655
11888
|
};
|
|
11656
|
-
|
|
11889
|
+
_ts_decorate42([
|
|
11657
11890
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11658
11891
|
IsEmail(),
|
|
11659
11892
|
MaxLength(255),
|
|
11660
|
-
|
|
11893
|
+
_ts_metadata41("design:type", String)
|
|
11661
11894
|
], ResetPasswordDto.prototype, "email", void 0);
|
|
11662
|
-
|
|
11895
|
+
_ts_decorate42([
|
|
11663
11896
|
IsString(),
|
|
11664
11897
|
MinLength(8),
|
|
11665
11898
|
MaxLength(128),
|
|
11666
|
-
|
|
11899
|
+
_ts_metadata41("design:type", String)
|
|
11667
11900
|
], ResetPasswordDto.prototype, "newPassword", void 0);
|
|
11668
|
-
|
|
11901
|
+
_ts_decorate42([
|
|
11669
11902
|
IsOptional(),
|
|
11670
11903
|
IsString(),
|
|
11671
11904
|
IsNotEmpty(),
|
|
11672
11905
|
MaxLength(2048),
|
|
11673
|
-
|
|
11906
|
+
_ts_metadata41("design:type", String)
|
|
11674
11907
|
], ResetPasswordDto.prototype, "token", void 0);
|
|
11675
|
-
|
|
11908
|
+
_ts_decorate42([
|
|
11676
11909
|
IsOptional(),
|
|
11677
11910
|
IsString(),
|
|
11678
11911
|
Length(4, 8),
|
|
11679
|
-
|
|
11912
|
+
_ts_metadata41("design:type", String)
|
|
11680
11913
|
], ResetPasswordDto.prototype, "otp", void 0);
|
|
11681
|
-
|
|
11914
|
+
_ts_decorate42([
|
|
11682
11915
|
IsOptional(),
|
|
11683
11916
|
IsString(),
|
|
11684
11917
|
Length(64, 64),
|
|
11685
|
-
|
|
11918
|
+
_ts_metadata41("design:type", String)
|
|
11686
11919
|
], ResetPasswordDto.prototype, "verifiedToken", void 0);
|
|
11687
|
-
|
|
11920
|
+
_ts_decorate42([
|
|
11688
11921
|
IsOptional(),
|
|
11689
11922
|
IsString(),
|
|
11690
11923
|
IsNotEmpty(),
|
|
@@ -11692,9 +11925,9 @@ _ts_decorate41([
|
|
|
11692
11925
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11693
11926
|
message: "tenantId must not contain control characters"
|
|
11694
11927
|
}),
|
|
11695
|
-
|
|
11928
|
+
_ts_metadata41("design:type", String)
|
|
11696
11929
|
], ResetPasswordDto.prototype, "tenantId", void 0);
|
|
11697
|
-
function
|
|
11930
|
+
function _ts_decorate43(decorators, target, key, desc) {
|
|
11698
11931
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11699
11932
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11700
11933
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11707,13 +11940,13 @@ function _ts_decorate42(decorators, target, key, desc) {
|
|
|
11707
11940
|
}
|
|
11708
11941
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11709
11942
|
}
|
|
11710
|
-
__name(
|
|
11711
|
-
function
|
|
11943
|
+
__name(_ts_decorate43, "_ts_decorate");
|
|
11944
|
+
function _ts_metadata42(metadataKey, metadataValue) {
|
|
11712
11945
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11713
11946
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11714
11947
|
}
|
|
11715
11948
|
}
|
|
11716
|
-
__name(
|
|
11949
|
+
__name(_ts_metadata42, "_ts_metadata");
|
|
11717
11950
|
var VerifyOtpDto = class {
|
|
11718
11951
|
static {
|
|
11719
11952
|
__name(this, "VerifyOtpDto");
|
|
@@ -11735,18 +11968,18 @@ var VerifyOtpDto = class {
|
|
|
11735
11968
|
*/
|
|
11736
11969
|
tenantId;
|
|
11737
11970
|
};
|
|
11738
|
-
|
|
11971
|
+
_ts_decorate43([
|
|
11739
11972
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
11740
11973
|
IsEmail(),
|
|
11741
11974
|
MaxLength(255),
|
|
11742
|
-
|
|
11975
|
+
_ts_metadata42("design:type", String)
|
|
11743
11976
|
], VerifyOtpDto.prototype, "email", void 0);
|
|
11744
|
-
|
|
11977
|
+
_ts_decorate43([
|
|
11745
11978
|
IsString(),
|
|
11746
11979
|
Length(4, 8),
|
|
11747
|
-
|
|
11980
|
+
_ts_metadata42("design:type", String)
|
|
11748
11981
|
], VerifyOtpDto.prototype, "otp", void 0);
|
|
11749
|
-
|
|
11982
|
+
_ts_decorate43([
|
|
11750
11983
|
IsOptional(),
|
|
11751
11984
|
IsString(),
|
|
11752
11985
|
IsNotEmpty(),
|
|
@@ -11754,9 +11987,9 @@ _ts_decorate42([
|
|
|
11754
11987
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
11755
11988
|
message: "tenantId must not contain control characters"
|
|
11756
11989
|
}),
|
|
11757
|
-
|
|
11990
|
+
_ts_metadata42("design:type", String)
|
|
11758
11991
|
], VerifyOtpDto.prototype, "tenantId", void 0);
|
|
11759
|
-
function
|
|
11992
|
+
function _ts_decorate44(decorators, target, key, desc) {
|
|
11760
11993
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11761
11994
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
11762
11995
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -11769,13 +12002,13 @@ function _ts_decorate43(decorators, target, key, desc) {
|
|
|
11769
12002
|
}
|
|
11770
12003
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11771
12004
|
}
|
|
11772
|
-
__name(
|
|
11773
|
-
function
|
|
12005
|
+
__name(_ts_decorate44, "_ts_decorate");
|
|
12006
|
+
function _ts_metadata43(metadataKey, metadataValue) {
|
|
11774
12007
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
11775
12008
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
11776
12009
|
}
|
|
11777
12010
|
}
|
|
11778
|
-
__name(
|
|
12011
|
+
__name(_ts_metadata43, "_ts_metadata");
|
|
11779
12012
|
function _ts_param23(paramIndex, decorator) {
|
|
11780
12013
|
return function(target, key) {
|
|
11781
12014
|
decorator(target, key, paramIndex);
|
|
@@ -12133,7 +12366,7 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
12133
12366
|
throw new AuthException(AUTH_ERROR_CODES.INVALID_CREDENTIALS);
|
|
12134
12367
|
}
|
|
12135
12368
|
await this.bruteForce.resetFailures(bfIdentifier);
|
|
12136
|
-
await this.
|
|
12369
|
+
const keptHash = await this.resolveCurrentSession(userId, user.tenantId, currentRefreshToken);
|
|
12137
12370
|
await this.passwordService.assertAcceptable(dto.newPassword, "newPassword");
|
|
12138
12371
|
const passwordHash = await this.passwordService.hash(dto.newPassword);
|
|
12139
12372
|
await this.userRepo.updatePassword({
|
|
@@ -12141,36 +12374,40 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
12141
12374
|
tenantId,
|
|
12142
12375
|
passwordHash
|
|
12143
12376
|
});
|
|
12144
|
-
await this.endOtherSessions(userId, user.tenantId,
|
|
12377
|
+
await this.endOtherSessions(userId, user.tenantId, keptHash);
|
|
12145
12378
|
await this.notifyPasswordChanged(user);
|
|
12146
12379
|
}
|
|
12147
|
-
/**
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12380
|
+
/**
|
|
12381
|
+
* The hash of the live session a presented refresh token stands for, or `undefined` when the
|
|
12382
|
+
* request carried none. Refuses a token that names no live session of the account; a token that
|
|
12383
|
+
* rotated away while the password was being verified stands for the session that replaced it.
|
|
12384
|
+
*/
|
|
12385
|
+
async resolveCurrentSession(userId, tenantId, currentRefreshToken) {
|
|
12386
|
+
if (currentRefreshToken === void 0 || currentRefreshToken.length === 0) return void 0;
|
|
12387
|
+
return this.sessionService.resolveLiveSession({
|
|
12151
12388
|
userId,
|
|
12152
12389
|
tenantId,
|
|
12153
12390
|
sessionHash: sha256(currentRefreshToken)
|
|
12154
12391
|
});
|
|
12155
12392
|
}
|
|
12156
12393
|
/**
|
|
12157
|
-
* Ends every session but the
|
|
12394
|
+
* Ends every session but the one to keep, once the new password is already written.
|
|
12158
12395
|
*
|
|
12159
|
-
* With no
|
|
12160
|
-
*
|
|
12161
|
-
* no current session left to
|
|
12162
|
-
* change safe is never aborted by the session it was told to spare. Any other failure of
|
|
12163
|
-
* sweep propagates.
|
|
12396
|
+
* With no session to keep every session ends. A kept session can rotate away while the new
|
|
12397
|
+
* password is hashed; the sweep follows it to its successor, and when it cannot be followed
|
|
12398
|
+
* there is no current session left to spare, so every session ends and the cleanup that makes
|
|
12399
|
+
* the change safe is never aborted by the session it was told to spare. Any other failure of
|
|
12400
|
+
* the sweep propagates.
|
|
12164
12401
|
*/
|
|
12165
|
-
async endOtherSessions(userId, tenantId,
|
|
12166
|
-
if (
|
|
12402
|
+
async endOtherSessions(userId, tenantId, keptHash) {
|
|
12403
|
+
if (keptHash === void 0) {
|
|
12167
12404
|
return this.endAllSessions(userId, tenantId);
|
|
12168
12405
|
}
|
|
12169
12406
|
try {
|
|
12170
12407
|
await this.sessionService.revokeAllExceptCurrent({
|
|
12171
12408
|
userId,
|
|
12172
12409
|
tenantId,
|
|
12173
|
-
currentSessionHash:
|
|
12410
|
+
currentSessionHash: keptHash
|
|
12174
12411
|
});
|
|
12175
12412
|
} catch (err) {
|
|
12176
12413
|
const body = err instanceof AuthException ? err.getResponse() : void 0;
|
|
@@ -12387,7 +12624,7 @@ var PasswordResetService = class _PasswordResetService {
|
|
|
12387
12624
|
};
|
|
12388
12625
|
}
|
|
12389
12626
|
};
|
|
12390
|
-
PasswordResetService =
|
|
12627
|
+
PasswordResetService = _ts_decorate44([
|
|
12391
12628
|
Injectable(),
|
|
12392
12629
|
_ts_param23(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
12393
12630
|
_ts_param23(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -12400,8 +12637,8 @@ PasswordResetService = _ts_decorate43([
|
|
|
12400
12637
|
_ts_param23(6, Inject(AuthRedisService)),
|
|
12401
12638
|
_ts_param23(7, Inject(SessionService)),
|
|
12402
12639
|
_ts_param23(8, Inject(BruteForceService)),
|
|
12403
|
-
|
|
12404
|
-
|
|
12640
|
+
_ts_metadata43("design:type", Function),
|
|
12641
|
+
_ts_metadata43("design:paramtypes", [
|
|
12405
12642
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
12406
12643
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
12407
12644
|
Object,
|
|
@@ -12420,7 +12657,7 @@ function toSafeUser3(user) {
|
|
|
12420
12657
|
__name(toSafeUser3, "toSafeUser");
|
|
12421
12658
|
|
|
12422
12659
|
// src/server/controllers/password-reset.controller.ts
|
|
12423
|
-
function
|
|
12660
|
+
function _ts_decorate45(decorators, target, key, desc) {
|
|
12424
12661
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12425
12662
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12426
12663
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12433,13 +12670,13 @@ function _ts_decorate44(decorators, target, key, desc) {
|
|
|
12433
12670
|
}
|
|
12434
12671
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12435
12672
|
}
|
|
12436
|
-
__name(
|
|
12437
|
-
function
|
|
12673
|
+
__name(_ts_decorate45, "_ts_decorate");
|
|
12674
|
+
function _ts_metadata44(metadataKey, metadataValue) {
|
|
12438
12675
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12439
12676
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12440
12677
|
}
|
|
12441
12678
|
}
|
|
12442
|
-
__name(
|
|
12679
|
+
__name(_ts_metadata44, "_ts_metadata");
|
|
12443
12680
|
function _ts_param24(paramIndex, decorator) {
|
|
12444
12681
|
return function(target, key) {
|
|
12445
12682
|
decorator(target, key, paramIndex);
|
|
@@ -12562,35 +12799,35 @@ var PasswordResetController = class {
|
|
|
12562
12799
|
return {};
|
|
12563
12800
|
}
|
|
12564
12801
|
};
|
|
12565
|
-
|
|
12802
|
+
_ts_decorate45([
|
|
12566
12803
|
Throttle(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
12567
12804
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.forgotPassword),
|
|
12568
12805
|
HttpCode(HttpStatus.OK),
|
|
12569
12806
|
Post("forgot-password"),
|
|
12570
12807
|
_ts_param24(0, Body()),
|
|
12571
12808
|
_ts_param24(1, Req()),
|
|
12572
|
-
|
|
12573
|
-
|
|
12809
|
+
_ts_metadata44("design:type", Function),
|
|
12810
|
+
_ts_metadata44("design:paramtypes", [
|
|
12574
12811
|
typeof ForgotPasswordDto === "undefined" ? Object : ForgotPasswordDto,
|
|
12575
12812
|
typeof Request === "undefined" ? Object : Request
|
|
12576
12813
|
]),
|
|
12577
|
-
|
|
12814
|
+
_ts_metadata44("design:returntype", Promise)
|
|
12578
12815
|
], PasswordResetController.prototype, "forgotPassword", null);
|
|
12579
|
-
|
|
12816
|
+
_ts_decorate45([
|
|
12580
12817
|
Throttle(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
12581
12818
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resetPassword),
|
|
12582
12819
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
12583
12820
|
Post("reset-password"),
|
|
12584
12821
|
_ts_param24(0, Body()),
|
|
12585
12822
|
_ts_param24(1, Req()),
|
|
12586
|
-
|
|
12587
|
-
|
|
12823
|
+
_ts_metadata44("design:type", Function),
|
|
12824
|
+
_ts_metadata44("design:paramtypes", [
|
|
12588
12825
|
typeof ResetPasswordDto === "undefined" ? Object : ResetPasswordDto,
|
|
12589
12826
|
typeof Request === "undefined" ? Object : Request
|
|
12590
12827
|
]),
|
|
12591
|
-
|
|
12828
|
+
_ts_metadata44("design:returntype", Promise)
|
|
12592
12829
|
], PasswordResetController.prototype, "resetPassword", null);
|
|
12593
|
-
|
|
12830
|
+
_ts_decorate45([
|
|
12594
12831
|
Authenticated(),
|
|
12595
12832
|
UseGuards(JwtAuthGuard, UserStatusGuard),
|
|
12596
12833
|
Throttle(AUTH_THROTTLE_CONFIGS.changePassword),
|
|
@@ -12600,57 +12837,57 @@ _ts_decorate44([
|
|
|
12600
12837
|
_ts_param24(0, CurrentUser()),
|
|
12601
12838
|
_ts_param24(1, Body()),
|
|
12602
12839
|
_ts_param24(2, Req()),
|
|
12603
|
-
|
|
12604
|
-
|
|
12840
|
+
_ts_metadata44("design:type", Function),
|
|
12841
|
+
_ts_metadata44("design:paramtypes", [
|
|
12605
12842
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
12606
12843
|
typeof ChangePasswordDto === "undefined" ? Object : ChangePasswordDto,
|
|
12607
12844
|
typeof Request === "undefined" ? Object : Request
|
|
12608
12845
|
]),
|
|
12609
|
-
|
|
12846
|
+
_ts_metadata44("design:returntype", Promise)
|
|
12610
12847
|
], PasswordResetController.prototype, "changePassword", null);
|
|
12611
|
-
|
|
12848
|
+
_ts_decorate45([
|
|
12612
12849
|
Throttle(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
12613
12850
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.verifyOtp),
|
|
12614
12851
|
HttpCode(HttpStatus.OK),
|
|
12615
12852
|
Post("verify-otp"),
|
|
12616
12853
|
_ts_param24(0, Body()),
|
|
12617
12854
|
_ts_param24(1, Req()),
|
|
12618
|
-
|
|
12619
|
-
|
|
12855
|
+
_ts_metadata44("design:type", Function),
|
|
12856
|
+
_ts_metadata44("design:paramtypes", [
|
|
12620
12857
|
typeof VerifyOtpDto === "undefined" ? Object : VerifyOtpDto,
|
|
12621
12858
|
typeof Request === "undefined" ? Object : Request
|
|
12622
12859
|
]),
|
|
12623
|
-
|
|
12860
|
+
_ts_metadata44("design:returntype", Promise)
|
|
12624
12861
|
], PasswordResetController.prototype, "verifyOtp", null);
|
|
12625
|
-
|
|
12862
|
+
_ts_decorate45([
|
|
12626
12863
|
Throttle(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
12627
12864
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.resendPasswordOtp),
|
|
12628
12865
|
HttpCode(HttpStatus.OK),
|
|
12629
12866
|
Post("resend-otp"),
|
|
12630
12867
|
_ts_param24(0, Body()),
|
|
12631
12868
|
_ts_param24(1, Req()),
|
|
12632
|
-
|
|
12633
|
-
|
|
12869
|
+
_ts_metadata44("design:type", Function),
|
|
12870
|
+
_ts_metadata44("design:paramtypes", [
|
|
12634
12871
|
typeof ResendOtpDto === "undefined" ? Object : ResendOtpDto,
|
|
12635
12872
|
typeof Request === "undefined" ? Object : Request
|
|
12636
12873
|
]),
|
|
12637
|
-
|
|
12874
|
+
_ts_metadata44("design:returntype", Promise)
|
|
12638
12875
|
], PasswordResetController.prototype, "resendOtp", null);
|
|
12639
|
-
PasswordResetController =
|
|
12876
|
+
PasswordResetController = _ts_decorate45([
|
|
12640
12877
|
Public(),
|
|
12641
12878
|
UseInterceptors(NoStoreInterceptor),
|
|
12642
12879
|
Controller("password"),
|
|
12643
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
12880
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
12644
12881
|
UsePipes(createAuthValidationPipe()),
|
|
12645
12882
|
_ts_param24(0, Inject(PasswordResetService)),
|
|
12646
12883
|
_ts_param24(1, Inject(TokenDeliveryService)),
|
|
12647
|
-
|
|
12648
|
-
|
|
12884
|
+
_ts_metadata44("design:type", Function),
|
|
12885
|
+
_ts_metadata44("design:paramtypes", [
|
|
12649
12886
|
typeof PasswordResetService === "undefined" ? Object : PasswordResetService,
|
|
12650
12887
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
12651
12888
|
])
|
|
12652
12889
|
], PasswordResetController);
|
|
12653
|
-
function
|
|
12890
|
+
function _ts_decorate46(decorators, target, key, desc) {
|
|
12654
12891
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12655
12892
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12656
12893
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12663,13 +12900,13 @@ function _ts_decorate45(decorators, target, key, desc) {
|
|
|
12663
12900
|
}
|
|
12664
12901
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12665
12902
|
}
|
|
12666
|
-
__name(
|
|
12667
|
-
function
|
|
12903
|
+
__name(_ts_decorate46, "_ts_decorate");
|
|
12904
|
+
function _ts_metadata45(metadataKey, metadataValue) {
|
|
12668
12905
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12669
12906
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12670
12907
|
}
|
|
12671
12908
|
}
|
|
12672
|
-
__name(
|
|
12909
|
+
__name(_ts_metadata45, "_ts_metadata");
|
|
12673
12910
|
var PlatformLoginDto = class {
|
|
12674
12911
|
static {
|
|
12675
12912
|
__name(this, "PlatformLoginDto");
|
|
@@ -12697,14 +12934,14 @@ var PlatformLoginDto = class {
|
|
|
12697
12934
|
*/
|
|
12698
12935
|
password;
|
|
12699
12936
|
};
|
|
12700
|
-
|
|
12937
|
+
_ts_decorate46([
|
|
12701
12938
|
Transform(({ value }) => typeof value === "string" ? value.trim().toLowerCase() : value),
|
|
12702
12939
|
IsEmail(),
|
|
12703
12940
|
IsNotEmpty(),
|
|
12704
12941
|
MaxLength(255),
|
|
12705
|
-
|
|
12942
|
+
_ts_metadata45("design:type", String)
|
|
12706
12943
|
], PlatformLoginDto.prototype, "email", void 0);
|
|
12707
|
-
|
|
12944
|
+
_ts_decorate46([
|
|
12708
12945
|
IsString(),
|
|
12709
12946
|
IsNotEmpty(),
|
|
12710
12947
|
Matches(/\S/, {
|
|
@@ -12712,9 +12949,9 @@ _ts_decorate45([
|
|
|
12712
12949
|
}),
|
|
12713
12950
|
MinLength(1),
|
|
12714
12951
|
MaxLength(128),
|
|
12715
|
-
|
|
12952
|
+
_ts_metadata45("design:type", String)
|
|
12716
12953
|
], PlatformLoginDto.prototype, "password", void 0);
|
|
12717
|
-
function
|
|
12954
|
+
function _ts_decorate47(decorators, target, key, desc) {
|
|
12718
12955
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12719
12956
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12720
12957
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12727,13 +12964,13 @@ function _ts_decorate46(decorators, target, key, desc) {
|
|
|
12727
12964
|
}
|
|
12728
12965
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12729
12966
|
}
|
|
12730
|
-
__name(
|
|
12731
|
-
function
|
|
12967
|
+
__name(_ts_decorate47, "_ts_decorate");
|
|
12968
|
+
function _ts_metadata46(metadataKey, metadataValue) {
|
|
12732
12969
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12733
12970
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12734
12971
|
}
|
|
12735
12972
|
}
|
|
12736
|
-
__name(
|
|
12973
|
+
__name(_ts_metadata46, "_ts_metadata");
|
|
12737
12974
|
function _ts_param25(paramIndex, decorator) {
|
|
12738
12975
|
return function(target, key) {
|
|
12739
12976
|
decorator(target, key, paramIndex);
|
|
@@ -12785,15 +13022,15 @@ var JwtPlatformGuard = class {
|
|
|
12785
13022
|
return true;
|
|
12786
13023
|
}
|
|
12787
13024
|
};
|
|
12788
|
-
JwtPlatformGuard =
|
|
13025
|
+
JwtPlatformGuard = _ts_decorate47([
|
|
12789
13026
|
Injectable(),
|
|
12790
13027
|
_ts_param25(0, Inject(JwtService)),
|
|
12791
13028
|
_ts_param25(1, Inject(TokenDeliveryService)),
|
|
12792
13029
|
_ts_param25(2, Inject(AuthRevocationService)),
|
|
12793
13030
|
_ts_param25(3, Inject(Reflector)),
|
|
12794
13031
|
_ts_param25(4, Inject(BYMAX_AUTH_OPTIONS)),
|
|
12795
|
-
|
|
12796
|
-
|
|
13032
|
+
_ts_metadata46("design:type", Function),
|
|
13033
|
+
_ts_metadata46("design:paramtypes", [
|
|
12797
13034
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
12798
13035
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
12799
13036
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
@@ -12801,7 +13038,7 @@ JwtPlatformGuard = _ts_decorate46([
|
|
|
12801
13038
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
12802
13039
|
])
|
|
12803
13040
|
], JwtPlatformGuard);
|
|
12804
|
-
function
|
|
13041
|
+
function _ts_decorate48(decorators, target, key, desc) {
|
|
12805
13042
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12806
13043
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
12807
13044
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -12814,13 +13051,13 @@ function _ts_decorate47(decorators, target, key, desc) {
|
|
|
12814
13051
|
}
|
|
12815
13052
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12816
13053
|
}
|
|
12817
|
-
__name(
|
|
12818
|
-
function
|
|
13054
|
+
__name(_ts_decorate48, "_ts_decorate");
|
|
13055
|
+
function _ts_metadata47(metadataKey, metadataValue) {
|
|
12819
13056
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
12820
13057
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
12821
13058
|
}
|
|
12822
13059
|
}
|
|
12823
|
-
__name(
|
|
13060
|
+
__name(_ts_metadata47, "_ts_metadata");
|
|
12824
13061
|
function _ts_param26(paramIndex, decorator) {
|
|
12825
13062
|
return function(target, key) {
|
|
12826
13063
|
decorator(target, key, paramIndex);
|
|
@@ -12925,36 +13162,60 @@ var PlatformAuthService = class _PlatformAuthService {
|
|
|
12925
13162
|
*/
|
|
12926
13163
|
async logout(accessToken, rawRefreshToken) {
|
|
12927
13164
|
const tokenHash = sha256(rawRefreshToken);
|
|
12928
|
-
const
|
|
13165
|
+
const markerKey = logoutPendingKey("platform", tokenHash);
|
|
13166
|
+
const live = await this.redis.readSessionOwner(`prt:${tokenHash}`);
|
|
13167
|
+
const fromSession = live.userId !== "";
|
|
13168
|
+
const { userId } = fromSession ? live : await this.redis.readSessionOwner(markerKey);
|
|
12929
13169
|
this.logger.log(`logout: adminId=${logSafe(userId || "(no live session)")}`);
|
|
12930
|
-
let blacklist = [];
|
|
12931
|
-
try {
|
|
12932
|
-
const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
|
|
12933
|
-
const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
|
|
12934
|
-
if (remainingTtl > 0) {
|
|
12935
|
-
blacklist = [
|
|
12936
|
-
() => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
|
|
12937
|
-
];
|
|
12938
|
-
}
|
|
12939
|
-
} catch {
|
|
12940
|
-
}
|
|
12941
13170
|
const index = userId ? sessionIndexKey("platform", userId, this.options.hmacKey, void 0) : "";
|
|
12942
13171
|
const prune = /* @__PURE__ */ __name((member) => index === "" ? [] : [
|
|
12943
13172
|
() => this.redis.srem(index, member)
|
|
12944
13173
|
], "prune");
|
|
12945
13174
|
const failures = await settleWrites([
|
|
12946
|
-
...
|
|
13175
|
+
...this.blacklistWrites(accessToken),
|
|
12947
13176
|
settleAfter(() => this.redis.del("prt:" + tokenHash), [
|
|
12948
13177
|
...prune("prt:" + tokenHash),
|
|
12949
13178
|
() => this.redis.del("psd:" + tokenHash)
|
|
12950
13179
|
]),
|
|
12951
13180
|
settleAfter(() => this.redis.del("prp:" + tokenHash), prune("prp:" + tokenHash))
|
|
12952
13181
|
]);
|
|
13182
|
+
if (failures.length > 0 && fromSession) {
|
|
13183
|
+
await rememberPendingLogout(this.redis, markerKey, {
|
|
13184
|
+
userId,
|
|
13185
|
+
tenantId: void 0
|
|
13186
|
+
}, logoutPendingTtlSeconds(this.options.jwt.accessExpiresIn), this.logger);
|
|
13187
|
+
}
|
|
12953
13188
|
raiseFirst(failures);
|
|
12954
|
-
this.
|
|
13189
|
+
if (userId !== "" && await settlePendingLogout(this.redis, markerKey, fromSession, this.logger)) {
|
|
13190
|
+
this.emitPlatformLogout(userId);
|
|
13191
|
+
}
|
|
12955
13192
|
return userId;
|
|
12956
13193
|
}
|
|
12957
13194
|
/**
|
|
13195
|
+
* The access-token blacklist write for a platform logout, or none when there is nothing to
|
|
13196
|
+
* revoke.
|
|
13197
|
+
*
|
|
13198
|
+
* Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
|
|
13199
|
+
* forged one must not be able to blacklist an id it does not own. Only the verification is
|
|
13200
|
+
* tolerant: a token nobody can verify has nothing to blacklist, but a refused write is not.
|
|
13201
|
+
*
|
|
13202
|
+
* @param accessToken - Raw platform access token; absent, malformed or expired yields no write.
|
|
13203
|
+
* @returns The writes to hand to `settleWrites`.
|
|
13204
|
+
*/
|
|
13205
|
+
blacklistWrites(accessToken) {
|
|
13206
|
+
try {
|
|
13207
|
+
const payload = this.tokenManager.verifyPlatformIgnoringExpiry(accessToken);
|
|
13208
|
+
const remainingTtl = payload.exp - Math.floor(Date.now() / 1e3);
|
|
13209
|
+
if (remainingTtl > 0) {
|
|
13210
|
+
return [
|
|
13211
|
+
() => this.redis.set(`rv:${payload.jti}`, "1", remainingTtl)
|
|
13212
|
+
];
|
|
13213
|
+
}
|
|
13214
|
+
} catch {
|
|
13215
|
+
}
|
|
13216
|
+
return [];
|
|
13217
|
+
}
|
|
13218
|
+
/**
|
|
12958
13219
|
* Announces a completed platform logout, the only hook `PlatformAuthService` emits.
|
|
12959
13220
|
*
|
|
12960
13221
|
* Owns three concerns a reader of `logout` does not need: whether a hook is registered, the
|
|
@@ -13091,7 +13352,7 @@ var PlatformAuthService = class _PlatformAuthService {
|
|
|
13091
13352
|
await this.redis.bumpUserTokenEpoch(userId, void 0, "platform");
|
|
13092
13353
|
}
|
|
13093
13354
|
};
|
|
13094
|
-
PlatformAuthService =
|
|
13355
|
+
PlatformAuthService = _ts_decorate48([
|
|
13095
13356
|
Injectable(),
|
|
13096
13357
|
_ts_param26(0, Inject(BYMAX_AUTH_PLATFORM_USER_REPOSITORY)),
|
|
13097
13358
|
_ts_param26(1, Inject(PasswordService)),
|
|
@@ -13101,8 +13362,8 @@ PlatformAuthService = _ts_decorate47([
|
|
|
13101
13362
|
_ts_param26(5, Inject(BYMAX_AUTH_OPTIONS)),
|
|
13102
13363
|
_ts_param26(6, Inject(BYMAX_AUTH_HOOKS)),
|
|
13103
13364
|
_ts_param26(6, Optional()),
|
|
13104
|
-
|
|
13105
|
-
|
|
13365
|
+
_ts_metadata47("design:type", Function),
|
|
13366
|
+
_ts_metadata47("design:paramtypes", [
|
|
13106
13367
|
typeof IPlatformUserRepository === "undefined" ? Object : IPlatformUserRepository,
|
|
13107
13368
|
typeof PasswordService === "undefined" ? Object : PasswordService,
|
|
13108
13369
|
typeof TokenManagerService === "undefined" ? Object : TokenManagerService,
|
|
@@ -13114,7 +13375,7 @@ PlatformAuthService = _ts_decorate47([
|
|
|
13114
13375
|
], PlatformAuthService);
|
|
13115
13376
|
|
|
13116
13377
|
// src/server/controllers/platform-auth.controller.ts
|
|
13117
|
-
function
|
|
13378
|
+
function _ts_decorate49(decorators, target, key, desc) {
|
|
13118
13379
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13119
13380
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13120
13381
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13127,13 +13388,13 @@ function _ts_decorate48(decorators, target, key, desc) {
|
|
|
13127
13388
|
}
|
|
13128
13389
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13129
13390
|
}
|
|
13130
|
-
__name(
|
|
13131
|
-
function
|
|
13391
|
+
__name(_ts_decorate49, "_ts_decorate");
|
|
13392
|
+
function _ts_metadata48(metadataKey, metadataValue) {
|
|
13132
13393
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13133
13394
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13134
13395
|
}
|
|
13135
13396
|
}
|
|
13136
|
-
__name(
|
|
13397
|
+
__name(_ts_metadata48, "_ts_metadata");
|
|
13137
13398
|
function _ts_param27(paramIndex, decorator) {
|
|
13138
13399
|
return function(target, key) {
|
|
13139
13400
|
decorator(target, key, paramIndex);
|
|
@@ -13285,7 +13546,7 @@ var PlatformAuthController = class {
|
|
|
13285
13546
|
await this.platformAuthService.revokeAllPlatformSessions(user.sub);
|
|
13286
13547
|
}
|
|
13287
13548
|
};
|
|
13288
|
-
|
|
13549
|
+
_ts_decorate49([
|
|
13289
13550
|
Public(),
|
|
13290
13551
|
Throttle(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
13291
13552
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.platformLogin),
|
|
@@ -13293,14 +13554,14 @@ _ts_decorate48([
|
|
|
13293
13554
|
Post("login"),
|
|
13294
13555
|
_ts_param27(0, Body()),
|
|
13295
13556
|
_ts_param27(1, Req()),
|
|
13296
|
-
|
|
13297
|
-
|
|
13557
|
+
_ts_metadata48("design:type", Function),
|
|
13558
|
+
_ts_metadata48("design:paramtypes", [
|
|
13298
13559
|
typeof PlatformLoginDto === "undefined" ? Object : PlatformLoginDto,
|
|
13299
13560
|
typeof Request === "undefined" ? Object : Request
|
|
13300
13561
|
]),
|
|
13301
|
-
|
|
13562
|
+
_ts_metadata48("design:returntype", Promise)
|
|
13302
13563
|
], PlatformAuthController.prototype, "login", null);
|
|
13303
|
-
|
|
13564
|
+
_ts_decorate49([
|
|
13304
13565
|
Public(),
|
|
13305
13566
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
13306
13567
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaChallenge),
|
|
@@ -13308,78 +13569,80 @@ _ts_decorate48([
|
|
|
13308
13569
|
Post("mfa/challenge"),
|
|
13309
13570
|
_ts_param27(0, Body()),
|
|
13310
13571
|
_ts_param27(1, Req()),
|
|
13311
|
-
|
|
13312
|
-
|
|
13572
|
+
_ts_metadata48("design:type", Function),
|
|
13573
|
+
_ts_metadata48("design:paramtypes", [
|
|
13313
13574
|
typeof MfaChallengeDto === "undefined" ? Object : MfaChallengeDto,
|
|
13314
13575
|
typeof Request === "undefined" ? Object : Request
|
|
13315
13576
|
]),
|
|
13316
|
-
|
|
13577
|
+
_ts_metadata48("design:returntype", Promise)
|
|
13317
13578
|
], PlatformAuthController.prototype, "mfaChallenge", null);
|
|
13318
|
-
|
|
13579
|
+
_ts_decorate49([
|
|
13319
13580
|
UseGuards(JwtPlatformGuard),
|
|
13320
13581
|
Get("me"),
|
|
13321
13582
|
_ts_param27(0, CurrentUser()),
|
|
13322
|
-
|
|
13323
|
-
|
|
13583
|
+
_ts_metadata48("design:type", Function),
|
|
13584
|
+
_ts_metadata48("design:paramtypes", [
|
|
13324
13585
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
13325
13586
|
]),
|
|
13326
|
-
|
|
13587
|
+
_ts_metadata48("design:returntype", Promise)
|
|
13327
13588
|
], PlatformAuthController.prototype, "me", null);
|
|
13328
|
-
|
|
13589
|
+
_ts_decorate49([
|
|
13329
13590
|
Public(),
|
|
13330
13591
|
Throttle(AUTH_THROTTLE_CONFIGS.logout),
|
|
13331
13592
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.logout),
|
|
13332
13593
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13594
|
+
RequestEncoding("unchecked"),
|
|
13333
13595
|
Post("logout"),
|
|
13334
13596
|
_ts_param27(0, Req()),
|
|
13335
|
-
|
|
13336
|
-
|
|
13597
|
+
_ts_metadata48("design:type", Function),
|
|
13598
|
+
_ts_metadata48("design:paramtypes", [
|
|
13337
13599
|
typeof Request === "undefined" ? Object : Request
|
|
13338
13600
|
]),
|
|
13339
|
-
|
|
13601
|
+
_ts_metadata48("design:returntype", Promise)
|
|
13340
13602
|
], PlatformAuthController.prototype, "logout", null);
|
|
13341
|
-
|
|
13603
|
+
_ts_decorate49([
|
|
13342
13604
|
Public(),
|
|
13343
13605
|
Throttle(AUTH_THROTTLE_CONFIGS.refresh),
|
|
13344
13606
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.refresh),
|
|
13345
13607
|
HttpCode(HttpStatus.OK),
|
|
13608
|
+
RequestEncoding("unchecked"),
|
|
13346
13609
|
Post("refresh"),
|
|
13347
13610
|
_ts_param27(0, Req()),
|
|
13348
|
-
|
|
13349
|
-
|
|
13611
|
+
_ts_metadata48("design:type", Function),
|
|
13612
|
+
_ts_metadata48("design:paramtypes", [
|
|
13350
13613
|
typeof Request === "undefined" ? Object : Request
|
|
13351
13614
|
]),
|
|
13352
|
-
|
|
13615
|
+
_ts_metadata48("design:returntype", Promise)
|
|
13353
13616
|
], PlatformAuthController.prototype, "refresh", null);
|
|
13354
|
-
|
|
13617
|
+
_ts_decorate49([
|
|
13355
13618
|
UseGuards(JwtPlatformGuard),
|
|
13356
13619
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13357
13620
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13358
13621
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13359
13622
|
Delete("sessions"),
|
|
13360
13623
|
_ts_param27(0, CurrentUser()),
|
|
13361
|
-
|
|
13362
|
-
|
|
13624
|
+
_ts_metadata48("design:type", Function),
|
|
13625
|
+
_ts_metadata48("design:paramtypes", [
|
|
13363
13626
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload
|
|
13364
13627
|
]),
|
|
13365
|
-
|
|
13628
|
+
_ts_metadata48("design:returntype", Promise)
|
|
13366
13629
|
], PlatformAuthController.prototype, "revokeSessions", null);
|
|
13367
|
-
PlatformAuthController =
|
|
13630
|
+
PlatformAuthController = _ts_decorate49([
|
|
13368
13631
|
UseInterceptors(NoStoreInterceptor),
|
|
13369
13632
|
Controller("platform"),
|
|
13370
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
13633
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
13371
13634
|
UsePipes(createAuthValidationPipe()),
|
|
13372
13635
|
_ts_param27(0, Inject(PlatformAuthService)),
|
|
13373
13636
|
_ts_param27(1, Inject(MfaService)),
|
|
13374
13637
|
_ts_param27(2, Inject(TokenDeliveryService)),
|
|
13375
|
-
|
|
13376
|
-
|
|
13638
|
+
_ts_metadata48("design:type", Function),
|
|
13639
|
+
_ts_metadata48("design:paramtypes", [
|
|
13377
13640
|
typeof PlatformAuthService === "undefined" ? Object : PlatformAuthService,
|
|
13378
13641
|
typeof MfaService === "undefined" ? Object : MfaService,
|
|
13379
13642
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
13380
13643
|
])
|
|
13381
13644
|
], PlatformAuthController);
|
|
13382
|
-
function
|
|
13645
|
+
function _ts_decorate50(decorators, target, key, desc) {
|
|
13383
13646
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13384
13647
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13385
13648
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13392,13 +13655,13 @@ function _ts_decorate49(decorators, target, key, desc) {
|
|
|
13392
13655
|
}
|
|
13393
13656
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13394
13657
|
}
|
|
13395
|
-
__name(
|
|
13396
|
-
function
|
|
13658
|
+
__name(_ts_decorate50, "_ts_decorate");
|
|
13659
|
+
function _ts_metadata49(metadataKey, metadataValue) {
|
|
13397
13660
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13398
13661
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13399
13662
|
}
|
|
13400
13663
|
}
|
|
13401
|
-
__name(
|
|
13664
|
+
__name(_ts_metadata49, "_ts_metadata");
|
|
13402
13665
|
function _ts_param28(paramIndex, decorator) {
|
|
13403
13666
|
return function(target, key) {
|
|
13404
13667
|
decorator(target, key, paramIndex);
|
|
@@ -13483,21 +13746,22 @@ var PlatformMfaController = class {
|
|
|
13483
13746
|
return this.mfaService.regenerateRecoveryCodes(user.sub, dto.code, ip, userAgent, "platform");
|
|
13484
13747
|
}
|
|
13485
13748
|
};
|
|
13486
|
-
|
|
13749
|
+
_ts_decorate50([
|
|
13487
13750
|
UseGuards(JwtPlatformGuard),
|
|
13488
13751
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
13489
13752
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaSetup),
|
|
13753
|
+
RequestEncoding("when-body"),
|
|
13490
13754
|
Post("setup"),
|
|
13491
13755
|
_ts_param28(0, CurrentUser()),
|
|
13492
13756
|
_ts_param28(1, Body()),
|
|
13493
|
-
|
|
13494
|
-
|
|
13757
|
+
_ts_metadata49("design:type", Function),
|
|
13758
|
+
_ts_metadata49("design:paramtypes", [
|
|
13495
13759
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13496
13760
|
typeof MfaSetupDto === "undefined" ? Object : MfaSetupDto
|
|
13497
13761
|
]),
|
|
13498
|
-
|
|
13762
|
+
_ts_metadata49("design:returntype", Promise)
|
|
13499
13763
|
], PlatformMfaController.prototype, "setup", null);
|
|
13500
|
-
|
|
13764
|
+
_ts_decorate50([
|
|
13501
13765
|
UseGuards(JwtPlatformGuard),
|
|
13502
13766
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
13503
13767
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaVerifyEnable),
|
|
@@ -13506,15 +13770,15 @@ _ts_decorate49([
|
|
|
13506
13770
|
_ts_param28(0, CurrentUser()),
|
|
13507
13771
|
_ts_param28(1, Body()),
|
|
13508
13772
|
_ts_param28(2, Req()),
|
|
13509
|
-
|
|
13510
|
-
|
|
13773
|
+
_ts_metadata49("design:type", Function),
|
|
13774
|
+
_ts_metadata49("design:paramtypes", [
|
|
13511
13775
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13512
13776
|
typeof MfaVerifyDto === "undefined" ? Object : MfaVerifyDto,
|
|
13513
13777
|
typeof Request === "undefined" ? Object : Request
|
|
13514
13778
|
]),
|
|
13515
|
-
|
|
13779
|
+
_ts_metadata49("design:returntype", Promise)
|
|
13516
13780
|
], PlatformMfaController.prototype, "verifyEnable", null);
|
|
13517
|
-
|
|
13781
|
+
_ts_decorate50([
|
|
13518
13782
|
UseGuards(JwtPlatformGuard),
|
|
13519
13783
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13520
13784
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
@@ -13523,15 +13787,15 @@ _ts_decorate49([
|
|
|
13523
13787
|
_ts_param28(0, CurrentUser()),
|
|
13524
13788
|
_ts_param28(1, Body()),
|
|
13525
13789
|
_ts_param28(2, Req()),
|
|
13526
|
-
|
|
13527
|
-
|
|
13790
|
+
_ts_metadata49("design:type", Function),
|
|
13791
|
+
_ts_metadata49("design:paramtypes", [
|
|
13528
13792
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13529
13793
|
typeof MfaDisableDto === "undefined" ? Object : MfaDisableDto,
|
|
13530
13794
|
typeof Request === "undefined" ? Object : Request
|
|
13531
13795
|
]),
|
|
13532
|
-
|
|
13796
|
+
_ts_metadata49("design:returntype", Promise)
|
|
13533
13797
|
], PlatformMfaController.prototype, "disable", null);
|
|
13534
|
-
|
|
13798
|
+
_ts_decorate50([
|
|
13535
13799
|
UseGuards(JwtPlatformGuard),
|
|
13536
13800
|
Throttle(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
13537
13801
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.mfaDisable),
|
|
@@ -13540,28 +13804,28 @@ _ts_decorate49([
|
|
|
13540
13804
|
_ts_param28(0, CurrentUser()),
|
|
13541
13805
|
_ts_param28(1, Body()),
|
|
13542
13806
|
_ts_param28(2, Req()),
|
|
13543
|
-
|
|
13544
|
-
|
|
13807
|
+
_ts_metadata49("design:type", Function),
|
|
13808
|
+
_ts_metadata49("design:paramtypes", [
|
|
13545
13809
|
typeof PlatformJwtPayload === "undefined" ? Object : PlatformJwtPayload,
|
|
13546
13810
|
typeof MfaRegenerateRecoveryCodesDto === "undefined" ? Object : MfaRegenerateRecoveryCodesDto,
|
|
13547
13811
|
typeof Request === "undefined" ? Object : Request
|
|
13548
13812
|
]),
|
|
13549
|
-
|
|
13813
|
+
_ts_metadata49("design:returntype", Promise)
|
|
13550
13814
|
], PlatformMfaController.prototype, "regenerateRecoveryCodes", null);
|
|
13551
|
-
PlatformMfaController =
|
|
13815
|
+
PlatformMfaController = _ts_decorate50([
|
|
13552
13816
|
UseInterceptors(NoStoreInterceptor),
|
|
13553
13817
|
Controller("platform/mfa"),
|
|
13554
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
13818
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
13555
13819
|
UsePipes(createAuthValidationPipe({
|
|
13556
13820
|
forbidUnknownValues: true
|
|
13557
13821
|
})),
|
|
13558
13822
|
_ts_param28(0, Inject(MfaService)),
|
|
13559
|
-
|
|
13560
|
-
|
|
13823
|
+
_ts_metadata49("design:type", Function),
|
|
13824
|
+
_ts_metadata49("design:paramtypes", [
|
|
13561
13825
|
typeof MfaService === "undefined" ? Object : MfaService
|
|
13562
13826
|
])
|
|
13563
13827
|
], PlatformMfaController);
|
|
13564
|
-
function
|
|
13828
|
+
function _ts_decorate51(decorators, target, key, desc) {
|
|
13565
13829
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13566
13830
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13567
13831
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13574,13 +13838,13 @@ function _ts_decorate50(decorators, target, key, desc) {
|
|
|
13574
13838
|
}
|
|
13575
13839
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13576
13840
|
}
|
|
13577
|
-
__name(
|
|
13578
|
-
function
|
|
13841
|
+
__name(_ts_decorate51, "_ts_decorate");
|
|
13842
|
+
function _ts_metadata50(metadataKey, metadataValue) {
|
|
13579
13843
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13580
13844
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13581
13845
|
}
|
|
13582
13846
|
}
|
|
13583
|
-
__name(
|
|
13847
|
+
__name(_ts_metadata50, "_ts_metadata");
|
|
13584
13848
|
function _ts_param29(paramIndex, decorator) {
|
|
13585
13849
|
return function(target, key) {
|
|
13586
13850
|
decorator(target, key, paramIndex);
|
|
@@ -13686,63 +13950,64 @@ var SessionController = class {
|
|
|
13686
13950
|
});
|
|
13687
13951
|
}
|
|
13688
13952
|
};
|
|
13689
|
-
|
|
13953
|
+
_ts_decorate51([
|
|
13690
13954
|
Throttle(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
13691
13955
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.listSessions),
|
|
13692
13956
|
Get(),
|
|
13693
13957
|
_ts_param29(0, CurrentUser()),
|
|
13694
13958
|
_ts_param29(1, Req()),
|
|
13695
|
-
|
|
13696
|
-
|
|
13959
|
+
_ts_metadata50("design:type", Function),
|
|
13960
|
+
_ts_metadata50("design:paramtypes", [
|
|
13697
13961
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
13698
13962
|
typeof Request === "undefined" ? Object : Request
|
|
13699
13963
|
]),
|
|
13700
|
-
|
|
13964
|
+
_ts_metadata50("design:returntype", Promise)
|
|
13701
13965
|
], SessionController.prototype, "listSessions", null);
|
|
13702
|
-
|
|
13966
|
+
_ts_decorate51([
|
|
13703
13967
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13704
13968
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeAllSessions),
|
|
13705
13969
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13970
|
+
RequestEncoding("unchecked"),
|
|
13706
13971
|
Post("revoke-all"),
|
|
13707
13972
|
_ts_param29(0, CurrentUser()),
|
|
13708
13973
|
_ts_param29(1, Req()),
|
|
13709
|
-
|
|
13710
|
-
|
|
13974
|
+
_ts_metadata50("design:type", Function),
|
|
13975
|
+
_ts_metadata50("design:paramtypes", [
|
|
13711
13976
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
13712
13977
|
typeof Request === "undefined" ? Object : Request
|
|
13713
13978
|
]),
|
|
13714
|
-
|
|
13979
|
+
_ts_metadata50("design:returntype", Promise)
|
|
13715
13980
|
], SessionController.prototype, "revokeAllSessions", null);
|
|
13716
|
-
|
|
13981
|
+
_ts_decorate51([
|
|
13717
13982
|
Throttle(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
13718
13983
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.revokeSession),
|
|
13719
13984
|
HttpCode(HttpStatus.NO_CONTENT),
|
|
13720
13985
|
Delete(":id"),
|
|
13721
13986
|
_ts_param29(0, CurrentUser()),
|
|
13722
13987
|
_ts_param29(1, Param("id")),
|
|
13723
|
-
|
|
13724
|
-
|
|
13988
|
+
_ts_metadata50("design:type", Function),
|
|
13989
|
+
_ts_metadata50("design:paramtypes", [
|
|
13725
13990
|
typeof DashboardJwtPayload === "undefined" ? Object : DashboardJwtPayload,
|
|
13726
13991
|
String
|
|
13727
13992
|
]),
|
|
13728
|
-
|
|
13993
|
+
_ts_metadata50("design:returntype", Promise)
|
|
13729
13994
|
], SessionController.prototype, "revokeSession", null);
|
|
13730
|
-
SessionController =
|
|
13995
|
+
SessionController = _ts_decorate51([
|
|
13731
13996
|
UseInterceptors(NoStoreInterceptor),
|
|
13732
13997
|
Controller("sessions"),
|
|
13733
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard, JwtAuthGuard, UserStatusGuard),
|
|
13998
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard, JwtAuthGuard, UserStatusGuard),
|
|
13734
13999
|
UsePipes(createAuthValidationPipe()),
|
|
13735
14000
|
_ts_param29(0, Inject(SessionService)),
|
|
13736
14001
|
_ts_param29(1, Inject(TokenDeliveryService)),
|
|
13737
|
-
|
|
13738
|
-
|
|
14002
|
+
_ts_metadata50("design:type", Function),
|
|
14003
|
+
_ts_metadata50("design:paramtypes", [
|
|
13739
14004
|
typeof SessionService === "undefined" ? Object : SessionService,
|
|
13740
14005
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService
|
|
13741
14006
|
])
|
|
13742
14007
|
], SessionController);
|
|
13743
14008
|
var API_KEY_SCOPES_KEY = /* @__PURE__ */ Symbol("bymax:apiKeyScopes");
|
|
13744
14009
|
var ApiKeyScopes = /* @__PURE__ */ __name((...scopes) => SetMetadata(API_KEY_SCOPES_KEY, scopes), "ApiKeyScopes");
|
|
13745
|
-
function
|
|
14010
|
+
function _ts_decorate52(decorators, target, key, desc) {
|
|
13746
14011
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13747
14012
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13748
14013
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13755,13 +14020,13 @@ function _ts_decorate51(decorators, target, key, desc) {
|
|
|
13755
14020
|
}
|
|
13756
14021
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13757
14022
|
}
|
|
13758
|
-
__name(
|
|
13759
|
-
function
|
|
14023
|
+
__name(_ts_decorate52, "_ts_decorate");
|
|
14024
|
+
function _ts_metadata51(metadataKey, metadataValue) {
|
|
13760
14025
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13761
14026
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13762
14027
|
}
|
|
13763
14028
|
}
|
|
13764
|
-
__name(
|
|
14029
|
+
__name(_ts_metadata51, "_ts_metadata");
|
|
13765
14030
|
function _ts_param30(paramIndex, decorator) {
|
|
13766
14031
|
return function(target, key) {
|
|
13767
14032
|
decorator(target, key, paramIndex);
|
|
@@ -13828,12 +14093,12 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
|
|
|
13828
14093
|
await this.flush();
|
|
13829
14094
|
}
|
|
13830
14095
|
};
|
|
13831
|
-
ApiKeyLastUsedService =
|
|
14096
|
+
ApiKeyLastUsedService = _ts_decorate52([
|
|
13832
14097
|
Injectable(),
|
|
13833
14098
|
_ts_param30(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
13834
14099
|
_ts_param30(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
13835
|
-
|
|
13836
|
-
|
|
14100
|
+
_ts_metadata51("design:type", Function),
|
|
14101
|
+
_ts_metadata51("design:paramtypes", [
|
|
13837
14102
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
13838
14103
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
13839
14104
|
])
|
|
@@ -13882,7 +14147,7 @@ function digestsMatch(computed, stored) {
|
|
|
13882
14147
|
__name(digestsMatch, "digestsMatch");
|
|
13883
14148
|
|
|
13884
14149
|
// src/server/services/api-key-verifier.service.ts
|
|
13885
|
-
function
|
|
14150
|
+
function _ts_decorate53(decorators, target, key, desc) {
|
|
13886
14151
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13887
14152
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13888
14153
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13895,13 +14160,13 @@ function _ts_decorate52(decorators, target, key, desc) {
|
|
|
13895
14160
|
}
|
|
13896
14161
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13897
14162
|
}
|
|
13898
|
-
__name(
|
|
13899
|
-
function
|
|
14163
|
+
__name(_ts_decorate53, "_ts_decorate");
|
|
14164
|
+
function _ts_metadata52(metadataKey, metadataValue) {
|
|
13900
14165
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
13901
14166
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
13902
14167
|
}
|
|
13903
14168
|
}
|
|
13904
|
-
__name(
|
|
14169
|
+
__name(_ts_metadata52, "_ts_metadata");
|
|
13905
14170
|
function _ts_param31(paramIndex, decorator) {
|
|
13906
14171
|
return function(target, key) {
|
|
13907
14172
|
decorator(target, key, paramIndex);
|
|
@@ -13967,14 +14232,14 @@ var ApiKeyVerifierService = class {
|
|
|
13967
14232
|
return null;
|
|
13968
14233
|
}
|
|
13969
14234
|
};
|
|
13970
|
-
ApiKeyVerifierService =
|
|
14235
|
+
ApiKeyVerifierService = _ts_decorate53([
|
|
13971
14236
|
Injectable(),
|
|
13972
14237
|
_ts_param31(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
13973
14238
|
_ts_param31(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
13974
14239
|
_ts_param31(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
13975
14240
|
_ts_param31(3, Inject(ApiKeyLastUsedService)),
|
|
13976
|
-
|
|
13977
|
-
|
|
14241
|
+
_ts_metadata52("design:type", Function),
|
|
14242
|
+
_ts_metadata52("design:paramtypes", [
|
|
13978
14243
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
13979
14244
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
13980
14245
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -13983,7 +14248,7 @@ ApiKeyVerifierService = _ts_decorate52([
|
|
|
13983
14248
|
], ApiKeyVerifierService);
|
|
13984
14249
|
|
|
13985
14250
|
// src/server/guards/api-key.guard.ts
|
|
13986
|
-
function
|
|
14251
|
+
function _ts_decorate54(decorators, target, key, desc) {
|
|
13987
14252
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13988
14253
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
13989
14254
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13996,13 +14261,13 @@ function _ts_decorate53(decorators, target, key, desc) {
|
|
|
13996
14261
|
}
|
|
13997
14262
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13998
14263
|
}
|
|
13999
|
-
__name(
|
|
14000
|
-
function
|
|
14264
|
+
__name(_ts_decorate54, "_ts_decorate");
|
|
14265
|
+
function _ts_metadata53(metadataKey, metadataValue) {
|
|
14001
14266
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14002
14267
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14003
14268
|
}
|
|
14004
14269
|
}
|
|
14005
|
-
__name(
|
|
14270
|
+
__name(_ts_metadata53, "_ts_metadata");
|
|
14006
14271
|
function _ts_param32(paramIndex, decorator) {
|
|
14007
14272
|
return function(target, key) {
|
|
14008
14273
|
decorator(target, key, paramIndex);
|
|
@@ -14148,15 +14413,15 @@ var ApiKeyGuard = class _ApiKeyGuard {
|
|
|
14148
14413
|
};
|
|
14149
14414
|
}
|
|
14150
14415
|
};
|
|
14151
|
-
ApiKeyGuard =
|
|
14416
|
+
ApiKeyGuard = _ts_decorate54([
|
|
14152
14417
|
Injectable(),
|
|
14153
14418
|
_ts_param32(0, Inject(Reflector)),
|
|
14154
14419
|
_ts_param32(1, Inject(ApiKeyVerifierService)),
|
|
14155
14420
|
_ts_param32(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14156
14421
|
_ts_param32(3, Inject(BYMAX_AUTH_HOOKS)),
|
|
14157
14422
|
_ts_param32(3, Optional()),
|
|
14158
|
-
|
|
14159
|
-
|
|
14423
|
+
_ts_metadata53("design:type", Function),
|
|
14424
|
+
_ts_metadata53("design:paramtypes", [
|
|
14160
14425
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
14161
14426
|
typeof ApiKeyVerifierService === "undefined" ? Object : ApiKeyVerifierService,
|
|
14162
14427
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
@@ -14168,7 +14433,7 @@ function routePattern(request) {
|
|
|
14168
14433
|
return typeof path === "string" ? path : "";
|
|
14169
14434
|
}
|
|
14170
14435
|
__name(routePattern, "routePattern");
|
|
14171
|
-
function
|
|
14436
|
+
function _ts_decorate55(decorators, target, key, desc) {
|
|
14172
14437
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14173
14438
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14174
14439
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14181,13 +14446,13 @@ function _ts_decorate54(decorators, target, key, desc) {
|
|
|
14181
14446
|
}
|
|
14182
14447
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14183
14448
|
}
|
|
14184
|
-
__name(
|
|
14185
|
-
function
|
|
14449
|
+
__name(_ts_decorate55, "_ts_decorate");
|
|
14450
|
+
function _ts_metadata54(metadataKey, metadataValue) {
|
|
14186
14451
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14187
14452
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14188
14453
|
}
|
|
14189
14454
|
}
|
|
14190
|
-
__name(
|
|
14455
|
+
__name(_ts_metadata54, "_ts_metadata");
|
|
14191
14456
|
function _ts_param33(paramIndex, decorator) {
|
|
14192
14457
|
return function(target, key) {
|
|
14193
14458
|
decorator(target, key, paramIndex);
|
|
@@ -14220,11 +14485,11 @@ var MfaRequiredGuard = class {
|
|
|
14220
14485
|
return true;
|
|
14221
14486
|
}
|
|
14222
14487
|
};
|
|
14223
|
-
MfaRequiredGuard =
|
|
14488
|
+
MfaRequiredGuard = _ts_decorate55([
|
|
14224
14489
|
Injectable(),
|
|
14225
14490
|
_ts_param33(0, Inject(Reflector)),
|
|
14226
|
-
|
|
14227
|
-
|
|
14491
|
+
_ts_metadata54("design:type", Function),
|
|
14492
|
+
_ts_metadata54("design:paramtypes", [
|
|
14228
14493
|
typeof Reflector === "undefined" ? Object : Reflector
|
|
14229
14494
|
])
|
|
14230
14495
|
], MfaRequiredGuard);
|
|
@@ -14232,7 +14497,7 @@ var PLATFORM_ROLES_KEY = /* @__PURE__ */ Symbol("platformRoles");
|
|
|
14232
14497
|
var PlatformRoles = /* @__PURE__ */ __name((...roles) => SetMetadata(PLATFORM_ROLES_KEY, roles), "PlatformRoles");
|
|
14233
14498
|
|
|
14234
14499
|
// src/server/guards/platform-roles.guard.ts
|
|
14235
|
-
function
|
|
14500
|
+
function _ts_decorate56(decorators, target, key, desc) {
|
|
14236
14501
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14237
14502
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14238
14503
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14245,13 +14510,13 @@ function _ts_decorate55(decorators, target, key, desc) {
|
|
|
14245
14510
|
}
|
|
14246
14511
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14247
14512
|
}
|
|
14248
|
-
__name(
|
|
14249
|
-
function
|
|
14513
|
+
__name(_ts_decorate56, "_ts_decorate");
|
|
14514
|
+
function _ts_metadata55(metadataKey, metadataValue) {
|
|
14250
14515
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14251
14516
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14252
14517
|
}
|
|
14253
14518
|
}
|
|
14254
|
-
__name(
|
|
14519
|
+
__name(_ts_metadata55, "_ts_metadata");
|
|
14255
14520
|
function _ts_param34(paramIndex, decorator) {
|
|
14256
14521
|
return function(target, key) {
|
|
14257
14522
|
decorator(target, key, paramIndex);
|
|
@@ -14291,12 +14556,12 @@ var PlatformRolesGuard = class {
|
|
|
14291
14556
|
return true;
|
|
14292
14557
|
}
|
|
14293
14558
|
};
|
|
14294
|
-
PlatformRolesGuard =
|
|
14559
|
+
PlatformRolesGuard = _ts_decorate56([
|
|
14295
14560
|
Injectable(),
|
|
14296
14561
|
_ts_param34(0, Inject(Reflector)),
|
|
14297
14562
|
_ts_param34(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14298
|
-
|
|
14299
|
-
|
|
14563
|
+
_ts_metadata55("design:type", Function),
|
|
14564
|
+
_ts_metadata55("design:paramtypes", [
|
|
14300
14565
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
14301
14566
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14302
14567
|
])
|
|
@@ -14305,7 +14570,7 @@ var ROLES_KEY = "roles";
|
|
|
14305
14570
|
var Roles = /* @__PURE__ */ __name((...roles) => SetMetadata(ROLES_KEY, roles), "Roles");
|
|
14306
14571
|
|
|
14307
14572
|
// src/server/guards/roles.guard.ts
|
|
14308
|
-
function
|
|
14573
|
+
function _ts_decorate57(decorators, target, key, desc) {
|
|
14309
14574
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14310
14575
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14311
14576
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14318,13 +14583,13 @@ function _ts_decorate56(decorators, target, key, desc) {
|
|
|
14318
14583
|
}
|
|
14319
14584
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14320
14585
|
}
|
|
14321
|
-
__name(
|
|
14322
|
-
function
|
|
14586
|
+
__name(_ts_decorate57, "_ts_decorate");
|
|
14587
|
+
function _ts_metadata56(metadataKey, metadataValue) {
|
|
14323
14588
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14324
14589
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14325
14590
|
}
|
|
14326
14591
|
}
|
|
14327
|
-
__name(
|
|
14592
|
+
__name(_ts_metadata56, "_ts_metadata");
|
|
14328
14593
|
function _ts_param35(paramIndex, decorator) {
|
|
14329
14594
|
return function(target, key) {
|
|
14330
14595
|
decorator(target, key, paramIndex);
|
|
@@ -14360,17 +14625,17 @@ var RolesGuard = class {
|
|
|
14360
14625
|
return true;
|
|
14361
14626
|
}
|
|
14362
14627
|
};
|
|
14363
|
-
RolesGuard =
|
|
14628
|
+
RolesGuard = _ts_decorate57([
|
|
14364
14629
|
Injectable(),
|
|
14365
14630
|
_ts_param35(0, Inject(Reflector)),
|
|
14366
14631
|
_ts_param35(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14367
|
-
|
|
14368
|
-
|
|
14632
|
+
_ts_metadata56("design:type", Function),
|
|
14633
|
+
_ts_metadata56("design:paramtypes", [
|
|
14369
14634
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
14370
14635
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14371
14636
|
])
|
|
14372
14637
|
], RolesGuard);
|
|
14373
|
-
function
|
|
14638
|
+
function _ts_decorate58(decorators, target, key, desc) {
|
|
14374
14639
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14375
14640
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14376
14641
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14383,7 +14648,7 @@ function _ts_decorate57(decorators, target, key, desc) {
|
|
|
14383
14648
|
}
|
|
14384
14649
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14385
14650
|
}
|
|
14386
|
-
__name(
|
|
14651
|
+
__name(_ts_decorate58, "_ts_decorate");
|
|
14387
14652
|
var NoOpAuthHooks = class {
|
|
14388
14653
|
static {
|
|
14389
14654
|
__name(this, "NoOpAuthHooks");
|
|
@@ -14432,7 +14697,7 @@ var NoOpAuthHooks = class {
|
|
|
14432
14697
|
};
|
|
14433
14698
|
}
|
|
14434
14699
|
};
|
|
14435
|
-
NoOpAuthHooks =
|
|
14700
|
+
NoOpAuthHooks = _ts_decorate58([
|
|
14436
14701
|
Injectable()
|
|
14437
14702
|
], NoOpAuthHooks);
|
|
14438
14703
|
|
|
@@ -14445,7 +14710,7 @@ var OAUTH_STATE_COOKIE_SAME_SITE = "lax";
|
|
|
14445
14710
|
var OAUTH_STATE_COOKIE_MAX_AGE_SECONDS = 600;
|
|
14446
14711
|
|
|
14447
14712
|
// src/server/oauth/oauth.service.ts
|
|
14448
|
-
function
|
|
14713
|
+
function _ts_decorate59(decorators, target, key, desc) {
|
|
14449
14714
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14450
14715
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14451
14716
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14458,13 +14723,13 @@ function _ts_decorate58(decorators, target, key, desc) {
|
|
|
14458
14723
|
}
|
|
14459
14724
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14460
14725
|
}
|
|
14461
|
-
__name(
|
|
14462
|
-
function
|
|
14726
|
+
__name(_ts_decorate59, "_ts_decorate");
|
|
14727
|
+
function _ts_metadata57(metadataKey, metadataValue) {
|
|
14463
14728
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14464
14729
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14465
14730
|
}
|
|
14466
14731
|
}
|
|
14467
|
-
__name(
|
|
14732
|
+
__name(_ts_metadata57, "_ts_metadata");
|
|
14468
14733
|
function _ts_param36(paramIndex, decorator) {
|
|
14469
14734
|
return function(target, key) {
|
|
14470
14735
|
decorator(target, key, paramIndex);
|
|
@@ -14764,7 +15029,7 @@ var OAuthService = class _OAuthService {
|
|
|
14764
15029
|
return plugin;
|
|
14765
15030
|
}
|
|
14766
15031
|
};
|
|
14767
|
-
OAuthService =
|
|
15032
|
+
OAuthService = _ts_decorate59([
|
|
14768
15033
|
Injectable(),
|
|
14769
15034
|
_ts_param36(0, Inject(OAUTH_PLUGINS)),
|
|
14770
15035
|
_ts_param36(1, Inject(BYMAX_AUTH_USER_REPOSITORY)),
|
|
@@ -14774,8 +15039,8 @@ OAuthService = _ts_decorate58([
|
|
|
14774
15039
|
_ts_param36(4, Inject(TokenManagerService)),
|
|
14775
15040
|
_ts_param36(5, Inject(SessionService)),
|
|
14776
15041
|
_ts_param36(6, Inject(BYMAX_AUTH_OPTIONS)),
|
|
14777
|
-
|
|
14778
|
-
|
|
15042
|
+
_ts_metadata57("design:type", Function),
|
|
15043
|
+
_ts_metadata57("design:paramtypes", [
|
|
14779
15044
|
Array,
|
|
14780
15045
|
typeof IUserRepository === "undefined" ? Object : IUserRepository,
|
|
14781
15046
|
Object,
|
|
@@ -14785,7 +15050,7 @@ OAuthService = _ts_decorate58([
|
|
|
14785
15050
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
14786
15051
|
])
|
|
14787
15052
|
], OAuthService);
|
|
14788
|
-
function
|
|
15053
|
+
function _ts_decorate60(decorators, target, key, desc) {
|
|
14789
15054
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14790
15055
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14791
15056
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14798,13 +15063,13 @@ function _ts_decorate59(decorators, target, key, desc) {
|
|
|
14798
15063
|
}
|
|
14799
15064
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14800
15065
|
}
|
|
14801
|
-
__name(
|
|
14802
|
-
function
|
|
15066
|
+
__name(_ts_decorate60, "_ts_decorate");
|
|
15067
|
+
function _ts_metadata58(metadataKey, metadataValue) {
|
|
14803
15068
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14804
15069
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14805
15070
|
}
|
|
14806
15071
|
}
|
|
14807
|
-
__name(
|
|
15072
|
+
__name(_ts_metadata58, "_ts_metadata");
|
|
14808
15073
|
var OAuthCallbackQueryDto = class {
|
|
14809
15074
|
static {
|
|
14810
15075
|
__name(this, "OAuthCallbackQueryDto");
|
|
@@ -14903,69 +15168,69 @@ var OAuthCallbackQueryDto = class {
|
|
|
14903
15168
|
*/
|
|
14904
15169
|
hd;
|
|
14905
15170
|
};
|
|
14906
|
-
|
|
15171
|
+
_ts_decorate60([
|
|
14907
15172
|
ValidateIf((query) => query.error === void 0 || query.error === null),
|
|
14908
15173
|
IsOptional(),
|
|
14909
15174
|
IsString(),
|
|
14910
15175
|
IsNotEmpty(),
|
|
14911
15176
|
MaxLength(2048),
|
|
14912
|
-
|
|
15177
|
+
_ts_metadata58("design:type", String)
|
|
14913
15178
|
], OAuthCallbackQueryDto.prototype, "code", void 0);
|
|
14914
|
-
|
|
15179
|
+
_ts_decorate60([
|
|
14915
15180
|
IsOptional(),
|
|
14916
15181
|
IsString(),
|
|
14917
15182
|
MaxLength(128),
|
|
14918
|
-
|
|
15183
|
+
_ts_metadata58("design:type", String)
|
|
14919
15184
|
], OAuthCallbackQueryDto.prototype, "error", void 0);
|
|
14920
|
-
|
|
15185
|
+
_ts_decorate60([
|
|
14921
15186
|
IsOptional(),
|
|
14922
15187
|
IsString(),
|
|
14923
15188
|
MaxLength(512),
|
|
14924
|
-
|
|
15189
|
+
_ts_metadata58("design:type", String)
|
|
14925
15190
|
], OAuthCallbackQueryDto.prototype, "error_description", void 0);
|
|
14926
|
-
|
|
15191
|
+
_ts_decorate60([
|
|
14927
15192
|
IsOptional(),
|
|
14928
15193
|
IsString(),
|
|
14929
15194
|
MaxLength(512),
|
|
14930
|
-
|
|
15195
|
+
_ts_metadata58("design:type", String)
|
|
14931
15196
|
], OAuthCallbackQueryDto.prototype, "error_uri", void 0);
|
|
14932
|
-
|
|
15197
|
+
_ts_decorate60([
|
|
14933
15198
|
IsString(),
|
|
14934
15199
|
IsNotEmpty(),
|
|
14935
15200
|
MaxLength(128),
|
|
14936
|
-
|
|
15201
|
+
_ts_metadata58("design:type", String)
|
|
14937
15202
|
], OAuthCallbackQueryDto.prototype, "state", void 0);
|
|
14938
|
-
|
|
15203
|
+
_ts_decorate60([
|
|
14939
15204
|
IsOptional(),
|
|
14940
15205
|
IsString(),
|
|
14941
15206
|
MaxLength(512),
|
|
14942
|
-
|
|
15207
|
+
_ts_metadata58("design:type", String)
|
|
14943
15208
|
], OAuthCallbackQueryDto.prototype, "iss", void 0);
|
|
14944
|
-
|
|
15209
|
+
_ts_decorate60([
|
|
14945
15210
|
IsOptional(),
|
|
14946
15211
|
IsString(),
|
|
14947
15212
|
MaxLength(2048),
|
|
14948
|
-
|
|
15213
|
+
_ts_metadata58("design:type", String)
|
|
14949
15214
|
], OAuthCallbackQueryDto.prototype, "scope", void 0);
|
|
14950
|
-
|
|
15215
|
+
_ts_decorate60([
|
|
14951
15216
|
IsOptional(),
|
|
14952
15217
|
IsString(),
|
|
14953
15218
|
MaxLength(16),
|
|
14954
|
-
|
|
15219
|
+
_ts_metadata58("design:type", String)
|
|
14955
15220
|
], OAuthCallbackQueryDto.prototype, "authuser", void 0);
|
|
14956
|
-
|
|
15221
|
+
_ts_decorate60([
|
|
14957
15222
|
IsOptional(),
|
|
14958
15223
|
IsString(),
|
|
14959
15224
|
MaxLength(64),
|
|
14960
|
-
|
|
15225
|
+
_ts_metadata58("design:type", String)
|
|
14961
15226
|
], OAuthCallbackQueryDto.prototype, "prompt", void 0);
|
|
14962
|
-
|
|
15227
|
+
_ts_decorate60([
|
|
14963
15228
|
IsOptional(),
|
|
14964
15229
|
IsString(),
|
|
14965
15230
|
MaxLength(253),
|
|
14966
|
-
|
|
15231
|
+
_ts_metadata58("design:type", String)
|
|
14967
15232
|
], OAuthCallbackQueryDto.prototype, "hd", void 0);
|
|
14968
|
-
function
|
|
15233
|
+
function _ts_decorate61(decorators, target, key, desc) {
|
|
14969
15234
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14970
15235
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
14971
15236
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -14978,13 +15243,13 @@ function _ts_decorate60(decorators, target, key, desc) {
|
|
|
14978
15243
|
}
|
|
14979
15244
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14980
15245
|
}
|
|
14981
|
-
__name(
|
|
14982
|
-
function
|
|
15246
|
+
__name(_ts_decorate61, "_ts_decorate");
|
|
15247
|
+
function _ts_metadata59(metadataKey, metadataValue) {
|
|
14983
15248
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
14984
15249
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
14985
15250
|
}
|
|
14986
15251
|
}
|
|
14987
|
-
__name(
|
|
15252
|
+
__name(_ts_metadata59, "_ts_metadata");
|
|
14988
15253
|
var OAuthInitiateQueryDto = class {
|
|
14989
15254
|
static {
|
|
14990
15255
|
__name(this, "OAuthInitiateQueryDto");
|
|
@@ -15001,7 +15266,7 @@ var OAuthInitiateQueryDto = class {
|
|
|
15001
15266
|
*/
|
|
15002
15267
|
tenantId;
|
|
15003
15268
|
};
|
|
15004
|
-
|
|
15269
|
+
_ts_decorate61([
|
|
15005
15270
|
IsOptional(),
|
|
15006
15271
|
IsString(),
|
|
15007
15272
|
IsNotEmpty(),
|
|
@@ -15009,11 +15274,11 @@ _ts_decorate60([
|
|
|
15009
15274
|
Matches(NO_CONTROL_CHARACTERS, {
|
|
15010
15275
|
message: "tenantId must not contain control characters"
|
|
15011
15276
|
}),
|
|
15012
|
-
|
|
15277
|
+
_ts_metadata59("design:type", String)
|
|
15013
15278
|
], OAuthInitiateQueryDto.prototype, "tenantId", void 0);
|
|
15014
15279
|
|
|
15015
15280
|
// src/server/oauth/oauth.controller.ts
|
|
15016
|
-
function
|
|
15281
|
+
function _ts_decorate62(decorators, target, key, desc) {
|
|
15017
15282
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15018
15283
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15019
15284
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15026,13 +15291,13 @@ function _ts_decorate61(decorators, target, key, desc) {
|
|
|
15026
15291
|
}
|
|
15027
15292
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15028
15293
|
}
|
|
15029
|
-
__name(
|
|
15030
|
-
function
|
|
15294
|
+
__name(_ts_decorate62, "_ts_decorate");
|
|
15295
|
+
function _ts_metadata60(metadataKey, metadataValue) {
|
|
15031
15296
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
15032
15297
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
15033
15298
|
}
|
|
15034
15299
|
}
|
|
15035
|
-
__name(
|
|
15300
|
+
__name(_ts_metadata60, "_ts_metadata");
|
|
15036
15301
|
function _ts_param37(paramIndex, decorator) {
|
|
15037
15302
|
return function(target, key) {
|
|
15038
15303
|
decorator(target, key, paramIndex);
|
|
@@ -15256,7 +15521,7 @@ var OAuthController = class _OAuthController {
|
|
|
15256
15521
|
});
|
|
15257
15522
|
}
|
|
15258
15523
|
};
|
|
15259
|
-
|
|
15524
|
+
_ts_decorate62([
|
|
15260
15525
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
15261
15526
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthInitiate),
|
|
15262
15527
|
Get(":provider"),
|
|
@@ -15266,16 +15531,16 @@ _ts_decorate61([
|
|
|
15266
15531
|
_ts_param37(3, Res({
|
|
15267
15532
|
passthrough: true
|
|
15268
15533
|
})),
|
|
15269
|
-
|
|
15270
|
-
|
|
15534
|
+
_ts_metadata60("design:type", Function),
|
|
15535
|
+
_ts_metadata60("design:paramtypes", [
|
|
15271
15536
|
String,
|
|
15272
15537
|
typeof OAuthInitiateQueryDto === "undefined" ? Object : OAuthInitiateQueryDto,
|
|
15273
15538
|
typeof Request === "undefined" ? Object : Request,
|
|
15274
15539
|
typeof Response === "undefined" ? Object : Response
|
|
15275
15540
|
]),
|
|
15276
|
-
|
|
15541
|
+
_ts_metadata60("design:returntype", Promise)
|
|
15277
15542
|
], OAuthController.prototype, "initiate", null);
|
|
15278
|
-
|
|
15543
|
+
_ts_decorate62([
|
|
15279
15544
|
Throttle(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
15280
15545
|
AuthRateLimit(AUTH_THROTTLE_CONFIGS.oauthCallback),
|
|
15281
15546
|
HttpCode(HttpStatus.OK),
|
|
@@ -15286,29 +15551,29 @@ _ts_decorate61([
|
|
|
15286
15551
|
_ts_param37(3, Res({
|
|
15287
15552
|
passthrough: true
|
|
15288
15553
|
})),
|
|
15289
|
-
|
|
15290
|
-
|
|
15554
|
+
_ts_metadata60("design:type", Function),
|
|
15555
|
+
_ts_metadata60("design:paramtypes", [
|
|
15291
15556
|
String,
|
|
15292
15557
|
typeof OAuthCallbackQueryDto === "undefined" ? Object : OAuthCallbackQueryDto,
|
|
15293
15558
|
typeof Request === "undefined" ? Object : Request,
|
|
15294
15559
|
typeof Response === "undefined" ? Object : Response
|
|
15295
15560
|
]),
|
|
15296
|
-
|
|
15561
|
+
_ts_metadata60("design:returntype", Promise)
|
|
15297
15562
|
], OAuthController.prototype, "callback", null);
|
|
15298
|
-
OAuthController =
|
|
15563
|
+
OAuthController = _ts_decorate62([
|
|
15299
15564
|
Public(),
|
|
15300
15565
|
SkipMfa(),
|
|
15301
15566
|
UseInterceptors(NoStoreInterceptor),
|
|
15302
15567
|
Controller("oauth"),
|
|
15303
|
-
UseGuards(TrustedOriginGuard, AuthRateLimitGuard),
|
|
15568
|
+
UseGuards(RequestEncodingGuard, TrustedOriginGuard, AuthRateLimitGuard),
|
|
15304
15569
|
UsePipes(createAuthValidationPipe({
|
|
15305
15570
|
forbidUnknownValues: true
|
|
15306
15571
|
})),
|
|
15307
15572
|
_ts_param37(0, Inject(OAuthService)),
|
|
15308
15573
|
_ts_param37(1, Inject(TokenDeliveryService)),
|
|
15309
15574
|
_ts_param37(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
15310
|
-
|
|
15311
|
-
|
|
15575
|
+
_ts_metadata60("design:type", Function),
|
|
15576
|
+
_ts_metadata60("design:paramtypes", [
|
|
15312
15577
|
typeof OAuthService === "undefined" ? Object : OAuthService,
|
|
15313
15578
|
typeof TokenDeliveryService === "undefined" ? Object : TokenDeliveryService,
|
|
15314
15579
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -15447,7 +15712,7 @@ var GoogleOAuthPlugin = class {
|
|
|
15447
15712
|
};
|
|
15448
15713
|
|
|
15449
15714
|
// src/server/oauth/oauth.module.ts
|
|
15450
|
-
function
|
|
15715
|
+
function _ts_decorate63(decorators, target, key, desc) {
|
|
15451
15716
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15452
15717
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15453
15718
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -15460,7 +15725,7 @@ function _ts_decorate62(decorators, target, key, desc) {
|
|
|
15460
15725
|
}
|
|
15461
15726
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15462
15727
|
}
|
|
15463
|
-
__name(
|
|
15728
|
+
__name(_ts_decorate63, "_ts_decorate");
|
|
15464
15729
|
function buildOAuthPlugins(options) {
|
|
15465
15730
|
const plugins = [];
|
|
15466
15731
|
if (options.oauth?.google) {
|
|
@@ -15530,7 +15795,7 @@ var OAuthModule = class _OAuthModule {
|
|
|
15530
15795
|
};
|
|
15531
15796
|
}
|
|
15532
15797
|
};
|
|
15533
|
-
OAuthModule =
|
|
15798
|
+
OAuthModule = _ts_decorate63([
|
|
15534
15799
|
Module({})
|
|
15535
15800
|
], OAuthModule);
|
|
15536
15801
|
|
|
@@ -16425,7 +16690,7 @@ function schemesFor(options, registered, cookieDelivery, bearerDelivery) {
|
|
|
16425
16690
|
__name(schemesFor, "schemesFor");
|
|
16426
16691
|
|
|
16427
16692
|
// src/server/openapi/auth-openapi.contributor.ts
|
|
16428
|
-
function
|
|
16693
|
+
function _ts_decorate64(decorators, target, key, desc) {
|
|
16429
16694
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16430
16695
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16431
16696
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16438,13 +16703,13 @@ function _ts_decorate63(decorators, target, key, desc) {
|
|
|
16438
16703
|
}
|
|
16439
16704
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16440
16705
|
}
|
|
16441
|
-
__name(
|
|
16442
|
-
function
|
|
16706
|
+
__name(_ts_decorate64, "_ts_decorate");
|
|
16707
|
+
function _ts_metadata61(metadataKey, metadataValue) {
|
|
16443
16708
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16444
16709
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16445
16710
|
}
|
|
16446
16711
|
}
|
|
16447
|
-
__name(
|
|
16712
|
+
__name(_ts_metadata61, "_ts_metadata");
|
|
16448
16713
|
function _ts_param38(paramIndex, decorator) {
|
|
16449
16714
|
return function(target, key) {
|
|
16450
16715
|
decorator(target, key, paramIndex);
|
|
@@ -16470,18 +16735,18 @@ var AuthOpenApiContributor = class {
|
|
|
16470
16735
|
return buildAuthOpenApiFragment(this.options, this.registered);
|
|
16471
16736
|
}
|
|
16472
16737
|
};
|
|
16473
|
-
AuthOpenApiContributor =
|
|
16738
|
+
AuthOpenApiContributor = _ts_decorate64([
|
|
16474
16739
|
Injectable(),
|
|
16475
16740
|
SetMetadata(OPENAPI_CONTRIBUTOR_METADATA, true),
|
|
16476
16741
|
_ts_param38(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
16477
16742
|
_ts_param38(1, Inject(BYMAX_AUTH_REGISTERED_CONTROLLERS)),
|
|
16478
|
-
|
|
16479
|
-
|
|
16743
|
+
_ts_metadata61("design:type", Function),
|
|
16744
|
+
_ts_metadata61("design:paramtypes", [
|
|
16480
16745
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
16481
16746
|
typeof RegisteredControllers === "undefined" ? Object : RegisteredControllers
|
|
16482
16747
|
])
|
|
16483
16748
|
], AuthOpenApiContributor);
|
|
16484
|
-
function
|
|
16749
|
+
function _ts_decorate65(decorators, target, key, desc) {
|
|
16485
16750
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16486
16751
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16487
16752
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16494,13 +16759,13 @@ function _ts_decorate64(decorators, target, key, desc) {
|
|
|
16494
16759
|
}
|
|
16495
16760
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16496
16761
|
}
|
|
16497
|
-
__name(
|
|
16498
|
-
function
|
|
16762
|
+
__name(_ts_decorate65, "_ts_decorate");
|
|
16763
|
+
function _ts_metadata62(metadataKey, metadataValue) {
|
|
16499
16764
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16500
16765
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16501
16766
|
}
|
|
16502
16767
|
}
|
|
16503
|
-
__name(
|
|
16768
|
+
__name(_ts_metadata62, "_ts_metadata");
|
|
16504
16769
|
function _ts_param39(paramIndex, decorator) {
|
|
16505
16770
|
return function(target, key) {
|
|
16506
16771
|
decorator(target, key, paramIndex);
|
|
@@ -16812,16 +17077,16 @@ var CommonPasswordChecker = class {
|
|
|
16812
17077
|
return false;
|
|
16813
17078
|
}
|
|
16814
17079
|
};
|
|
16815
|
-
CommonPasswordChecker =
|
|
17080
|
+
CommonPasswordChecker = _ts_decorate65([
|
|
16816
17081
|
Injectable(),
|
|
16817
17082
|
_ts_param39(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
16818
17083
|
_ts_param39(0, Optional()),
|
|
16819
|
-
|
|
16820
|
-
|
|
17084
|
+
_ts_metadata62("design:type", Function),
|
|
17085
|
+
_ts_metadata62("design:paramtypes", [
|
|
16821
17086
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
16822
17087
|
])
|
|
16823
17088
|
], CommonPasswordChecker);
|
|
16824
|
-
function
|
|
17089
|
+
function _ts_decorate66(decorators, target, key, desc) {
|
|
16825
17090
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16826
17091
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16827
17092
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16834,7 +17099,7 @@ function _ts_decorate65(decorators, target, key, desc) {
|
|
|
16834
17099
|
}
|
|
16835
17100
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16836
17101
|
}
|
|
16837
|
-
__name(
|
|
17102
|
+
__name(_ts_decorate66, "_ts_decorate");
|
|
16838
17103
|
var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
16839
17104
|
static {
|
|
16840
17105
|
__name(this, "NoOpEmailProvider");
|
|
@@ -16869,7 +17134,7 @@ var NoOpEmailProvider = class _NoOpEmailProvider {
|
|
|
16869
17134
|
this.logger.log(`sendInvitation \u2192 ${maskEmail(email)} (no-op)`);
|
|
16870
17135
|
}
|
|
16871
17136
|
};
|
|
16872
|
-
NoOpEmailProvider =
|
|
17137
|
+
NoOpEmailProvider = _ts_decorate66([
|
|
16873
17138
|
Injectable()
|
|
16874
17139
|
], NoOpEmailProvider);
|
|
16875
17140
|
|
|
@@ -16883,7 +17148,7 @@ var SystemApiKeyClock = class {
|
|
|
16883
17148
|
return /* @__PURE__ */ new Date();
|
|
16884
17149
|
}
|
|
16885
17150
|
};
|
|
16886
|
-
function
|
|
17151
|
+
function _ts_decorate67(decorators, target, key, desc) {
|
|
16887
17152
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16888
17153
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16889
17154
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16896,13 +17161,13 @@ function _ts_decorate66(decorators, target, key, desc) {
|
|
|
16896
17161
|
}
|
|
16897
17162
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16898
17163
|
}
|
|
16899
|
-
__name(
|
|
16900
|
-
function
|
|
17164
|
+
__name(_ts_decorate67, "_ts_decorate");
|
|
17165
|
+
function _ts_metadata63(metadataKey, metadataValue) {
|
|
16901
17166
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16902
17167
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16903
17168
|
}
|
|
16904
17169
|
}
|
|
16905
|
-
__name(
|
|
17170
|
+
__name(_ts_metadata63, "_ts_metadata");
|
|
16906
17171
|
function _ts_param40(paramIndex, decorator) {
|
|
16907
17172
|
return function(target, key) {
|
|
16908
17173
|
decorator(target, key, paramIndex);
|
|
@@ -16951,21 +17216,21 @@ var ApiKeyScopeAuditService = class {
|
|
|
16951
17216
|
}
|
|
16952
17217
|
}
|
|
16953
17218
|
};
|
|
16954
|
-
ApiKeyScopeAuditService =
|
|
17219
|
+
ApiKeyScopeAuditService = _ts_decorate67([
|
|
16955
17220
|
Injectable(),
|
|
16956
17221
|
_ts_param40(0, Inject(DiscoveryService)),
|
|
16957
17222
|
_ts_param40(1, Inject(MetadataScanner)),
|
|
16958
17223
|
_ts_param40(2, Inject(Reflector)),
|
|
16959
17224
|
_ts_param40(3, Inject(BYMAX_AUTH_OPTIONS)),
|
|
16960
|
-
|
|
16961
|
-
|
|
17225
|
+
_ts_metadata63("design:type", Function),
|
|
17226
|
+
_ts_metadata63("design:paramtypes", [
|
|
16962
17227
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
16963
17228
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
16964
17229
|
typeof Reflector === "undefined" ? Object : Reflector,
|
|
16965
17230
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
16966
17231
|
])
|
|
16967
17232
|
], ApiKeyScopeAuditService);
|
|
16968
|
-
function
|
|
17233
|
+
function _ts_decorate68(decorators, target, key, desc) {
|
|
16969
17234
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16970
17235
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
16971
17236
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -16978,13 +17243,13 @@ function _ts_decorate67(decorators, target, key, desc) {
|
|
|
16978
17243
|
}
|
|
16979
17244
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16980
17245
|
}
|
|
16981
|
-
__name(
|
|
16982
|
-
function
|
|
17246
|
+
__name(_ts_decorate68, "_ts_decorate");
|
|
17247
|
+
function _ts_metadata64(metadataKey, metadataValue) {
|
|
16983
17248
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
16984
17249
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
16985
17250
|
}
|
|
16986
17251
|
}
|
|
16987
|
-
__name(
|
|
17252
|
+
__name(_ts_metadata64, "_ts_metadata");
|
|
16988
17253
|
function _ts_param41(paramIndex, decorator) {
|
|
16989
17254
|
return function(target, key) {
|
|
16990
17255
|
decorator(target, key, paramIndex);
|
|
@@ -17119,13 +17384,13 @@ var ApiKeyService = class {
|
|
|
17119
17384
|
return value;
|
|
17120
17385
|
}
|
|
17121
17386
|
};
|
|
17122
|
-
ApiKeyService =
|
|
17387
|
+
ApiKeyService = _ts_decorate68([
|
|
17123
17388
|
Injectable(),
|
|
17124
17389
|
_ts_param41(0, Inject(BYMAX_AUTH_API_KEY_REPOSITORY)),
|
|
17125
17390
|
_ts_param41(1, Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
17126
17391
|
_ts_param41(2, Inject(BYMAX_AUTH_OPTIONS)),
|
|
17127
|
-
|
|
17128
|
-
|
|
17392
|
+
_ts_metadata64("design:type", Function),
|
|
17393
|
+
_ts_metadata64("design:paramtypes", [
|
|
17129
17394
|
typeof IApiKeyRepository === "undefined" ? Object : IApiKeyRepository,
|
|
17130
17395
|
typeof ApiKeyClock === "undefined" ? Object : ApiKeyClock,
|
|
17131
17396
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
@@ -17207,7 +17472,7 @@ async function assertTenantBinding(options, handshake, tenantId) {
|
|
|
17207
17472
|
__name(assertTenantBinding, "assertTenantBinding");
|
|
17208
17473
|
|
|
17209
17474
|
// src/server/services/auth-token-verifier.service.ts
|
|
17210
|
-
function
|
|
17475
|
+
function _ts_decorate69(decorators, target, key, desc) {
|
|
17211
17476
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17212
17477
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17213
17478
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17220,13 +17485,13 @@ function _ts_decorate68(decorators, target, key, desc) {
|
|
|
17220
17485
|
}
|
|
17221
17486
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17222
17487
|
}
|
|
17223
|
-
__name(
|
|
17224
|
-
function
|
|
17488
|
+
__name(_ts_decorate69, "_ts_decorate");
|
|
17489
|
+
function _ts_metadata65(metadataKey, metadataValue) {
|
|
17225
17490
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
17226
17491
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
17227
17492
|
}
|
|
17228
17493
|
}
|
|
17229
|
-
__name(
|
|
17494
|
+
__name(_ts_metadata65, "_ts_metadata");
|
|
17230
17495
|
function _ts_param42(paramIndex, decorator) {
|
|
17231
17496
|
return function(target, key) {
|
|
17232
17497
|
decorator(target, key, paramIndex);
|
|
@@ -17416,14 +17681,14 @@ var AuthTokenVerifierService = class _AuthTokenVerifierService {
|
|
|
17416
17681
|
}
|
|
17417
17682
|
}
|
|
17418
17683
|
};
|
|
17419
|
-
AuthTokenVerifierService =
|
|
17684
|
+
AuthTokenVerifierService = _ts_decorate69([
|
|
17420
17685
|
Injectable(),
|
|
17421
17686
|
_ts_param42(0, Inject(JwtService)),
|
|
17422
17687
|
_ts_param42(1, Inject(BYMAX_AUTH_OPTIONS)),
|
|
17423
17688
|
_ts_param42(2, Inject(AuthRevocationService)),
|
|
17424
17689
|
_ts_param42(3, Inject(AccountStatusService)),
|
|
17425
|
-
|
|
17426
|
-
|
|
17690
|
+
_ts_metadata65("design:type", Function),
|
|
17691
|
+
_ts_metadata65("design:paramtypes", [
|
|
17427
17692
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
17428
17693
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions,
|
|
17429
17694
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
@@ -17432,7 +17697,7 @@ AuthTokenVerifierService = _ts_decorate68([
|
|
|
17432
17697
|
], AuthTokenVerifierService);
|
|
17433
17698
|
|
|
17434
17699
|
// src/server/bymax-auth.module.ts
|
|
17435
|
-
function
|
|
17700
|
+
function _ts_decorate70(decorators, target, key, desc) {
|
|
17436
17701
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17437
17702
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
17438
17703
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -17445,7 +17710,7 @@ function _ts_decorate69(decorators, target, key, desc) {
|
|
|
17445
17710
|
}
|
|
17446
17711
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17447
17712
|
}
|
|
17448
|
-
__name(
|
|
17713
|
+
__name(_ts_decorate70, "_ts_decorate");
|
|
17449
17714
|
function hasProviderToken(providers, token) {
|
|
17450
17715
|
return providers.some((p) => {
|
|
17451
17716
|
if (typeof p === "function") return false;
|
|
@@ -17705,6 +17970,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
17705
17970
|
AuthService,
|
|
17706
17971
|
// Guards — registered as providers so they can be applied via @UseGuards().
|
|
17707
17972
|
JwtAuthGuard,
|
|
17973
|
+
RequestEncodingGuard,
|
|
17708
17974
|
TrustedOriginGuard,
|
|
17709
17975
|
AuthRateLimitGuard,
|
|
17710
17976
|
// Response-header interceptor — every library controller applies it, so it must be
|
|
@@ -17737,6 +18003,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
17737
18003
|
AuthService,
|
|
17738
18004
|
// Export guards so host-app modules can apply them without reimporting.
|
|
17739
18005
|
JwtAuthGuard,
|
|
18006
|
+
RequestEncodingGuard,
|
|
17740
18007
|
TrustedOriginGuard,
|
|
17741
18008
|
AuthRateLimitGuard,
|
|
17742
18009
|
RolesGuard,
|
|
@@ -17835,7 +18102,7 @@ var BymaxAuthModule = class _BymaxAuthModule {
|
|
|
17835
18102
|
};
|
|
17836
18103
|
}
|
|
17837
18104
|
};
|
|
17838
|
-
BymaxAuthModule =
|
|
18105
|
+
BymaxAuthModule = _ts_decorate70([
|
|
17839
18106
|
Module({})
|
|
17840
18107
|
], BymaxAuthModule);
|
|
17841
18108
|
|
|
@@ -18163,7 +18430,7 @@ var DefaultAuthEmailProvider = class _DefaultAuthEmailProvider {
|
|
|
18163
18430
|
}
|
|
18164
18431
|
}
|
|
18165
18432
|
};
|
|
18166
|
-
function
|
|
18433
|
+
function _ts_decorate71(decorators, target, key, desc) {
|
|
18167
18434
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18168
18435
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18169
18436
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18176,13 +18443,13 @@ function _ts_decorate70(decorators, target, key, desc) {
|
|
|
18176
18443
|
}
|
|
18177
18444
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18178
18445
|
}
|
|
18179
|
-
__name(
|
|
18180
|
-
function
|
|
18446
|
+
__name(_ts_decorate71, "_ts_decorate");
|
|
18447
|
+
function _ts_metadata66(metadataKey, metadataValue) {
|
|
18181
18448
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18182
18449
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18183
18450
|
}
|
|
18184
18451
|
}
|
|
18185
|
-
__name(
|
|
18452
|
+
__name(_ts_metadata66, "_ts_metadata");
|
|
18186
18453
|
var HIBP_RANGE_URL = "https://api.pwnedpasswords.com/range/";
|
|
18187
18454
|
var PREFIX_LENGTH = 5;
|
|
18188
18455
|
var DEFAULT_TIMEOUT_MS = 1500;
|
|
@@ -18239,10 +18506,10 @@ var HibpBreachChecker = class _HibpBreachChecker {
|
|
|
18239
18506
|
}
|
|
18240
18507
|
}
|
|
18241
18508
|
};
|
|
18242
|
-
HibpBreachChecker =
|
|
18509
|
+
HibpBreachChecker = _ts_decorate71([
|
|
18243
18510
|
Injectable(),
|
|
18244
|
-
|
|
18245
|
-
|
|
18511
|
+
_ts_metadata66("design:type", Function),
|
|
18512
|
+
_ts_metadata66("design:paramtypes", [
|
|
18246
18513
|
Number
|
|
18247
18514
|
])
|
|
18248
18515
|
], HibpBreachChecker);
|
|
@@ -18255,10 +18522,10 @@ var AllowAllBreachChecker = class {
|
|
|
18255
18522
|
return false;
|
|
18256
18523
|
}
|
|
18257
18524
|
};
|
|
18258
|
-
AllowAllBreachChecker =
|
|
18525
|
+
AllowAllBreachChecker = _ts_decorate71([
|
|
18259
18526
|
Injectable()
|
|
18260
18527
|
], AllowAllBreachChecker);
|
|
18261
|
-
function
|
|
18528
|
+
function _ts_decorate72(decorators, target, key, desc) {
|
|
18262
18529
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18263
18530
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18264
18531
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18271,7 +18538,7 @@ function _ts_decorate71(decorators, target, key, desc) {
|
|
|
18271
18538
|
}
|
|
18272
18539
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18273
18540
|
}
|
|
18274
|
-
__name(
|
|
18541
|
+
__name(_ts_decorate72, "_ts_decorate");
|
|
18275
18542
|
var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
18276
18543
|
static {
|
|
18277
18544
|
__name(this, "OptionalAuthGuard");
|
|
@@ -18286,10 +18553,10 @@ var OptionalAuthGuard = class extends JwtAuthGuard {
|
|
|
18286
18553
|
return super.canActivate(context);
|
|
18287
18554
|
}
|
|
18288
18555
|
};
|
|
18289
|
-
OptionalAuthGuard =
|
|
18556
|
+
OptionalAuthGuard = _ts_decorate72([
|
|
18290
18557
|
Injectable()
|
|
18291
18558
|
], OptionalAuthGuard);
|
|
18292
|
-
function
|
|
18559
|
+
function _ts_decorate73(decorators, target, key, desc) {
|
|
18293
18560
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18294
18561
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18295
18562
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18302,13 +18569,13 @@ function _ts_decorate72(decorators, target, key, desc) {
|
|
|
18302
18569
|
}
|
|
18303
18570
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18304
18571
|
}
|
|
18305
|
-
__name(
|
|
18306
|
-
function
|
|
18572
|
+
__name(_ts_decorate73, "_ts_decorate");
|
|
18573
|
+
function _ts_metadata67(metadataKey, metadataValue) {
|
|
18307
18574
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18308
18575
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18309
18576
|
}
|
|
18310
18577
|
}
|
|
18311
|
-
__name(
|
|
18578
|
+
__name(_ts_metadata67, "_ts_metadata");
|
|
18312
18579
|
function _ts_param43(paramIndex, decorator) {
|
|
18313
18580
|
return function(target, key) {
|
|
18314
18581
|
decorator(target, key, paramIndex);
|
|
@@ -18344,11 +18611,11 @@ var SelfOrAdminGuard = class {
|
|
|
18344
18611
|
throw new AuthException(AUTH_ERROR_CODES.INSUFFICIENT_ROLE);
|
|
18345
18612
|
}
|
|
18346
18613
|
};
|
|
18347
|
-
SelfOrAdminGuard =
|
|
18614
|
+
SelfOrAdminGuard = _ts_decorate73([
|
|
18348
18615
|
Injectable(),
|
|
18349
18616
|
_ts_param43(0, Inject(BYMAX_AUTH_OPTIONS)),
|
|
18350
|
-
|
|
18351
|
-
|
|
18617
|
+
_ts_metadata67("design:type", Function),
|
|
18618
|
+
_ts_metadata67("design:paramtypes", [
|
|
18352
18619
|
typeof ResolvedOptions === "undefined" ? Object : ResolvedOptions
|
|
18353
18620
|
])
|
|
18354
18621
|
], SelfOrAdminGuard);
|
|
@@ -18361,7 +18628,7 @@ function isHexLooking(value) {
|
|
|
18361
18628
|
return value.length === 64 && /^[a-fA-F0-9]{64}$/.test(value);
|
|
18362
18629
|
}
|
|
18363
18630
|
__name(isHexLooking, "isHexLooking");
|
|
18364
|
-
function
|
|
18631
|
+
function _ts_decorate74(decorators, target, key, desc) {
|
|
18365
18632
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18366
18633
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18367
18634
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18374,13 +18641,13 @@ function _ts_decorate73(decorators, target, key, desc) {
|
|
|
18374
18641
|
}
|
|
18375
18642
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18376
18643
|
}
|
|
18377
|
-
__name(
|
|
18378
|
-
function
|
|
18644
|
+
__name(_ts_decorate74, "_ts_decorate");
|
|
18645
|
+
function _ts_metadata68(metadataKey, metadataValue) {
|
|
18379
18646
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
18380
18647
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
18381
18648
|
}
|
|
18382
18649
|
}
|
|
18383
|
-
__name(
|
|
18650
|
+
__name(_ts_metadata68, "_ts_metadata");
|
|
18384
18651
|
function _ts_param44(paramIndex, decorator) {
|
|
18385
18652
|
return function(target, key) {
|
|
18386
18653
|
decorator(target, key, paramIndex);
|
|
@@ -18450,14 +18717,14 @@ var WsJwtGuard = class {
|
|
|
18450
18717
|
return true;
|
|
18451
18718
|
}
|
|
18452
18719
|
};
|
|
18453
|
-
WsJwtGuard =
|
|
18720
|
+
WsJwtGuard = _ts_decorate74([
|
|
18454
18721
|
Injectable(),
|
|
18455
18722
|
_ts_param44(0, Inject(JwtService)),
|
|
18456
18723
|
_ts_param44(1, Inject(AuthRevocationService)),
|
|
18457
18724
|
_ts_param44(2, Inject(WsTicketService)),
|
|
18458
18725
|
_ts_param44(3, Inject(BYMAX_AUTH_OPTIONS)),
|
|
18459
|
-
|
|
18460
|
-
|
|
18726
|
+
_ts_metadata68("design:type", Function),
|
|
18727
|
+
_ts_metadata68("design:paramtypes", [
|
|
18461
18728
|
typeof JwtService === "undefined" ? Object : JwtService,
|
|
18462
18729
|
typeof AuthRevocationService === "undefined" ? Object : AuthRevocationService,
|
|
18463
18730
|
typeof WsTicketService === "undefined" ? Object : WsTicketService,
|
|
@@ -18497,7 +18764,7 @@ function bindingInput(handshake) {
|
|
|
18497
18764
|
};
|
|
18498
18765
|
}
|
|
18499
18766
|
__name(bindingInput, "bindingInput");
|
|
18500
|
-
function
|
|
18767
|
+
function _ts_decorate75(decorators, target, key, desc) {
|
|
18501
18768
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18502
18769
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18503
18770
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18510,13 +18777,48 @@ function _ts_decorate74(decorators, target, key, desc) {
|
|
|
18510
18777
|
}
|
|
18511
18778
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18512
18779
|
}
|
|
18513
|
-
__name(
|
|
18780
|
+
__name(_ts_decorate75, "_ts_decorate");
|
|
18514
18781
|
function isAuthEnvelope(body) {
|
|
18515
18782
|
if (typeof body !== "object" || body === null) return false;
|
|
18516
18783
|
const error = body.error;
|
|
18517
18784
|
return typeof error === "object" && error !== null && "code" in error;
|
|
18518
18785
|
}
|
|
18519
18786
|
__name(isAuthEnvelope, "isAuthEnvelope");
|
|
18787
|
+
var BODY_PARSER_ERROR_TYPES = /* @__PURE__ */ new Set([
|
|
18788
|
+
"entity.parse.failed",
|
|
18789
|
+
"entity.too.large",
|
|
18790
|
+
"entity.verify.failed",
|
|
18791
|
+
"charset.unsupported",
|
|
18792
|
+
"encoding.unsupported",
|
|
18793
|
+
"request.aborted",
|
|
18794
|
+
"request.size.invalid",
|
|
18795
|
+
"querystring.parse.rangeError",
|
|
18796
|
+
"parameters.too.many"
|
|
18797
|
+
]);
|
|
18798
|
+
var MALFORMED_REQUEST_MESSAGE = "Malformed request";
|
|
18799
|
+
function bodyParserStatus(exception) {
|
|
18800
|
+
if (typeof exception !== "object" || exception === null) return void 0;
|
|
18801
|
+
const { type, status } = exception;
|
|
18802
|
+
if (typeof type !== "string" || !BODY_PARSER_ERROR_TYPES.has(type)) return void 0;
|
|
18803
|
+
return typeof status === "number" && status >= 400 && status < 500 ? status : void 0;
|
|
18804
|
+
}
|
|
18805
|
+
__name(bodyParserStatus, "bodyParserStatus");
|
|
18806
|
+
function isUntypedParserRefusal(exception) {
|
|
18807
|
+
if (!(exception instanceof Error)) return false;
|
|
18808
|
+
const { status, statusCode, expose, type } = exception;
|
|
18809
|
+
return status === HttpStatus.BAD_REQUEST && statusCode === HttpStatus.BAD_REQUEST && expose === true && type === void 0;
|
|
18810
|
+
}
|
|
18811
|
+
__name(isUntypedParserRefusal, "isUntypedParserRefusal");
|
|
18812
|
+
function bodyParserMessage(status) {
|
|
18813
|
+
if (status === HttpStatus.PAYLOAD_TOO_LARGE) return "Request entity too large";
|
|
18814
|
+
if (status === HttpStatus.UNSUPPORTED_MEDIA_TYPE) return "Unsupported media type";
|
|
18815
|
+
return MALFORMED_REQUEST_MESSAGE;
|
|
18816
|
+
}
|
|
18817
|
+
__name(bodyParserMessage, "bodyParserMessage");
|
|
18818
|
+
function isPreRoutingBadRequest(exception, req) {
|
|
18819
|
+
return exception instanceof BadRequestException && req.route === void 0;
|
|
18820
|
+
}
|
|
18821
|
+
__name(isPreRoutingBadRequest, "isPreRoutingBadRequest");
|
|
18520
18822
|
var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
18521
18823
|
static {
|
|
18522
18824
|
__name(this, "AuthExceptionFilter");
|
|
@@ -18529,7 +18831,8 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
18529
18831
|
* @param host - The arguments host, used to reach the HTTP response.
|
|
18530
18832
|
*/
|
|
18531
18833
|
catch(exception, host) {
|
|
18532
|
-
const
|
|
18834
|
+
const http = host.switchToHttp();
|
|
18835
|
+
const res = http.getResponse();
|
|
18533
18836
|
if (exception instanceof AuthException) {
|
|
18534
18837
|
res.status(exception.getStatus()).json(exception.getResponse());
|
|
18535
18838
|
return;
|
|
@@ -18540,6 +18843,16 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
18540
18843
|
res.status(exception.getStatus()).json(body);
|
|
18541
18844
|
return;
|
|
18542
18845
|
}
|
|
18846
|
+
if (isPreRoutingBadRequest(exception, http.getRequest())) {
|
|
18847
|
+
res.status(HttpStatus.BAD_REQUEST).json({
|
|
18848
|
+
error: {
|
|
18849
|
+
code: AUTH_ERROR_CODES.VALIDATION,
|
|
18850
|
+
message: MALFORMED_REQUEST_MESSAGE,
|
|
18851
|
+
details: null
|
|
18852
|
+
}
|
|
18853
|
+
});
|
|
18854
|
+
return;
|
|
18855
|
+
}
|
|
18543
18856
|
const message = typeof body === "string" ? body : exception.message;
|
|
18544
18857
|
res.status(exception.getStatus()).json({
|
|
18545
18858
|
error: {
|
|
@@ -18550,6 +18863,27 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
18550
18863
|
});
|
|
18551
18864
|
return;
|
|
18552
18865
|
}
|
|
18866
|
+
const refusedStatus = bodyParserStatus(exception);
|
|
18867
|
+
if (refusedStatus !== void 0) {
|
|
18868
|
+
res.status(refusedStatus).json({
|
|
18869
|
+
error: {
|
|
18870
|
+
code: AUTH_ERROR_CODES.VALIDATION,
|
|
18871
|
+
message: bodyParserMessage(refusedStatus),
|
|
18872
|
+
details: null
|
|
18873
|
+
}
|
|
18874
|
+
});
|
|
18875
|
+
return;
|
|
18876
|
+
}
|
|
18877
|
+
if (isUntypedParserRefusal(exception) && http.getRequest().route === void 0) {
|
|
18878
|
+
res.status(HttpStatus.BAD_REQUEST).json({
|
|
18879
|
+
error: {
|
|
18880
|
+
code: AUTH_ERROR_CODES.VALIDATION,
|
|
18881
|
+
message: MALFORMED_REQUEST_MESSAGE,
|
|
18882
|
+
details: null
|
|
18883
|
+
}
|
|
18884
|
+
});
|
|
18885
|
+
return;
|
|
18886
|
+
}
|
|
18553
18887
|
this.logger.error(`unhandled exception: ${describeChannelStatus(exception)}`);
|
|
18554
18888
|
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
18555
18889
|
error: {
|
|
@@ -18562,10 +18896,10 @@ var AuthExceptionFilter = class _AuthExceptionFilter {
|
|
|
18562
18896
|
});
|
|
18563
18897
|
}
|
|
18564
18898
|
};
|
|
18565
|
-
AuthExceptionFilter =
|
|
18899
|
+
AuthExceptionFilter = _ts_decorate75([
|
|
18566
18900
|
Catch()
|
|
18567
18901
|
], AuthExceptionFilter);
|
|
18568
|
-
function
|
|
18902
|
+
function _ts_decorate76(decorators, target, key, desc) {
|
|
18569
18903
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18570
18904
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
18571
18905
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18578,7 +18912,7 @@ function _ts_decorate75(decorators, target, key, desc) {
|
|
|
18578
18912
|
}
|
|
18579
18913
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18580
18914
|
}
|
|
18581
|
-
__name(
|
|
18915
|
+
__name(_ts_decorate76, "_ts_decorate");
|
|
18582
18916
|
function isEmittingClient(client) {
|
|
18583
18917
|
return typeof client?.emit === "function";
|
|
18584
18918
|
}
|
|
@@ -18622,10 +18956,10 @@ var WsAuthExceptionFilter = class _WsAuthExceptionFilter {
|
|
|
18622
18956
|
this.logger.error(`refused a request on a client this filter cannot answer: ${describeChannelStatus(exception)}`);
|
|
18623
18957
|
}
|
|
18624
18958
|
};
|
|
18625
|
-
WsAuthExceptionFilter =
|
|
18959
|
+
WsAuthExceptionFilter = _ts_decorate76([
|
|
18626
18960
|
Catch(AuthException)
|
|
18627
18961
|
], WsAuthExceptionFilter);
|
|
18628
18962
|
var ServiceKey = /* @__PURE__ */ __name((...scopes) => applyDecorators(SetMetadata(IS_PUBLIC_KEY, true), ApiKeyScopes(...scopes), UseGuards(ApiKeyGuard)), "ServiceKey");
|
|
18629
18963
|
var CurrentApiKey = createParamDecorator((_data, ctx) => ctx.switchToHttp().getRequest().apiKey);
|
|
18630
18964
|
|
|
18631
|
-
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
18965
|
+
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|