@nocobase/plugin-auth 0.12.0-alpha.5 → 0.13.0-alpha.10

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.
@@ -0,0 +1,735 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var swagger_exports = {};
19
+ __export(swagger_exports, {
20
+ default: () => swagger_default
21
+ });
22
+ module.exports = __toCommonJS(swagger_exports);
23
+ var swagger_default = {
24
+ info: {
25
+ title: "NocoBase API - Auth plugin"
26
+ },
27
+ paths: {
28
+ "/auth:check": {
29
+ get: {
30
+ description: "Check if the user is logged in",
31
+ tags: ["Auth"],
32
+ parameters: [
33
+ {
34
+ name: "X-Authenticator",
35
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6",
36
+ in: "header",
37
+ schema: {
38
+ type: "string",
39
+ default: "basic"
40
+ }
41
+ }
42
+ ],
43
+ security: [],
44
+ responses: {
45
+ 200: {
46
+ description: "successful operation",
47
+ content: {
48
+ "application/json": {
49
+ schema: {
50
+ allOf: [
51
+ {
52
+ $ref: "#/components/schemas/user"
53
+ },
54
+ {
55
+ type: "object",
56
+ properties: {
57
+ roles: {
58
+ $ref: "#/components/schemas/roles"
59
+ }
60
+ }
61
+ }
62
+ ]
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ },
70
+ "/auth:signIn": {
71
+ post: {
72
+ description: "Sign in",
73
+ tags: ["Basic auth"],
74
+ security: [],
75
+ parameters: [
76
+ {
77
+ name: "X-Authenticator",
78
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6",
79
+ in: "header",
80
+ schema: {
81
+ type: "string",
82
+ default: "basic"
83
+ }
84
+ }
85
+ ],
86
+ requestBody: {
87
+ content: {
88
+ "application/json": {
89
+ schema: {
90
+ type: "object",
91
+ properties: {
92
+ email: {
93
+ type: "string",
94
+ description: "\u90AE\u7BB1"
95
+ },
96
+ password: {
97
+ type: "string",
98
+ description: "\u5BC6\u7801"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ },
105
+ responses: {
106
+ 200: {
107
+ description: "successful operation",
108
+ content: {
109
+ "application/json": {
110
+ schema: {
111
+ type: "object",
112
+ properties: {
113
+ token: {
114
+ type: "string"
115
+ },
116
+ user: {
117
+ $ref: "#/components/schemas/user"
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ },
124
+ 401: {
125
+ description: "Unauthorized",
126
+ content: {
127
+ "application/json": {
128
+ schema: {
129
+ $ref: "#/components/schemas/error"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ },
137
+ "/auth:signUp": {
138
+ post: {
139
+ description: "Sign up",
140
+ tags: ["Basic auth"],
141
+ security: [],
142
+ requestBody: {
143
+ content: {
144
+ "application/json": {
145
+ schema: {
146
+ type: "object",
147
+ properties: {
148
+ email: {
149
+ type: "string",
150
+ description: "\u90AE\u7BB1"
151
+ },
152
+ password: {
153
+ type: "string",
154
+ description: "\u5BC6\u7801"
155
+ },
156
+ confirm_password: {
157
+ type: "string",
158
+ description: "\u786E\u8BA4\u5BC6\u7801"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ },
165
+ responses: {
166
+ 200: {
167
+ description: "ok"
168
+ }
169
+ }
170
+ }
171
+ },
172
+ "/auth:signOut": {
173
+ post: {
174
+ description: "Sign out",
175
+ tags: ["Basic auth"],
176
+ security: [],
177
+ responses: {
178
+ 200: {
179
+ description: "ok"
180
+ }
181
+ }
182
+ }
183
+ },
184
+ "/auth:lostPassword": {
185
+ post: {
186
+ description: "Lost password",
187
+ tags: ["Basic auth"],
188
+ security: [],
189
+ requestBody: {
190
+ content: {
191
+ "application/json": {
192
+ schema: {
193
+ type: "object",
194
+ properties: {
195
+ email: {
196
+ type: "string",
197
+ description: "\u90AE\u7BB1"
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+ },
204
+ responses: {
205
+ 200: {
206
+ description: "successful operation",
207
+ content: {
208
+ "application/json": {
209
+ schema: {
210
+ allOf: [
211
+ {
212
+ $ref: "#/components/schemas/user"
213
+ },
214
+ {
215
+ type: "object",
216
+ properties: {
217
+ resetToken: {
218
+ type: "string",
219
+ description: "\u91CD\u7F6E\u5BC6\u7801\u7684token"
220
+ }
221
+ }
222
+ }
223
+ ]
224
+ }
225
+ }
226
+ }
227
+ },
228
+ 400: {
229
+ description: "Please fill in your email address",
230
+ content: {
231
+ "application/json": {
232
+ schema: {
233
+ $ref: "#/components/schemas/error"
234
+ }
235
+ }
236
+ }
237
+ },
238
+ 401: {
239
+ description: "The email is incorrect, please re-enter",
240
+ content: {
241
+ "application/json": {
242
+ schema: {
243
+ $ref: "#/components/schemas/error"
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ }
250
+ },
251
+ "/auth:resetPassword": {
252
+ post: {
253
+ description: "Reset password",
254
+ tags: ["Basic auth"],
255
+ security: [],
256
+ requestBody: {
257
+ content: {
258
+ "application/json": {
259
+ schema: {
260
+ type: "object",
261
+ properties: {
262
+ email: {
263
+ type: "string",
264
+ description: "\u90AE\u7BB1"
265
+ },
266
+ password: {
267
+ type: "string",
268
+ description: "\u5BC6\u7801"
269
+ },
270
+ resetToken: {
271
+ type: "string",
272
+ description: "\u91CD\u7F6E\u5BC6\u7801\u7684token"
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ },
279
+ responses: {
280
+ 200: {
281
+ description: "successful operation",
282
+ content: {
283
+ "application/json": {
284
+ schema: {
285
+ $ref: "#/components/schemas/user"
286
+ }
287
+ }
288
+ }
289
+ },
290
+ 404: {
291
+ description: "User not found",
292
+ content: {
293
+ "application/json": {
294
+ schema: {
295
+ $ref: "#/components/schemas/error"
296
+ }
297
+ }
298
+ }
299
+ }
300
+ }
301
+ }
302
+ },
303
+ "/auth:getUserByResetToken": {
304
+ get: {
305
+ description: "Get user by reset token",
306
+ tags: ["Basic auth"],
307
+ security: [],
308
+ parameters: [
309
+ {
310
+ name: "token",
311
+ in: "query",
312
+ description: "\u91CD\u7F6E\u5BC6\u7801\u7684token",
313
+ required: true,
314
+ schema: {
315
+ type: "string"
316
+ }
317
+ }
318
+ ],
319
+ responses: {
320
+ 200: {
321
+ description: "ok",
322
+ content: {
323
+ "application/json": {
324
+ schema: {
325
+ $ref: "#/components/schemas/user"
326
+ }
327
+ }
328
+ }
329
+ },
330
+ 401: {
331
+ description: "Unauthorized",
332
+ content: {
333
+ "application/json": {
334
+ schema: {
335
+ $ref: "#/components/schemas/error"
336
+ }
337
+ }
338
+ }
339
+ }
340
+ }
341
+ }
342
+ },
343
+ "authenticators:listTypes": {
344
+ get: {
345
+ description: "List authenticator types",
346
+ tags: ["Authenticator"],
347
+ responses: {
348
+ 200: {
349
+ description: "ok",
350
+ content: {
351
+ "application/json": {
352
+ schema: {
353
+ type: "array",
354
+ items: {
355
+ type: "string"
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+ }
362
+ }
363
+ },
364
+ "authenticators:publicList": {
365
+ get: {
366
+ description: "List enabled authenticators",
367
+ tags: ["Authenticator"],
368
+ security: [],
369
+ responses: {
370
+ 200: {
371
+ description: "ok",
372
+ content: {
373
+ "application/json": {
374
+ schema: {
375
+ type: "array",
376
+ items: {
377
+ type: "object",
378
+ properties: {
379
+ name: {
380
+ type: "string",
381
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6"
382
+ },
383
+ title: {
384
+ type: "string",
385
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u9898"
386
+ },
387
+ authType: {
388
+ type: "string",
389
+ description: "\u767B\u5F55\u65B9\u5F0F\u7C7B\u578B"
390
+ },
391
+ options: {
392
+ type: "object",
393
+ description: "\u767B\u5F55\u65B9\u5F0F\u516C\u5F00\u914D\u7F6E"
394
+ }
395
+ }
396
+ }
397
+ }
398
+ }
399
+ }
400
+ }
401
+ }
402
+ }
403
+ },
404
+ "authenticators:create": {
405
+ post: {
406
+ description: "Create authenticator",
407
+ tags: ["Authenticator"],
408
+ requestBody: {
409
+ content: {
410
+ "application/json": {
411
+ schema: {
412
+ type: "object",
413
+ properties: {
414
+ name: {
415
+ type: "string",
416
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6"
417
+ },
418
+ authType: {
419
+ type: "string",
420
+ description: "\u767B\u5F55\u65B9\u5F0F\u7C7B\u578B"
421
+ },
422
+ options: {
423
+ type: "object",
424
+ description: "\u767B\u5F55\u65B9\u5F0F\u914D\u7F6E"
425
+ }
426
+ }
427
+ }
428
+ }
429
+ }
430
+ },
431
+ responses: {
432
+ 200: {
433
+ description: "ok",
434
+ content: {
435
+ "application/json": {
436
+ schema: {
437
+ $ref: "#/components/schemas/authenticator"
438
+ }
439
+ }
440
+ }
441
+ }
442
+ }
443
+ }
444
+ },
445
+ "authenticators:list": {
446
+ get: {
447
+ description: "List authenticators",
448
+ tags: ["Authenticator"],
449
+ responses: {
450
+ 200: {
451
+ description: "ok",
452
+ content: {
453
+ "application/json": {
454
+ schema: {
455
+ type: "array",
456
+ items: {
457
+ $ref: "#/components/schemas/authenticator"
458
+ }
459
+ }
460
+ }
461
+ }
462
+ }
463
+ }
464
+ }
465
+ },
466
+ "authenticators:get": {
467
+ get: {
468
+ description: "Get authenticator",
469
+ tags: ["Authenticator"],
470
+ parameters: [
471
+ {
472
+ name: "filterByTk",
473
+ in: "query",
474
+ description: "ID",
475
+ required: true,
476
+ schema: {
477
+ type: "integer"
478
+ }
479
+ }
480
+ ],
481
+ responses: {
482
+ 200: {
483
+ description: "ok",
484
+ content: {
485
+ "application/json": {
486
+ schema: {
487
+ $ref: "#/components/schemas/authenticator"
488
+ }
489
+ }
490
+ }
491
+ }
492
+ }
493
+ }
494
+ },
495
+ "authenticators:update": {
496
+ post: {
497
+ description: "Update authenticator",
498
+ tags: ["Authenticator"],
499
+ parameters: [
500
+ {
501
+ name: "filterByTk",
502
+ in: "query",
503
+ description: "ID",
504
+ required: true,
505
+ schema: {
506
+ type: "integer"
507
+ }
508
+ }
509
+ ],
510
+ requestBody: {
511
+ content: {
512
+ "application/json": {
513
+ schema: {
514
+ $ref: "#/components/schemas/authenticator"
515
+ }
516
+ }
517
+ }
518
+ },
519
+ responses: {
520
+ 200: {
521
+ description: "ok",
522
+ content: {
523
+ "application/json": {
524
+ schema: {
525
+ $ref: "#/components/schemas/authenticator"
526
+ }
527
+ }
528
+ }
529
+ }
530
+ }
531
+ }
532
+ },
533
+ "authenticators:destroy": {
534
+ post: {
535
+ description: "Destroy authenticator",
536
+ tags: ["Authenticator"],
537
+ parameters: [
538
+ {
539
+ name: "filterByTk",
540
+ in: "query",
541
+ description: "ID",
542
+ required: true,
543
+ schema: {
544
+ type: "integer"
545
+ }
546
+ }
547
+ ],
548
+ responses: {
549
+ 200: {
550
+ description: "ok"
551
+ }
552
+ }
553
+ }
554
+ }
555
+ },
556
+ components: {
557
+ schemas: {
558
+ user: {
559
+ type: "object",
560
+ description: "\u7528\u6237",
561
+ properties: {
562
+ id: {
563
+ type: "integer",
564
+ description: "ID"
565
+ },
566
+ nickname: {
567
+ type: "string",
568
+ description: "\u6635\u79F0"
569
+ },
570
+ email: {
571
+ type: "string",
572
+ description: "\u90AE\u7BB1"
573
+ },
574
+ phone: {
575
+ type: "string",
576
+ description: "\u624B\u673A\u53F7"
577
+ },
578
+ appLang: {
579
+ type: "string",
580
+ description: "\u7528\u6237\u4F7F\u7528\u8BED\u8A00"
581
+ },
582
+ systemSettings: {
583
+ type: "object",
584
+ description: "\u7CFB\u7EDF\u8BBE\u7F6E",
585
+ properties: {
586
+ theme: {
587
+ type: "string",
588
+ description: "\u7528\u6237\u4F7F\u7528\u4E3B\u9898"
589
+ }
590
+ }
591
+ },
592
+ createdAt: {
593
+ type: "string",
594
+ format: "date-time",
595
+ description: "\u521B\u5EFA\u65F6\u95F4"
596
+ },
597
+ updatedAt: {
598
+ type: "string",
599
+ format: "date-time",
600
+ description: "\u66F4\u65B0\u65F6\u95F4"
601
+ },
602
+ createdById: {
603
+ type: "integer",
604
+ description: "\u521B\u5EFA\u4EBA"
605
+ },
606
+ updatedById: {
607
+ type: "integer",
608
+ description: "\u66F4\u65B0\u4EBA"
609
+ }
610
+ }
611
+ },
612
+ roles: {
613
+ type: "array",
614
+ description: "\u89D2\u8272",
615
+ items: {
616
+ type: "object",
617
+ properties: {
618
+ title: {
619
+ type: "string",
620
+ description: "\u89D2\u8272\u540D\u79F0"
621
+ },
622
+ name: {
623
+ type: "string",
624
+ description: "\u89D2\u8272\u6807\u8BC6"
625
+ },
626
+ description: {
627
+ type: "string",
628
+ description: "\u89D2\u8272\u63CF\u8FF0"
629
+ },
630
+ hidden: {
631
+ type: "boolean",
632
+ description: "\u662F\u5426\u9690\u85CF"
633
+ },
634
+ default: {
635
+ type: "boolean",
636
+ description: "\u662F\u5426\u9ED8\u8BA4"
637
+ },
638
+ allowConfigure: {
639
+ type: "boolean",
640
+ description: "\u662F\u5426\u5141\u8BB8\u914D\u7F6E"
641
+ },
642
+ allowNewMenu: {
643
+ type: "boolean",
644
+ description: "\u662F\u5426\u5141\u8BB8\u65B0\u5EFA\u83DC\u5355"
645
+ },
646
+ snippets: {
647
+ type: "array",
648
+ items: {
649
+ type: "string"
650
+ },
651
+ description: "\u63A5\u53E3\u6743\u9650"
652
+ },
653
+ strategy: {
654
+ type: "array",
655
+ description: "\u6570\u636E\u8868\u6743\u9650\u7B56\u7565",
656
+ items: {
657
+ type: "object",
658
+ properties: {
659
+ actions: {
660
+ type: "array",
661
+ items: {
662
+ type: "string"
663
+ },
664
+ description: "\u64CD\u4F5C"
665
+ }
666
+ }
667
+ }
668
+ },
669
+ createdAt: {
670
+ type: "string",
671
+ format: "date-time",
672
+ description: "\u521B\u5EFA\u65F6\u95F4"
673
+ },
674
+ updatedAt: {
675
+ type: "string",
676
+ format: "date-time",
677
+ description: "\u66F4\u65B0\u65F6\u95F4"
678
+ }
679
+ }
680
+ }
681
+ },
682
+ authenticator: {
683
+ type: "object",
684
+ properties: {
685
+ id: {
686
+ type: "integer",
687
+ description: "ID"
688
+ },
689
+ authType: {
690
+ type: "string",
691
+ description: "\u767B\u5F55\u65B9\u5F0F\u7C7B\u578B"
692
+ },
693
+ name: {
694
+ type: "string",
695
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6"
696
+ },
697
+ title: {
698
+ type: "string",
699
+ description: "\u767B\u5F55\u65B9\u5F0F\u6807\u9898"
700
+ },
701
+ options: {
702
+ type: "object",
703
+ description: "\u767B\u5F55\u65B9\u5F0F\u914D\u7F6E"
704
+ },
705
+ description: {
706
+ type: "string",
707
+ description: "\u767B\u5F55\u65B9\u5F0F\u63CF\u8FF0"
708
+ },
709
+ enabled: {
710
+ type: "boolean",
711
+ description: "\u662F\u5426\u542F\u7528"
712
+ },
713
+ createdAt: {
714
+ type: "string",
715
+ format: "date-time",
716
+ description: "\u521B\u5EFA\u65F6\u95F4"
717
+ },
718
+ updatedAt: {
719
+ type: "string",
720
+ format: "date-time",
721
+ description: "\u66F4\u65B0\u65F6\u95F4"
722
+ },
723
+ createdById: {
724
+ type: "integer",
725
+ description: "\u521B\u5EFA\u4EBA"
726
+ },
727
+ updatedById: {
728
+ type: "integer",
729
+ description: "\u66F4\u65B0\u4EBA"
730
+ }
731
+ }
732
+ }
733
+ }
734
+ }
735
+ };