@nocobase/auth 1.6.0-beta.6 → 1.6.0-beta.8
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/lib/base/auth.js +10 -1
- package/package.json +7 -7
package/lib/base/auth.js
CHANGED
|
@@ -169,6 +169,12 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
|
|
|
169
169
|
code: import_auth.AuthErrorCode.SKIP_TOKEN_RENEW
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
+
if (!jti) {
|
|
173
|
+
this.ctx.throw(401, {
|
|
174
|
+
message: this.ctx.t("Your session has expired. Please sign in again.", { ns: localeNamespace }),
|
|
175
|
+
code: import_auth.AuthErrorCode.INVALID_TOKEN
|
|
176
|
+
});
|
|
177
|
+
}
|
|
172
178
|
const renewedResult = await this.tokenController.renew(jti);
|
|
173
179
|
this.ctx.logger.info("token renewed", {
|
|
174
180
|
method: "auth.check",
|
|
@@ -176,7 +182,10 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
|
|
|
176
182
|
headers: JSON.stringify((_g = (_f = this.ctx) == null ? void 0 : _f.req) == null ? void 0 : _g.headers)
|
|
177
183
|
});
|
|
178
184
|
const expiresIn = Math.floor(tokenPolicy.tokenExpirationTime / 1e3);
|
|
179
|
-
const newToken = this.jwt.sign(
|
|
185
|
+
const newToken = this.jwt.sign(
|
|
186
|
+
{ userId, roleName, temp, signInTime, iat: Math.floor(renewedResult.issuedTime / 1e3) },
|
|
187
|
+
{ jwtid: renewedResult.jti, expiresIn }
|
|
188
|
+
);
|
|
180
189
|
this.ctx.res.setHeader("x-new-token", newToken);
|
|
181
190
|
return user;
|
|
182
191
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/auth",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/actions": "1.6.0-beta.
|
|
10
|
-
"@nocobase/cache": "1.6.0-beta.
|
|
11
|
-
"@nocobase/database": "1.6.0-beta.
|
|
12
|
-
"@nocobase/resourcer": "1.6.0-beta.
|
|
13
|
-
"@nocobase/utils": "1.6.0-beta.
|
|
9
|
+
"@nocobase/actions": "1.6.0-beta.8",
|
|
10
|
+
"@nocobase/cache": "1.6.0-beta.8",
|
|
11
|
+
"@nocobase/database": "1.6.0-beta.8",
|
|
12
|
+
"@nocobase/resourcer": "1.6.0-beta.8",
|
|
13
|
+
"@nocobase/utils": "1.6.0-beta.8",
|
|
14
14
|
"@types/jsonwebtoken": "^8.5.8",
|
|
15
15
|
"jsonwebtoken": "^8.5.1"
|
|
16
16
|
},
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
20
20
|
"directory": "packages/auth"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "2257b50e1cf0b2a2873673a630e5ecc80ec2e01a"
|
|
23
23
|
}
|