@tachybase/module-auth 1.6.20 → 1.6.22
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/dist/externalVersion.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "1.6.
|
|
3
|
+
"@tachybase/client": "1.6.22",
|
|
4
4
|
"react-router-dom": "6.28.1",
|
|
5
|
-
"@tego/client": "1.6.
|
|
5
|
+
"@tego/client": "1.6.13",
|
|
6
6
|
"axios": "1.13.0",
|
|
7
7
|
"lodash": "4.17.21",
|
|
8
|
-
"@tego/server": "1.6.
|
|
9
|
-
"@tachybase/test": "1.6.
|
|
8
|
+
"@tego/server": "1.6.13",
|
|
9
|
+
"@tachybase/test": "1.6.13",
|
|
10
10
|
"antd": "5.22.5",
|
|
11
|
-
"@tachybase/schema": "1.6.
|
|
11
|
+
"@tachybase/schema": "1.6.13",
|
|
12
12
|
"react-i18next": "16.2.1",
|
|
13
13
|
"@ant-design/icons": "6.1.0"
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"3.3.1","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b tsconfig.build.json","lint:eslint":"eslint src/ tests/","lint:prettier":"prettier ./**/*.{json,md,yml} --check","lint":"npm run lint:eslint && npm run lint:prettier","lint:fix":"npm run lint:eslint -- --fix && npm run lint:prettier -- --write","test":"jest --coverage","test:watch":"jest --watch --coverage","test:fuzz":"jest --testMatch='**/*.fuzz.ts' --coverage=false --testTimeout=120000","prepare":"husky"},"dependencies":{"@types/luxon":"~3.4.0","luxon":"~3.5.0"},"devDependencies":{"@commitlint/cli":"19.6.0","@eslint/js":"^9.14.0","@fast-check/jest":"2.0.3","@insurgent/commitlint-config":"20.0.0","@insurgent/conventional-changelog-preset":"10.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/git":"10.0.1","@semantic-release/github":"11.0.1","@semantic-release/npm":"12.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/jest":"29.5.14","@types/node":"20.17.9","@types/sinon":"17.0.3","chai":"4.5.0","eslint":"8.57.1","eslint-config-prettier":"9.1.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"5.2.1","husky":"9.1.7","jest":"29.7.0","lint-staged":"15.2.10","prettier":"3.3.3","semantic-release":"24.2.0","sinon":"17.0.2","ts-jest":"29.2.5","typescript":"5.7.2","typescript-eslint":"^7.2.0"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Pierre Cavin <me@sherlox.io> (https://github.com/sheerlox)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"files":["dist/**/*.js","dist/**/*.d.ts","CHANGELOG.md","LICENSE","README.md"],"lint-staged":{"*.ts":"eslint src/ tests/ --fix","*.{json,md,yml}":"prettier ./**/*.{json,md,yml} --check --write"},"_lastModified":"2026-
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"3.3.1","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b tsconfig.build.json","lint:eslint":"eslint src/ tests/","lint:prettier":"prettier ./**/*.{json,md,yml} --check","lint":"npm run lint:eslint && npm run lint:prettier","lint:fix":"npm run lint:eslint -- --fix && npm run lint:prettier -- --write","test":"jest --coverage","test:watch":"jest --watch --coverage","test:fuzz":"jest --testMatch='**/*.fuzz.ts' --coverage=false --testTimeout=120000","prepare":"husky"},"dependencies":{"@types/luxon":"~3.4.0","luxon":"~3.5.0"},"devDependencies":{"@commitlint/cli":"19.6.0","@eslint/js":"^9.14.0","@fast-check/jest":"2.0.3","@insurgent/commitlint-config":"20.0.0","@insurgent/conventional-changelog-preset":"10.0.0","@semantic-release/changelog":"6.0.3","@semantic-release/commit-analyzer":"13.0.0","@semantic-release/git":"10.0.1","@semantic-release/github":"11.0.1","@semantic-release/npm":"12.0.1","@semantic-release/release-notes-generator":"14.0.1","@types/jest":"29.5.14","@types/node":"20.17.9","@types/sinon":"17.0.3","chai":"4.5.0","eslint":"8.57.1","eslint-config-prettier":"9.1.0","eslint-plugin-jest":"27.9.0","eslint-plugin-prettier":"5.2.1","husky":"9.1.7","jest":"29.7.0","lint-staged":"15.2.10","prettier":"3.3.3","semantic-release":"24.2.0","sinon":"17.0.2","ts-jest":"29.2.5","typescript":"5.7.2","typescript-eslint":"^7.2.0"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Pierre Cavin <me@sherlox.io> (https://github.com/sheerlox)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"files":["dist/**/*.js","dist/**/*.d.ts","CHANGELOG.md","LICENSE","README.md"],"lint-staged":{"*.ts":"eslint src/ tests/ --fix","*.{json,md,yml}":"prettier ./**/*.{json,md,yml} --check --write"},"_lastModified":"2026-06-16T10:29:22.636Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-
|
|
1
|
+
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-06-16T10:29:22.744Z"}
|
|
@@ -35,6 +35,14 @@ var import_server = require("@tego/server");
|
|
|
35
35
|
var import_ms = __toESM(require("ms"));
|
|
36
36
|
var import_constants = require("../constants");
|
|
37
37
|
const JTICACHEKEY = "token-jti";
|
|
38
|
+
const RENEWED_JTI_CACHE_KEY_PREFIX = "jti-renewed-cache";
|
|
39
|
+
const LEGACY_RENEWED_JTI_CACHE_KEY_PREFIX = "jti-renewed-cahce";
|
|
40
|
+
function getRenewedJtiCacheKey(jti) {
|
|
41
|
+
return `${RENEWED_JTI_CACHE_KEY_PREFIX}:${jti}`;
|
|
42
|
+
}
|
|
43
|
+
function getLegacyRenewedJtiCacheKey(jti) {
|
|
44
|
+
return `${LEGACY_RENEWED_JTI_CACHE_KEY_PREFIX}:${jti}`;
|
|
45
|
+
}
|
|
38
46
|
class TokenController {
|
|
39
47
|
constructor({ cache, app, logger }) {
|
|
40
48
|
this.renew = async (jti) => {
|
|
@@ -47,14 +55,21 @@ class TokenController {
|
|
|
47
55
|
{ where: { jti } }
|
|
48
56
|
);
|
|
49
57
|
if (count === 1) {
|
|
50
|
-
|
|
58
|
+
const renewedJtiData = { jti: newId, issuedTime };
|
|
59
|
+
await this.cache.set(getRenewedJtiCacheKey(jti), renewedJtiData, import_constants.RENEWED_JTI_CACHE_MS);
|
|
60
|
+
await this.setLegacyRenewedJtiCache(jti, renewedJtiData);
|
|
51
61
|
this.logger.info("jti renewed", { oldJti: jti, newJti: newId, issuedTime });
|
|
52
|
-
return
|
|
62
|
+
return renewedJtiData;
|
|
53
63
|
} else {
|
|
54
|
-
const cachedJtiData = await this.cache.get(
|
|
64
|
+
const cachedJtiData = await this.cache.get(getRenewedJtiCacheKey(jti));
|
|
55
65
|
if (cachedJtiData) {
|
|
56
66
|
return cachedJtiData;
|
|
57
67
|
}
|
|
68
|
+
const legacyCachedJtiData = await this.cache.get(getLegacyRenewedJtiCacheKey(jti));
|
|
69
|
+
if (legacyCachedJtiData) {
|
|
70
|
+
await this.cache.set(getRenewedJtiCacheKey(jti), legacyCachedJtiData, import_constants.RENEWED_JTI_CACHE_MS);
|
|
71
|
+
return legacyCachedJtiData;
|
|
72
|
+
}
|
|
58
73
|
this.logger.error("jti renew failed", {
|
|
59
74
|
module: "auth",
|
|
60
75
|
submodule: "token-controller",
|
|
@@ -129,17 +144,39 @@ class TokenController {
|
|
|
129
144
|
userId
|
|
130
145
|
};
|
|
131
146
|
await this.setTokenInfo(jti, data);
|
|
132
|
-
|
|
133
|
-
|
|
147
|
+
const logCleanupError = (err) => {
|
|
148
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
149
|
+
this.logger.error(message, {
|
|
150
|
+
module: "auth",
|
|
151
|
+
submodule: "token-controller",
|
|
152
|
+
method: "removeSessionExpiredTokens",
|
|
153
|
+
err
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
if (process.env.DB_DIALECT === "sqlite") {
|
|
157
|
+
try {
|
|
134
158
|
await this.removeSessionExpiredTokens(userId);
|
|
135
|
-
}
|
|
136
|
-
|
|
159
|
+
} catch (err) {
|
|
160
|
+
logCleanupError(err);
|
|
137
161
|
}
|
|
138
|
-
}
|
|
139
|
-
this.
|
|
162
|
+
} else {
|
|
163
|
+
void this.removeSessionExpiredTokens(userId).catch(logCleanupError);
|
|
140
164
|
}
|
|
141
165
|
return data;
|
|
142
166
|
}
|
|
167
|
+
async setLegacyRenewedJtiCache(jti, data) {
|
|
168
|
+
try {
|
|
169
|
+
await this.cache.set(getLegacyRenewedJtiCacheKey(jti), data, import_constants.RENEWED_JTI_CACHE_MS);
|
|
170
|
+
} catch (err) {
|
|
171
|
+
this.logger.warn("legacy renewed jti cache write failed", {
|
|
172
|
+
module: "auth",
|
|
173
|
+
submodule: "token-controller",
|
|
174
|
+
method: "renew",
|
|
175
|
+
jti,
|
|
176
|
+
err
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
143
180
|
}
|
|
144
181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
145
182
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-auth",
|
|
3
3
|
"displayName": "Authentication",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.22",
|
|
5
5
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Authentication",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dependencies": {},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@ant-design/icons": "^6.1.0",
|
|
23
|
-
"@tachybase/schema": "1.6.
|
|
24
|
-
"@tachybase/test": "1.6.
|
|
25
|
-
"@tego/client": "1.6.
|
|
26
|
-
"@tego/server": "1.6.
|
|
23
|
+
"@tachybase/schema": "1.6.13",
|
|
24
|
+
"@tachybase/test": "1.6.13",
|
|
25
|
+
"@tego/client": "1.6.13",
|
|
26
|
+
"@tego/server": "1.6.13",
|
|
27
27
|
"antd": "5.22.5",
|
|
28
28
|
"axios": "1.13.0",
|
|
29
29
|
"cron": "^3.3.1",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"react": "18.3.1",
|
|
33
33
|
"react-i18next": "16.2.1",
|
|
34
34
|
"react-router-dom": "6.28.1",
|
|
35
|
-
"@tachybase/client": "1.6.
|
|
35
|
+
"@tachybase/client": "1.6.22"
|
|
36
36
|
},
|
|
37
37
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
38
38
|
"displayName.zh-CN": "用户认证",
|