@volcanicminds/backend 2.2.20 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -169
- package/dist/index.js.map +1 -1
- package/dist/lib/api/auth/controller/auth.d.ts +3 -9
- package/dist/lib/api/auth/controller/auth.d.ts.map +1 -1
- package/dist/lib/api/auth/controller/auth.js +58 -75
- package/dist/lib/api/auth/controller/auth.js.map +1 -1
- package/dist/lib/api/auth/routes.d.ts +0 -45
- package/dist/lib/api/auth/routes.d.ts.map +1 -1
- package/dist/lib/api/auth/routes.js +15 -32
- package/dist/lib/api/auth/routes.js.map +1 -1
- package/dist/lib/api/tool/controller/tool.d.ts.map +1 -1
- package/dist/lib/api/tool/controller/tool.js +4 -0
- package/dist/lib/api/tool/controller/tool.js.map +1 -1
- package/dist/lib/api/users/controller/user.d.ts +10 -1
- package/dist/lib/api/users/controller/user.d.ts.map +1 -1
- package/dist/lib/api/users/controller/user.js +56 -2
- package/dist/lib/api/users/controller/user.js.map +1 -1
- package/dist/lib/api/users/routes.d.ts +67 -0
- package/dist/lib/api/users/routes.d.ts.map +1 -1
- package/dist/lib/api/users/routes.js +55 -2
- package/dist/lib/api/users/routes.js.map +1 -1
- package/dist/lib/config/general.d.ts +7 -0
- package/dist/lib/config/general.d.ts.map +1 -1
- package/dist/lib/config/general.js +8 -1
- package/dist/lib/config/general.js.map +1 -1
- package/dist/lib/config/plugins.d.ts +17 -0
- package/dist/lib/config/plugins.d.ts.map +1 -1
- package/dist/lib/config/plugins.js +8 -0
- package/dist/lib/config/plugins.js.map +1 -1
- package/dist/lib/defaults/managers.d.ts +8 -0
- package/dist/lib/defaults/managers.d.ts.map +1 -0
- package/dist/lib/defaults/managers.js +71 -0
- package/dist/lib/defaults/managers.js.map +1 -0
- package/dist/lib/hooks/onRequest.d.ts.map +1 -1
- package/dist/lib/hooks/onRequest.js +73 -3
- package/dist/lib/hooks/onRequest.js.map +1 -1
- package/dist/lib/hooks/onResponse.d.ts.map +1 -1
- package/dist/lib/hooks/onResponse.js +5 -0
- package/dist/lib/hooks/onResponse.js.map +1 -1
- package/dist/lib/loader/general.d.ts.map +1 -1
- package/dist/lib/loader/general.js +6 -1
- package/dist/lib/loader/general.js.map +1 -1
- package/dist/lib/loader/tenant.d.ts +3 -0
- package/dist/lib/loader/tenant.d.ts.map +1 -0
- package/dist/lib/loader/tenant.js +61 -0
- package/dist/lib/loader/tenant.js.map +1 -0
- package/lib/api/auth/controller/auth.ts +66 -82
- package/lib/api/auth/routes.ts +18 -33
- package/lib/api/tool/controller/tool.ts +5 -0
- package/lib/api/users/controller/user.ts +69 -2
- package/lib/api/users/routes.ts +58 -2
- package/lib/config/general.ts +8 -1
- package/lib/config/plugins.ts +8 -0
- package/lib/defaults/managers.ts +88 -0
- package/lib/hooks/onRequest.ts +92 -4
- package/lib/hooks/onResponse.ts +6 -0
- package/lib/loader/general.ts +6 -1
- package/lib/loader/tenant.ts +79 -0
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onRequest.js","sourceRoot":"","sources":["../../../lib/hooks/onRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGtD,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAA;AAE7D,MAAM,mBAAmB,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,CAAC,CAAA;AAEvG,MAAM,cAAc,GAAG,CAAC,UAA6B,EAAY,EAAE;IACjE,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;IACD,MA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C;YAClC,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,EAAE,aAAa,EAAE,GAAG,GAAG,CAAA;YACpD,MAAM,eAAe,GAAa,GAAG,CAAC,KAAK,EAAE,CAAA;YAC7C,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;YAEjF,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,IAAI,GAAG,CAAC,CAAC;oBAAE,GAAG,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,WAAW,gBAAgB,MAAM,CAAC,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC,CAAA;gBAC9G,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC,CAAA;YACxG,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onResponse.d.ts","sourceRoot":"","sources":["../../../lib/hooks/onResponse.ts"],"names":[],"mappings":"yBAAsB,QAAG,EAAE,UAAK;AAAhC,
|
|
1
|
+
{"version":3,"file":"onResponse.d.ts","sourceRoot":"","sources":["../../../lib/hooks/onResponse.ts"],"names":[],"mappings":"yBAAsB,QAAG,EAAE,UAAK;AAAhC,wBA0BC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onResponse.js","sourceRoot":"","sources":["../../../lib/hooks/onResponse.ts"],"names":[],"mappings":"AAAA,eAAe,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;IAClC,IAAI,YAAY,GAAG,EAAE,CAAA;IACrB,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG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ib/loader/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAI1D,wBAAsB,IAAI,
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/loader/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAI1D,wBAAsB,IAAI,2BAwCzB"}
|
|
@@ -6,11 +6,16 @@ export async function load() {
|
|
|
6
6
|
options: {
|
|
7
7
|
allow_multiple_admin: false,
|
|
8
8
|
admin_can_change_passwords: false,
|
|
9
|
+
allow_admin_change_password_users: false,
|
|
9
10
|
reset_external_id_on_login: false,
|
|
10
11
|
scheduler: false,
|
|
11
12
|
embedded_auth: true,
|
|
12
13
|
mfa_admin_forced_reset_email: undefined,
|
|
13
|
-
mfa_admin_forced_reset_until: undefined
|
|
14
|
+
mfa_admin_forced_reset_until: undefined,
|
|
15
|
+
multi_tenant: {
|
|
16
|
+
enabled: false,
|
|
17
|
+
query_key: 'tid'
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
};
|
|
16
21
|
const patterns = normalizePatterns(['..', 'config', 'general.{ts,js}'], ['src', 'config', 'general.{ts,js}']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/loader/general.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAE/B,MAAM,CAAC,KAAK,UAAU,IAAI;IACxB,MAAM,aAAa,GAAkB;QACnC,IAAI,EAAE,SAAS;QACf,OAAO,EAAE;YACP,oBAAoB,EAAE,KAAK;YAC3B,0BAA0B,EAAE,KAAK;YACjC,0BAA0B,EAAE,KAAK;YACjC,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,IAAI;YACnB,4BAA4B,EAAE,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C;gBACvC,aAAa,CAAC,OAAO,GAAG;oBACtB,GAAG,aAAa,CAAC,OAAO;oBACxB,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;iBAC1B,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,GAAG,CAAC,CAAC;QAAE,GAAG,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACpD,OAAO,aAAa,CAAA;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant.d.ts","sourceRoot":"","sources":["../../../lib/loader/tenant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGzC,wBAAsB,KAAK,CAAC,MAAM,EAAE,eAAe,iBA2ElD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export async function apply(server) {
|
|
2
|
+
const { multi_tenant } = global.config.options || {};
|
|
3
|
+
if (!multi_tenant?.enabled) {
|
|
4
|
+
if (log.d)
|
|
5
|
+
log.debug('Multi-Tenant: Disabled by configuration');
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (log.i)
|
|
9
|
+
log.info('Multi-Tenant: 🟢 Enabled');
|
|
10
|
+
server.addHook('onRequest', async (req, reply) => {
|
|
11
|
+
const tm = server['tenantManager'];
|
|
12
|
+
if (!tm || !tm.isImplemented()) {
|
|
13
|
+
const errorMsg = 'Multi-Tenant enabled but no TenantManager provided/implemented!';
|
|
14
|
+
if (log.f)
|
|
15
|
+
log.fatal(errorMsg);
|
|
16
|
+
throw new Error(errorMsg);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const tenant = await tm.resolveTenant(req);
|
|
20
|
+
if (!tenant) {
|
|
21
|
+
if (log.w)
|
|
22
|
+
log.warn(`Multi-Tenant: Tenant resolution failed for request ${req.id}`);
|
|
23
|
+
return reply.code(404).send({
|
|
24
|
+
statusCode: 404,
|
|
25
|
+
error: 'Not Found',
|
|
26
|
+
message: 'Tenant not found or resolution failed'
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
req.tenant = tenant;
|
|
30
|
+
if (log.t)
|
|
31
|
+
log.trace(`Multi-Tenant: Context switched to ${tenant.slug || tenant.id}`);
|
|
32
|
+
const dataSource = global.connection;
|
|
33
|
+
if (dataSource) {
|
|
34
|
+
const qr = dataSource.createQueryRunner();
|
|
35
|
+
await qr.connect();
|
|
36
|
+
req.db = qr.manager;
|
|
37
|
+
await tm.switchContext(tenant, qr.manager);
|
|
38
|
+
reply.raw.on('finish', async () => {
|
|
39
|
+
if (!qr.isReleased) {
|
|
40
|
+
await qr.release();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (log.w)
|
|
46
|
+
log.warn('Multi-Tenant: Global connection not found! Skipping DB context creation.');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
51
|
+
if (log.e)
|
|
52
|
+
log.error(`Multi-Tenant Error: ${message}`);
|
|
53
|
+
return reply.code(500).send({
|
|
54
|
+
statusCode: 500,
|
|
55
|
+
error: 'Internal Server Error',
|
|
56
|
+
message: 'Tenant Context Switch Failed'
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=tenant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant.js","sourceRoot":"","sources":["../../../lib/loader/tenant.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAuB;IACjD,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAA;IAGpD,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;QAC3B,IAAI,GAAG,CAAC,CAAC;YAAE,GAAG,CAAC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AC,iBAAiB,EAAE,CAAA;gBACzC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;gBAGlB,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAA;gBAInB,MAAM,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,CAAA;gBAG1C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;oBAChC,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;wBACnB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;oBACpB,CAAC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,CAAC,CAAC;oBAAE,GAAG,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAA;YACjG,CAAC;QAEH,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAChE,IAAI,GAAG,CAAC,CAAC;gBAAE,GAAG,CAAC,KAAK,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAA;YACtD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,UAAU,EAAE,GAAG;gBACf,KAAK,EAAE,uBAAuB;gBAC9B,OAAO,EAAE,8BAA8B;aACxC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -23,13 +23,13 @@ export async function register(req: FastifyRequest, reply: FastifyReply) {
|
|
|
23
23
|
return reply.status(400).send(new Error('Repeated password not match'))
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
let existings = await req.server['userManager'].retrieveUserByEmail(data.email)
|
|
26
|
+
let existings = await req.server['userManager'].retrieveUserByEmail(data.email, req.runner)
|
|
27
27
|
if (existings) {
|
|
28
28
|
return reply.status(400).send(new Error('Email already registered'))
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if ((data.requiredRoles || []).includes('admin')) {
|
|
32
|
-
existings = await req.server['userManager'].findQuery({ 'roles:in': 'admin' })
|
|
32
|
+
existings = await req.server['userManager'].findQuery({ 'roles:in': 'admin' }, req.runner)
|
|
33
33
|
if (existings?.records?.length) {
|
|
34
34
|
return reply.status(400).send(new Error('User admin already registered'))
|
|
35
35
|
}
|
|
@@ -42,7 +42,7 @@ export async function register(req: FastifyRequest, reply: FastifyReply) {
|
|
|
42
42
|
data.roles.push(publicRole)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const user = await req.server['userManager'].createUser({ ...data, password: password })
|
|
45
|
+
const user = await req.server['userManager'].createUser({ ...data, password: password }, req.runner)
|
|
46
46
|
if (!user) {
|
|
47
47
|
return reply.status(400).send(new Error('User not registered'))
|
|
48
48
|
}
|
|
@@ -53,7 +53,7 @@ export async function register(req: FastifyRequest, reply: FastifyReply) {
|
|
|
53
53
|
export async function unregister(req: FastifyRequest, reply: FastifyReply) {
|
|
54
54
|
const { email, password } = req.data()
|
|
55
55
|
|
|
56
|
-
let user = await req.server['userManager'].retrieveUserByPassword(email, password)
|
|
56
|
+
let user = await req.server['userManager'].retrieveUserByPassword(email, password, req.runner)
|
|
57
57
|
let isValid = await req.server['userManager'].isValidUser(user)
|
|
58
58
|
|
|
59
59
|
if (!isValid) {
|
|
@@ -64,7 +64,7 @@ export async function unregister(req: FastifyRequest, reply: FastifyReply) {
|
|
|
64
64
|
return reply.status(403).send(new Error('User blocked'))
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
user = await req.server['userManager'].disableUserById(user.getId())
|
|
67
|
+
user = await req.server['userManager'].disableUserById(user.getId(), req.runner)
|
|
68
68
|
isValid = await req.server['userManager'].isValidUser(user)
|
|
69
69
|
|
|
70
70
|
if (!isValid) {
|
|
@@ -113,7 +113,7 @@ export async function changePassword(req: FastifyRequest, reply: FastifyReply) {
|
|
|
113
113
|
return reply.status(400).send(new Error('Repeated new password not match'))
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
let user = await req.server['userManager'].retrieveUserByPassword(email, oldPassword)
|
|
116
|
+
let user = await req.server['userManager'].retrieveUserByPassword(email, oldPassword, req.runner)
|
|
117
117
|
let isValid = await req.server['userManager'].isValidUser(user)
|
|
118
118
|
|
|
119
119
|
if (!isValid) {
|
|
@@ -124,7 +124,7 @@ export async function changePassword(req: FastifyRequest, reply: FastifyReply) {
|
|
|
124
124
|
return reply.status(403).send(new Error('User blocked'))
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
user = await req.server['userManager'].changePassword(email, newPassword1, oldPassword)
|
|
127
|
+
user = await req.server['userManager'].changePassword(email, newPassword1, oldPassword, req.runner)
|
|
128
128
|
isValid = await req.server['userManager'].isValidUser(user)
|
|
129
129
|
return { ok: isValid }
|
|
130
130
|
}
|
|
@@ -142,9 +142,9 @@ export async function forgotPassword(req: FastifyRequest, reply: FastifyReply) {
|
|
|
142
142
|
|
|
143
143
|
let user = null as any
|
|
144
144
|
if (email) {
|
|
145
|
-
user = await req.server['userManager'].retrieveUserByEmail(email)
|
|
145
|
+
user = await req.server['userManager'].retrieveUserByEmail(email, req.runner)
|
|
146
146
|
} else if (username) {
|
|
147
|
-
user = await req.server['userManager'].retrieveUserByUsername(username)
|
|
147
|
+
user = await req.server['userManager'].retrieveUserByUsername(username, req.runner)
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
let isValid = await req.server['userManager'].isValidUser(user)
|
|
@@ -157,7 +157,7 @@ export async function forgotPassword(req: FastifyRequest, reply: FastifyReply) {
|
|
|
157
157
|
return reply.status(403).send(new Error('User blocked'))
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
user = await req.server['userManager'].forgotPassword(user.email)
|
|
160
|
+
user = await req.server['userManager'].forgotPassword(user.email, req.runner)
|
|
161
161
|
isValid = await req.server['userManager'].isValidUser(user)
|
|
162
162
|
|
|
163
163
|
return { ok: isValid }
|
|
@@ -170,7 +170,7 @@ export async function confirmEmail(req: FastifyRequest, reply: FastifyReply) {
|
|
|
170
170
|
return reply.status(400).send(new Error('Missing the confirm email token'))
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
let user = await req.server['userManager'].retrieveUserByConfirmationToken(code)
|
|
173
|
+
let user = await req.server['userManager'].retrieveUserByConfirmationToken(code, req.runner)
|
|
174
174
|
let isValid = await req.server['userManager'].isValidUser(user)
|
|
175
175
|
|
|
176
176
|
if (!isValid) {
|
|
@@ -181,7 +181,7 @@ export async function confirmEmail(req: FastifyRequest, reply: FastifyReply) {
|
|
|
181
181
|
return reply.status(403).send(new Error('User blocked'))
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
user = await req.server['userManager'].userConfirmation(user)
|
|
184
|
+
user = await req.server['userManager'].userConfirmation(user, req.runner)
|
|
185
185
|
isValid = await req.server['userManager'].isValidUser(user)
|
|
186
186
|
|
|
187
187
|
return { ok: isValid }
|
|
@@ -202,7 +202,7 @@ export async function resetPassword(req: FastifyRequest, reply: FastifyReply) {
|
|
|
202
202
|
return reply.status(400).send(new Error('Repeated new password not match'))
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
let user = await req.server['userManager'].retrieveUserByResetPasswordToken(code)
|
|
205
|
+
let user = await req.server['userManager'].retrieveUserByResetPasswordToken(code, req.runner)
|
|
206
206
|
let isValid = await req.server['userManager'].isValidUser(user)
|
|
207
207
|
|
|
208
208
|
if (!isValid) {
|
|
@@ -213,7 +213,7 @@ export async function resetPassword(req: FastifyRequest, reply: FastifyReply) {
|
|
|
213
213
|
return reply.status(403).send(new Error('User blocked'))
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
user = await req.server['userManager'].resetPassword(user, newPassword1)
|
|
216
|
+
user = await req.server['userManager'].resetPassword(user, newPassword1, req.runner)
|
|
217
217
|
isValid = await req.server['userManager'].isValidUser(user)
|
|
218
218
|
return { ok: isValid, user }
|
|
219
219
|
}
|
|
@@ -233,7 +233,7 @@ export async function login(req: FastifyRequest, reply: FastifyReply) {
|
|
|
233
233
|
return reply.status(400).send(new Error('Password not valid'))
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
let user = await req.server['userManager'].retrieveUserByPassword(email, password)
|
|
236
|
+
let user = await req.server['userManager'].retrieveUserByPassword(email, password, req.runner)
|
|
237
237
|
if (!user) {
|
|
238
238
|
return reply.status(403).send(new Error('Wrong credentials'))
|
|
239
239
|
}
|
|
@@ -262,7 +262,10 @@ export async function login(req: FastifyRequest, reply: FastifyReply) {
|
|
|
262
262
|
const isMandatory = mfa_policy === MfaPolicy.MANDATORY
|
|
263
263
|
|
|
264
264
|
if (isMfaEnabled || isMandatory) {
|
|
265
|
-
const tempToken = await reply.jwtSign(
|
|
265
|
+
const tempToken = await reply.jwtSign(
|
|
266
|
+
{ sub: user.externalId, role: 'pre-auth-mfa', tid: req.tenant?.id },
|
|
267
|
+
{ expiresIn: '5m' }
|
|
268
|
+
)
|
|
266
269
|
// Use 202 Accepted to bypass 200 OK strict schema filtering
|
|
267
270
|
return reply.status(202).send({
|
|
268
271
|
mfaRequired: isMfaEnabled, // If enabled, verify. If not enabled but mandatory, setup.
|
|
@@ -272,16 +275,39 @@ export async function login(req: FastifyRequest, reply: FastifyReply) {
|
|
|
272
275
|
}
|
|
273
276
|
|
|
274
277
|
if (config.options.reset_external_id_on_login) {
|
|
275
|
-
user = await req.server['userManager'].resetExternalId(user.getId())
|
|
278
|
+
user = await req.server['userManager'].resetExternalId(user.getId(), req.runner)
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
// https://www.iana.org/assignments/jwt/jwt.xhtml
|
|
279
|
-
const token = await reply.jwtSign({ sub: user.externalId })
|
|
282
|
+
const token = await reply.jwtSign({ sub: user.externalId, tid: req.tenant?.id })
|
|
280
283
|
const refreshToken = reply.server.jwt['refreshToken']
|
|
281
|
-
? await reply.server.jwt['refreshToken'].sign({ sub: user.externalId })
|
|
284
|
+
? await reply.server.jwt['refreshToken'].sign({ sub: user.externalId, tid: req.tenant?.id })
|
|
282
285
|
: undefined
|
|
283
286
|
|
|
284
|
-
|
|
287
|
+
const AUTH_MODE = process.env.AUTH_MODE || 'BEARER'
|
|
288
|
+
|
|
289
|
+
if (AUTH_MODE === 'COOKIE') {
|
|
290
|
+
reply.setCookie('auth_token', token, {
|
|
291
|
+
path: '/',
|
|
292
|
+
httpOnly: true,
|
|
293
|
+
secure: process.env.NODE_ENV === 'production',
|
|
294
|
+
sameSite: 'strict',
|
|
295
|
+
signed: true,
|
|
296
|
+
maxAge: 86400
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
...user,
|
|
301
|
+
roles: (user.roles || [global.role?.public?.code || 'public']).map((r) => r?.code || r),
|
|
302
|
+
token: null, // Token hidden in cookie
|
|
303
|
+
refreshToken: null,
|
|
304
|
+
securityPolicy: {
|
|
305
|
+
mfaPolicy: mfa_policy
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Standard 200 OK (BEARER MODE)
|
|
285
311
|
return {
|
|
286
312
|
...user,
|
|
287
313
|
roles: (user.roles || [global.role?.public?.code || 'public']).map((r) => r?.code || r),
|
|
@@ -293,6 +319,13 @@ export async function login(req: FastifyRequest, reply: FastifyReply) {
|
|
|
293
319
|
}
|
|
294
320
|
}
|
|
295
321
|
|
|
322
|
+
export async function logout(_req: FastifyRequest, reply: FastifyReply) {
|
|
323
|
+
if (process.env.AUTH_MODE === 'COOKIE') {
|
|
324
|
+
reply.clearCookie('auth_token', { path: '/' })
|
|
325
|
+
}
|
|
326
|
+
return { ok: true }
|
|
327
|
+
}
|
|
328
|
+
|
|
296
329
|
export async function refreshToken(req: FastifyRequest, reply: FastifyReply) {
|
|
297
330
|
const { token, refreshToken } = req.data()
|
|
298
331
|
|
|
@@ -312,14 +345,14 @@ export async function refreshToken(req: FastifyRequest, reply: FastifyReply) {
|
|
|
312
345
|
return reply.status(403).send(new Error('Mismatched tokens'))
|
|
313
346
|
}
|
|
314
347
|
|
|
315
|
-
const user = await req.server['userManager'].retrieveUserByExternalId(tokenData.sub)
|
|
348
|
+
const user = await req.server['userManager'].retrieveUserByExternalId(tokenData.sub, req.runner)
|
|
316
349
|
const isValid = await req.server['userManager'].isValidUser(user)
|
|
317
350
|
|
|
318
351
|
if (!isValid) {
|
|
319
352
|
return reply.status(403).send(new Error('Wrong refresh token'))
|
|
320
353
|
}
|
|
321
354
|
|
|
322
|
-
const newToken = await reply.jwtSign({ sub: user.externalId })
|
|
355
|
+
const newToken = await reply.jwtSign({ sub: user.externalId, tid: req.tenant?.id })
|
|
323
356
|
return {
|
|
324
357
|
token: newToken
|
|
325
358
|
}
|
|
@@ -331,43 +364,12 @@ export async function invalidateTokens(req: FastifyRequest, reply: FastifyReply)
|
|
|
331
364
|
return reply.status(403).send(new Error('User not linked'))
|
|
332
365
|
}
|
|
333
366
|
|
|
334
|
-
const user = await req.server['userManager'].resetExternalId(req.user.getId())
|
|
367
|
+
const user = await req.server['userManager'].resetExternalId(req.user.getId(), req.runner)
|
|
335
368
|
isValid = await req.server['userManager'].isValidUser(user)
|
|
336
369
|
return { ok: isValid }
|
|
337
370
|
}
|
|
338
371
|
|
|
339
|
-
export async function block(req: FastifyRequest, reply: FastifyReply) {
|
|
340
|
-
if (!req.server['userManager'].isImplemented()) {
|
|
341
|
-
throw new Error('Not implemented')
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
if (!req.hasRole(roles.admin) && !req.hasRole(roles.backoffice)) {
|
|
345
|
-
return reply.status(403).send({ statusCode: 403, code: 'ROLE_NOT_ALLOWED', message: 'Not allowed to block a user' })
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const { id: userId } = req.parameters()
|
|
349
|
-
const { reason } = req.data()
|
|
350
|
-
|
|
351
|
-
let user = await req.server['userManager'].blockUserById(userId, reason)
|
|
352
|
-
user = await req.server['userManager'].resetExternalId(user.getId())
|
|
353
|
-
return { ok: !!user.getId() }
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
export async function unblock(req: FastifyRequest, reply: FastifyReply) {
|
|
357
|
-
if (!req.server['userManager'].isImplemented()) {
|
|
358
|
-
throw new Error('Not implemented')
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (!req.hasRole(roles.admin) && !req.hasRole(roles.backoffice)) {
|
|
362
|
-
return reply
|
|
363
|
-
.status(403)
|
|
364
|
-
.send({ statusCode: 403, code: 'ROLE_NOT_ALLOWED', message: 'Not allowed to unblock a user' })
|
|
365
|
-
}
|
|
366
372
|
|
|
367
|
-
const { id: userId } = req.parameters()
|
|
368
|
-
const user = await req.server['userManager'].unblockUserById(userId)
|
|
369
|
-
return { ok: !!user.getId() }
|
|
370
|
-
}
|
|
371
373
|
|
|
372
374
|
export async function mfaSetup(req: FastifyRequest, reply: FastifyReply) {
|
|
373
375
|
const user = req.user
|
|
@@ -399,16 +401,16 @@ export async function mfaEnable(req: FastifyRequest, reply: FastifyReply) {
|
|
|
399
401
|
}
|
|
400
402
|
|
|
401
403
|
// 2. Save using userManager (typeorm)
|
|
402
|
-
await req.server['userManager'].saveMfaSecret(user.getId(), secret)
|
|
403
|
-
await req.server['userManager'].enableMfa(user.getId())
|
|
404
|
+
await req.server['userManager'].saveMfaSecret(user.getId(), secret, req.runner)
|
|
405
|
+
await req.server['userManager'].enableMfa(user.getId(), req.runner)
|
|
404
406
|
|
|
405
407
|
// IMPORTANT: Return full tokens upon enablement if user was in pending state
|
|
406
408
|
// BUT usually user is already logged in via temp token or full token.
|
|
407
409
|
// If user is setting up from "Forced Setup", they need tokens now.
|
|
408
410
|
|
|
409
|
-
const finalToken = await reply.jwtSign({ sub: user.externalId })
|
|
411
|
+
const finalToken = await reply.jwtSign({ sub: user.externalId, tid: req.tenant?.id })
|
|
410
412
|
const refreshToken = reply.server.jwt['refreshToken']
|
|
411
|
-
? await reply.server.jwt['refreshToken'].sign({ sub: user.externalId })
|
|
413
|
+
? await reply.server.jwt['refreshToken'].sign({ sub: user.externalId, tid: req.tenant?.id })
|
|
412
414
|
: undefined
|
|
413
415
|
|
|
414
416
|
return {
|
|
@@ -450,10 +452,10 @@ export async function mfaVerify(req: FastifyRequest, reply: FastifyReply) {
|
|
|
450
452
|
if (!token) return reply.status(400).send(new Error('Missing token'))
|
|
451
453
|
|
|
452
454
|
// 1. Retrieve secret via userManager
|
|
453
|
-
const user = await req.server['userManager'].retrieveUserByExternalId(subjectId)
|
|
455
|
+
const user = await req.server['userManager'].retrieveUserByExternalId(subjectId, req.runner)
|
|
454
456
|
if (!user) return reply.status(404).send(new Error('User not found'))
|
|
455
457
|
|
|
456
|
-
const secret = await req.server['userManager'].retrieveMfaSecret(user.getId())
|
|
458
|
+
const secret = await req.server['userManager'].retrieveMfaSecret(user.getId(), req.runner)
|
|
457
459
|
if (!secret) return reply.status(403).send(new Error('MFA not configured for user'))
|
|
458
460
|
|
|
459
461
|
// 2. Verify via mfaManager
|
|
@@ -461,12 +463,12 @@ export async function mfaVerify(req: FastifyRequest, reply: FastifyReply) {
|
|
|
461
463
|
if (!isValid) return reply.status(403).send(new Error('Invalid MFA token'))
|
|
462
464
|
|
|
463
465
|
if (config.options.reset_external_id_on_login) {
|
|
464
|
-
await req.server['userManager'].resetExternalId(user.getId())
|
|
466
|
+
await req.server['userManager'].resetExternalId(user.getId(), req.runner)
|
|
465
467
|
}
|
|
466
468
|
|
|
467
|
-
const finalToken = await reply.jwtSign({ sub: user.externalId })
|
|
469
|
+
const finalToken = await reply.jwtSign({ sub: user.externalId, tid: req.tenant?.id })
|
|
468
470
|
const refreshToken = reply.server.jwt['refreshToken']
|
|
469
|
-
? await reply.server.jwt['refreshToken'].sign({ sub: user.externalId })
|
|
471
|
+
? await reply.server.jwt['refreshToken'].sign({ sub: user.externalId, tid: req.tenant?.id })
|
|
470
472
|
: undefined
|
|
471
473
|
|
|
472
474
|
return {
|
|
@@ -490,7 +492,7 @@ export async function mfaDisable(req: FastifyRequest, reply: FastifyReply) {
|
|
|
490
492
|
}
|
|
491
493
|
|
|
492
494
|
try {
|
|
493
|
-
await req.server['userManager'].disableMfa(user.getId())
|
|
495
|
+
await req.server['userManager'].disableMfa(user.getId(), req.runner)
|
|
494
496
|
return { ok: true }
|
|
495
497
|
} catch (error: any) {
|
|
496
498
|
req.log.error({ err: error }, 'MFA Disable failed')
|
|
@@ -498,22 +500,4 @@ export async function mfaDisable(req: FastifyRequest, reply: FastifyReply) {
|
|
|
498
500
|
}
|
|
499
501
|
}
|
|
500
502
|
|
|
501
|
-
export async function resetMfa(req: FastifyRequest, reply: FastifyReply) {
|
|
502
|
-
const { id } = req.parameters()
|
|
503
|
-
|
|
504
|
-
if (!req.hasRole(roles.admin)) {
|
|
505
|
-
return reply.status(403).send(new Error('Only admins can reset MFA'))
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (!id) {
|
|
509
|
-
return reply.status(400).send(new Error('Missing user id'))
|
|
510
|
-
}
|
|
511
503
|
|
|
512
|
-
try {
|
|
513
|
-
await req.server['userManager'].disableMfa(id)
|
|
514
|
-
return { ok: true }
|
|
515
|
-
} catch (error: any) {
|
|
516
|
-
req.log.error({ err: error }, 'MFA Reset failed')
|
|
517
|
-
return reply.status(500).send(new Error('Failed to reset MFA'))
|
|
518
|
-
}
|
|
519
|
-
}
|
package/lib/api/auth/routes.ts
CHANGED
|
@@ -131,6 +131,20 @@ export default {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
|
+
{
|
|
135
|
+
method: 'POST',
|
|
136
|
+
path: '/logout',
|
|
137
|
+
roles: [],
|
|
138
|
+
handler: 'auth.logout',
|
|
139
|
+
middlewares: [],
|
|
140
|
+
config: {
|
|
141
|
+
title: 'Logout',
|
|
142
|
+
description: 'Logout (clears cookie if in cookie mode)',
|
|
143
|
+
response: {
|
|
144
|
+
200: { $ref: 'defaultResponse#' }
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
134
148
|
{
|
|
135
149
|
method: 'POST',
|
|
136
150
|
path: '/refresh-token',
|
|
@@ -160,37 +174,7 @@ export default {
|
|
|
160
174
|
}
|
|
161
175
|
}
|
|
162
176
|
},
|
|
163
|
-
|
|
164
|
-
method: 'POST',
|
|
165
|
-
path: '/block/:id',
|
|
166
|
-
roles: [roles.admin, roles.backoffice],
|
|
167
|
-
handler: 'auth.block',
|
|
168
|
-
middlewares: ['global.isAuthenticated'],
|
|
169
|
-
config: {
|
|
170
|
-
title: 'Block a user by id',
|
|
171
|
-
description: 'Block a user by id',
|
|
172
|
-
params: { $ref: 'onlyIdSchema#' },
|
|
173
|
-
body: { $ref: 'blockBodySchema#' },
|
|
174
|
-
response: {
|
|
175
|
-
200: { $ref: 'defaultResponse#' }
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
method: 'POST',
|
|
181
|
-
path: '/unblock/:id',
|
|
182
|
-
roles: [roles.admin, roles.backoffice],
|
|
183
|
-
handler: 'auth.unblock',
|
|
184
|
-
middlewares: ['global.isAuthenticated'],
|
|
185
|
-
config: {
|
|
186
|
-
title: 'Unblock a user by id',
|
|
187
|
-
description: 'Unblock a user by id',
|
|
188
|
-
params: { $ref: 'onlyIdSchema#' },
|
|
189
|
-
response: {
|
|
190
|
-
200: { $ref: 'defaultResponse#' }
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
},
|
|
177
|
+
|
|
194
178
|
{
|
|
195
179
|
method: 'POST',
|
|
196
180
|
path: '/mfa/setup',
|
|
@@ -223,7 +207,7 @@ export default {
|
|
|
223
207
|
{
|
|
224
208
|
method: 'POST',
|
|
225
209
|
path: '/mfa/verify',
|
|
226
|
-
roles: [],
|
|
210
|
+
roles: [],
|
|
227
211
|
handler: 'auth.mfaVerify',
|
|
228
212
|
middlewares: [],
|
|
229
213
|
config: {
|
|
@@ -249,6 +233,7 @@ export default {
|
|
|
249
233
|
200: { $ref: 'defaultResponse#' }
|
|
250
234
|
}
|
|
251
235
|
}
|
|
252
|
-
}
|
|
236
|
+
},
|
|
237
|
+
|
|
253
238
|
]
|
|
254
239
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { FastifyReply, FastifyRequest } from 'fastify'
|
|
2
2
|
|
|
3
3
|
export async function synchronizeSchemas(req: FastifyRequest, reply: FastifyReply) {
|
|
4
|
+
const { multi_tenant } = global.config?.options || {}
|
|
5
|
+
if (multi_tenant?.enabled) {
|
|
6
|
+
throw new Error('Schema synchronization is not supported in multi-tenant mode.')
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
if (!req.server['dataBaseManager'].isImplemented()) {
|
|
5
10
|
throw new Error('Not implemented')
|
|
6
11
|
}
|