@nocobase/plugin-auth 0.14.0-alpha.3 → 0.14.0-alpha.4
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 +5 -5
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/server/basic-auth.js +7 -1
- package/dist/server/migrations/20230506152253-basic-authenticator.js +12 -0
- package/dist/server/plugin.js +4 -1
- package/dist/swagger/index.d.ts +52 -0
- package/dist/swagger/index.js +52 -0
- package/package.json +2 -2
package/dist/externalVersion.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.14.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.14.0-alpha.4",
|
|
3
3
|
"react": "18.2.0",
|
|
4
|
-
"@nocobase/auth": "0.14.0-alpha.
|
|
5
|
-
"@nocobase/database": "0.14.0-alpha.
|
|
6
|
-
"@nocobase/server": "0.14.0-alpha.
|
|
4
|
+
"@nocobase/auth": "0.14.0-alpha.4",
|
|
5
|
+
"@nocobase/database": "0.14.0-alpha.4",
|
|
6
|
+
"@nocobase/server": "0.14.0-alpha.4",
|
|
7
7
|
"antd": "5.8.6",
|
|
8
8
|
"@formily/react": "2.2.27",
|
|
9
9
|
"@formily/shared": "2.2.27",
|
|
10
10
|
"react-i18next": "11.18.6",
|
|
11
11
|
"@ant-design/icons": "5.1.4",
|
|
12
|
-
"@nocobase/actions": "0.14.0-alpha.
|
|
12
|
+
"@nocobase/actions": "0.14.0-alpha.4"
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"2.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":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage"},"dependencies":{"luxon":"^3.2.1"},"devDependencies":{"chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","jest":"~29.5.x","prettier":"~2.8.x","sinon":"^15.0.x"},"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)","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)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-09-
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"2.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":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage"},"dependencies":{"luxon":"^3.2.1"},"devDependencies":{"chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","jest":"~29.5.x","prettier":"~2.8.x","sinon":"^15.0.x"},"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)","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)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2023-09-21T15:34:49.557Z"}
|
|
@@ -146,9 +146,15 @@ class BasicAuth extends import_auth.BaseAuth {
|
|
|
146
146
|
if (!currentUser) {
|
|
147
147
|
ctx.throw(401);
|
|
148
148
|
}
|
|
149
|
+
let key;
|
|
150
|
+
if (currentUser.username) {
|
|
151
|
+
key = "username";
|
|
152
|
+
} else {
|
|
153
|
+
key = "email";
|
|
154
|
+
}
|
|
149
155
|
const user = await this.userRepository.findOne({
|
|
150
156
|
where: {
|
|
151
|
-
|
|
157
|
+
[key]: currentUser[key]
|
|
152
158
|
}
|
|
153
159
|
});
|
|
154
160
|
const pwd = this.userCollection.getField("password");
|
|
@@ -30,6 +30,18 @@ class AddBasicAuthMigration extends import_server.Migration {
|
|
|
30
30
|
drop: false
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
+
await this.db.getCollection("tokenBlacklist").sync({
|
|
34
|
+
force: false,
|
|
35
|
+
alter: {
|
|
36
|
+
drop: false
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
await this.db.getCollection("usersAuthenticators").sync({
|
|
40
|
+
force: false,
|
|
41
|
+
alter: {
|
|
42
|
+
drop: false
|
|
43
|
+
}
|
|
44
|
+
});
|
|
33
45
|
const repo = this.context.db.getRepository("authenticators");
|
|
34
46
|
const existed = await repo.count();
|
|
35
47
|
if (existed) {
|
package/dist/server/plugin.js
CHANGED
|
@@ -75,7 +75,10 @@ class AuthPlugin extends import_server.Plugin {
|
|
|
75
75
|
title: "Password"
|
|
76
76
|
});
|
|
77
77
|
Object.entries(import_auth.default).forEach(
|
|
78
|
-
([action, handler]) =>
|
|
78
|
+
([action, handler]) => {
|
|
79
|
+
var _a;
|
|
80
|
+
return (_a = this.app.resourcer.getResource("auth")) == null ? void 0 : _a.addAction(action, handler);
|
|
81
|
+
}
|
|
79
82
|
);
|
|
80
83
|
Object.entries(import_authenticators.default).forEach(
|
|
81
84
|
([action, handler]) => this.app.resourcer.registerAction(`authenticators:${action}`, handler)
|
package/dist/swagger/index.d.ts
CHANGED
|
@@ -312,6 +312,58 @@ declare const _default: {
|
|
|
312
312
|
};
|
|
313
313
|
};
|
|
314
314
|
};
|
|
315
|
+
'/auth:changePassword': {
|
|
316
|
+
post: {
|
|
317
|
+
description: string;
|
|
318
|
+
tags: string[];
|
|
319
|
+
security: any[];
|
|
320
|
+
requestBody: {
|
|
321
|
+
content: {
|
|
322
|
+
'application/json': {
|
|
323
|
+
schema: {
|
|
324
|
+
type: string;
|
|
325
|
+
properties: {
|
|
326
|
+
oldPassword: {
|
|
327
|
+
type: string;
|
|
328
|
+
description: string;
|
|
329
|
+
};
|
|
330
|
+
newPassword: {
|
|
331
|
+
type: string;
|
|
332
|
+
description: string;
|
|
333
|
+
};
|
|
334
|
+
confirmPassword: {
|
|
335
|
+
type: string;
|
|
336
|
+
description: string;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
responses: {
|
|
344
|
+
200: {
|
|
345
|
+
description: string;
|
|
346
|
+
content: {
|
|
347
|
+
'application/json': {
|
|
348
|
+
schema: {
|
|
349
|
+
$ref: string;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
401: {
|
|
355
|
+
description: string;
|
|
356
|
+
content: {
|
|
357
|
+
'application/json': {
|
|
358
|
+
schema: {
|
|
359
|
+
$ref: string;
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
};
|
|
315
367
|
'authenticators:listTypes': {
|
|
316
368
|
get: {
|
|
317
369
|
description: string;
|
package/dist/swagger/index.js
CHANGED
|
@@ -340,6 +340,58 @@ var swagger_default = {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
},
|
|
343
|
+
"/auth:changePassword": {
|
|
344
|
+
post: {
|
|
345
|
+
description: "Change password",
|
|
346
|
+
tags: ["Basic auth"],
|
|
347
|
+
security: [],
|
|
348
|
+
requestBody: {
|
|
349
|
+
content: {
|
|
350
|
+
"application/json": {
|
|
351
|
+
schema: {
|
|
352
|
+
type: "object",
|
|
353
|
+
properties: {
|
|
354
|
+
oldPassword: {
|
|
355
|
+
type: "string",
|
|
356
|
+
description: "\u65E7\u5BC6\u7801"
|
|
357
|
+
},
|
|
358
|
+
newPassword: {
|
|
359
|
+
type: "string",
|
|
360
|
+
description: "\u65B0\u5BC6\u7801"
|
|
361
|
+
},
|
|
362
|
+
confirmPassword: {
|
|
363
|
+
type: "string",
|
|
364
|
+
description: "\u786E\u8BA4\u5BC6\u7801"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
responses: {
|
|
372
|
+
200: {
|
|
373
|
+
description: "ok",
|
|
374
|
+
content: {
|
|
375
|
+
"application/json": {
|
|
376
|
+
schema: {
|
|
377
|
+
$ref: "#/components/schemas/user"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
401: {
|
|
383
|
+
description: "Unauthorized",
|
|
384
|
+
content: {
|
|
385
|
+
"application/json": {
|
|
386
|
+
schema: {
|
|
387
|
+
$ref: "#/components/schemas/error"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
343
395
|
"authenticators:listTypes": {
|
|
344
396
|
get: {
|
|
345
397
|
description: "List authenticator types",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "0.14.0-alpha.
|
|
3
|
+
"version": "0.14.0-alpha.4",
|
|
4
4
|
"main": "./dist/server/index.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@ant-design/icons": "5.x",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"displayName.zh-CN": "用户认证",
|
|
25
25
|
"description": "Basic authentication and authenticator management",
|
|
26
26
|
"description.zh-CN": "提供基础认证功能和扩展认证器管理功能",
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "e2aab7863bbdfd76afc7164272b275e868ac59c0"
|
|
28
28
|
}
|