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

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