@nocobase/auth 1.7.0-beta.8 → 1.8.0-beta.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/lib/base/auth.d.ts +1 -0
- package/lib/base/auth.js +18 -14
- package/lib/base/token-control-service.d.ts +1 -1
- package/package.json +9 -9
package/lib/base/auth.d.ts
CHANGED
package/lib/base/auth.js
CHANGED
|
@@ -240,6 +240,23 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
|
|
|
240
240
|
async validate() {
|
|
241
241
|
return null;
|
|
242
242
|
}
|
|
243
|
+
async signNewToken(userId) {
|
|
244
|
+
const tokenInfo = await this.tokenController.add({ userId });
|
|
245
|
+
const expiresIn = Math.floor((await this.tokenController.getConfig()).tokenExpirationTime / 1e3);
|
|
246
|
+
const token = this.jwt.sign(
|
|
247
|
+
{
|
|
248
|
+
userId,
|
|
249
|
+
temp: true,
|
|
250
|
+
iat: Math.floor(tokenInfo.issuedTime / 1e3),
|
|
251
|
+
signInTime: tokenInfo.signInTime
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
jwtid: tokenInfo.jti,
|
|
255
|
+
expiresIn
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
return token;
|
|
259
|
+
}
|
|
243
260
|
async signIn() {
|
|
244
261
|
let user;
|
|
245
262
|
try {
|
|
@@ -255,20 +272,7 @@ const _BaseAuth = class _BaseAuth extends import_auth.Auth {
|
|
|
255
272
|
code: import_auth.AuthErrorCode.NOT_EXIST_USER
|
|
256
273
|
});
|
|
257
274
|
}
|
|
258
|
-
const
|
|
259
|
-
const expiresIn = Math.floor((await this.tokenController.getConfig()).tokenExpirationTime / 1e3);
|
|
260
|
-
const token = this.jwt.sign(
|
|
261
|
-
{
|
|
262
|
-
userId: user.id,
|
|
263
|
-
temp: true,
|
|
264
|
-
iat: Math.floor(tokenInfo.issuedTime / 1e3),
|
|
265
|
-
signInTime: tokenInfo.signInTime
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
jwtid: tokenInfo.jti,
|
|
269
|
-
expiresIn
|
|
270
|
-
}
|
|
271
|
-
);
|
|
275
|
+
const token = await this.signNewToken(user.id);
|
|
272
276
|
return {
|
|
273
277
|
user,
|
|
274
278
|
token
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-beta.1",
|
|
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.
|
|
10
|
-
"@nocobase/cache": "1.
|
|
11
|
-
"@nocobase/database": "1.
|
|
12
|
-
"@nocobase/resourcer": "1.
|
|
13
|
-
"@nocobase/utils": "1.
|
|
14
|
-
"@types/jsonwebtoken": "^
|
|
15
|
-
"jsonwebtoken": "^
|
|
9
|
+
"@nocobase/actions": "1.8.0-beta.1",
|
|
10
|
+
"@nocobase/cache": "1.8.0-beta.1",
|
|
11
|
+
"@nocobase/database": "1.8.0-beta.1",
|
|
12
|
+
"@nocobase/resourcer": "1.8.0-beta.1",
|
|
13
|
+
"@nocobase/utils": "1.8.0-beta.1",
|
|
14
|
+
"@types/jsonwebtoken": "^9.0.9",
|
|
15
|
+
"jsonwebtoken": "^9.0.2"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
20
20
|
"directory": "packages/auth"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "103935669123174f2942247202e3d9ff15f0d4ed"
|
|
23
23
|
}
|