@ackplus/nest-auth 1.1.29 → 1.1.30

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,1643 @@
1
+ {
2
+ "openapi": "3.0.0",
3
+ "paths": {
4
+ "/auth/signup": {
5
+ "post": {
6
+ "description": "Register a new user. Response format depends on accessTokenType configuration:\n- Header mode (default): Returns tokens in response body\n- Cookie mode: Sets tokens in HTTP-only cookies and returns success message",
7
+ "operationId": "AuthController_signup",
8
+ "parameters": [],
9
+ "requestBody": {
10
+ "required": true,
11
+ "content": {
12
+ "application/json": {
13
+ "schema": {
14
+ "$ref": "#/components/schemas/SignupRequestDto"
15
+ }
16
+ }
17
+ }
18
+ },
19
+ "responses": {
20
+ "200": {
21
+ "description": "Header mode: Returns message + tokens in body",
22
+ "content": {
23
+ "application/json": {
24
+ "schema": {
25
+ "$ref": "#/components/schemas/AuthWithTokensResponseDto"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ },
31
+ "summary": "Signup",
32
+ "tags": [
33
+ "Auth"
34
+ ]
35
+ }
36
+ },
37
+ "/auth/login": {
38
+ "post": {
39
+ "description": "Authenticate user. Response format depends on accessTokenType configuration:\n- Header mode (default): Returns tokens in response body\n- Cookie mode: Sets tokens in HTTP-only cookies and returns success message",
40
+ "operationId": "AuthController_login",
41
+ "parameters": [],
42
+ "requestBody": {
43
+ "required": true,
44
+ "content": {
45
+ "application/json": {
46
+ "schema": {
47
+ "$ref": "#/components/schemas/LoginRequestDto"
48
+ }
49
+ }
50
+ }
51
+ },
52
+ "responses": {
53
+ "200": {
54
+ "description": "Header mode: Returns message + tokens in body",
55
+ "content": {
56
+ "application/json": {
57
+ "schema": {
58
+ "$ref": "#/components/schemas/AuthWithTokensResponseDto"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "summary": "Login",
65
+ "tags": [
66
+ "Auth"
67
+ ]
68
+ }
69
+ },
70
+ "/auth/refresh-token": {
71
+ "post": {
72
+ "description": "Refresh access token. Response format depends on accessTokenType configuration:\n- Header mode (default): Returns new tokens in response body\n- Cookie mode: Sets new tokens in HTTP-only cookies and returns success message",
73
+ "operationId": "AuthController_refreshToken",
74
+ "parameters": [],
75
+ "requestBody": {
76
+ "required": true,
77
+ "content": {
78
+ "application/json": {
79
+ "schema": {
80
+ "$ref": "#/components/schemas/RefreshTokenRequestDto"
81
+ }
82
+ }
83
+ }
84
+ },
85
+ "responses": {
86
+ "200": {
87
+ "description": "Header mode: Returns message + tokens in body",
88
+ "content": {
89
+ "application/json": {
90
+ "schema": {
91
+ "$ref": "#/components/schemas/AuthWithTokensResponseDto"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ },
97
+ "summary": "Refresh Token",
98
+ "tags": [
99
+ "Auth"
100
+ ]
101
+ }
102
+ },
103
+ "/auth/send-2fa-code": {
104
+ "post": {
105
+ "operationId": "AuthController_send2faCode",
106
+ "parameters": [],
107
+ "responses": {
108
+ "200": {
109
+ "description": "",
110
+ "content": {
111
+ "application/json": {
112
+ "schema": {
113
+ "$ref": "#/components/schemas/MessageResponseDto"
114
+ }
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "summary": "Send 2FA Code",
120
+ "tags": [
121
+ "Auth"
122
+ ]
123
+ }
124
+ },
125
+ "/auth/verify-2fa": {
126
+ "post": {
127
+ "description": "Verify two-factor authentication. Response format depends on accessTokenType configuration:\n- Header mode (default): Returns tokens in response body\n- Cookie mode: Sets tokens in HTTP-only cookies and returns success message",
128
+ "operationId": "AuthController_verify2fa",
129
+ "parameters": [],
130
+ "requestBody": {
131
+ "required": true,
132
+ "content": {
133
+ "application/json": {
134
+ "schema": {
135
+ "$ref": "#/components/schemas/Verify2faRequestDto"
136
+ }
137
+ }
138
+ }
139
+ },
140
+ "responses": {
141
+ "200": {
142
+ "description": "Header mode: Returns message + tokens in body",
143
+ "content": {
144
+ "application/json": {
145
+ "schema": {
146
+ "$ref": "#/components/schemas/Verify2faWithTokensResponseDto"
147
+ }
148
+ }
149
+ }
150
+ }
151
+ },
152
+ "summary": "Verify 2FA",
153
+ "tags": [
154
+ "Auth"
155
+ ]
156
+ }
157
+ },
158
+ "/auth/logout": {
159
+ "post": {
160
+ "operationId": "AuthController_logout",
161
+ "parameters": [],
162
+ "responses": {
163
+ "200": {
164
+ "description": "",
165
+ "content": {
166
+ "application/json": {
167
+ "schema": {
168
+ "$ref": "#/components/schemas/MessageResponseDto"
169
+ }
170
+ }
171
+ }
172
+ }
173
+ },
174
+ "summary": "Logout",
175
+ "tags": [
176
+ "Auth"
177
+ ]
178
+ }
179
+ },
180
+ "/auth/logout-all": {
181
+ "post": {
182
+ "operationId": "AuthController_logoutAll",
183
+ "parameters": [],
184
+ "responses": {
185
+ "200": {
186
+ "description": "",
187
+ "content": {
188
+ "application/json": {
189
+ "schema": {
190
+ "$ref": "#/components/schemas/MessageResponseDto"
191
+ }
192
+ }
193
+ }
194
+ }
195
+ },
196
+ "summary": "Logout All",
197
+ "tags": [
198
+ "Auth"
199
+ ]
200
+ }
201
+ },
202
+ "/auth/change-password": {
203
+ "post": {
204
+ "operationId": "AuthController_changePassword",
205
+ "parameters": [],
206
+ "requestBody": {
207
+ "required": true,
208
+ "content": {
209
+ "application/json": {
210
+ "schema": {
211
+ "$ref": "#/components/schemas/ChangePasswordRequestDto"
212
+ }
213
+ }
214
+ }
215
+ },
216
+ "responses": {
217
+ "200": {
218
+ "description": "",
219
+ "content": {
220
+ "application/json": {
221
+ "schema": {
222
+ "$ref": "#/components/schemas/AuthWithTokensResponseDto"
223
+ }
224
+ }
225
+ }
226
+ }
227
+ },
228
+ "summary": "Change Password",
229
+ "tags": [
230
+ "Auth"
231
+ ]
232
+ }
233
+ },
234
+ "/auth/forgot-password": {
235
+ "post": {
236
+ "operationId": "AuthController_forgotPassword",
237
+ "parameters": [],
238
+ "requestBody": {
239
+ "required": true,
240
+ "content": {
241
+ "application/json": {
242
+ "schema": {
243
+ "$ref": "#/components/schemas/ForgotPasswordRequestDto"
244
+ }
245
+ }
246
+ }
247
+ },
248
+ "responses": {
249
+ "200": {
250
+ "description": "",
251
+ "content": {
252
+ "application/json": {
253
+ "schema": {
254
+ "$ref": "#/components/schemas/MessageResponseDto"
255
+ }
256
+ }
257
+ }
258
+ }
259
+ },
260
+ "summary": "Forgot Password",
261
+ "tags": [
262
+ "Auth"
263
+ ]
264
+ }
265
+ },
266
+ "/auth/verify-forgot-password-otp": {
267
+ "post": {
268
+ "operationId": "AuthController_verifyForgotPasswordOtp",
269
+ "parameters": [],
270
+ "requestBody": {
271
+ "required": true,
272
+ "content": {
273
+ "application/json": {
274
+ "schema": {
275
+ "$ref": "#/components/schemas/VerifyForgotPasswordOtpRequestDto"
276
+ }
277
+ }
278
+ }
279
+ },
280
+ "responses": {
281
+ "200": {
282
+ "description": "",
283
+ "content": {
284
+ "application/json": {
285
+ "schema": {
286
+ "$ref": "#/components/schemas/VerifyOtpResponseDto"
287
+ }
288
+ }
289
+ }
290
+ }
291
+ },
292
+ "summary": "Verify Forgot Password OTP and get reset token",
293
+ "tags": [
294
+ "Auth"
295
+ ]
296
+ }
297
+ },
298
+ "/auth/reset-password": {
299
+ "post": {
300
+ "operationId": "AuthController_resetPassword",
301
+ "parameters": [],
302
+ "requestBody": {
303
+ "required": true,
304
+ "content": {
305
+ "application/json": {
306
+ "schema": {
307
+ "$ref": "#/components/schemas/ResetPasswordRequestDto"
308
+ }
309
+ }
310
+ }
311
+ },
312
+ "responses": {
313
+ "200": {
314
+ "description": "",
315
+ "content": {
316
+ "application/json": {
317
+ "schema": {
318
+ "$ref": "#/components/schemas/MessageResponseDto"
319
+ }
320
+ }
321
+ }
322
+ }
323
+ },
324
+ "summary": "Reset Password (Legacy - using OTP)",
325
+ "tags": [
326
+ "Auth"
327
+ ]
328
+ }
329
+ },
330
+ "/auth/reset-password-with-token": {
331
+ "post": {
332
+ "operationId": "AuthController_resetPasswordWithToken",
333
+ "parameters": [],
334
+ "requestBody": {
335
+ "required": true,
336
+ "content": {
337
+ "application/json": {
338
+ "schema": {
339
+ "$ref": "#/components/schemas/ResetPasswordWithTokenRequestDto"
340
+ }
341
+ }
342
+ }
343
+ },
344
+ "responses": {
345
+ "200": {
346
+ "description": "",
347
+ "content": {
348
+ "application/json": {
349
+ "schema": {
350
+ "$ref": "#/components/schemas/MessageResponseDto"
351
+ }
352
+ }
353
+ }
354
+ }
355
+ },
356
+ "summary": "Reset Password with Token",
357
+ "tags": [
358
+ "Auth"
359
+ ]
360
+ }
361
+ },
362
+ "/auth/user": {
363
+ "get": {
364
+ "operationId": "AuthController_getUser",
365
+ "parameters": [],
366
+ "responses": {
367
+ "200": {
368
+ "description": "",
369
+ "content": {
370
+ "application/json": {
371
+ "schema": {
372
+ "$ref": "#/components/schemas/UserResponseDto"
373
+ }
374
+ }
375
+ }
376
+ }
377
+ },
378
+ "summary": "Get Logged In User",
379
+ "tags": [
380
+ "Auth"
381
+ ]
382
+ }
383
+ },
384
+ "/auth/send-email-verification": {
385
+ "post": {
386
+ "operationId": "AuthController_sendEmailVerification",
387
+ "parameters": [],
388
+ "requestBody": {
389
+ "required": true,
390
+ "content": {
391
+ "application/json": {
392
+ "schema": {
393
+ "$ref": "#/components/schemas/SendEmailVerificationRequestDto"
394
+ }
395
+ }
396
+ }
397
+ },
398
+ "responses": {
399
+ "200": {
400
+ "description": "",
401
+ "content": {
402
+ "application/json": {
403
+ "schema": {
404
+ "$ref": "#/components/schemas/MessageResponseDto"
405
+ }
406
+ }
407
+ }
408
+ }
409
+ },
410
+ "summary": "Send Email Verification",
411
+ "tags": [
412
+ "Auth"
413
+ ]
414
+ }
415
+ },
416
+ "/auth/verify-email": {
417
+ "post": {
418
+ "operationId": "AuthController_verifyEmail",
419
+ "parameters": [],
420
+ "requestBody": {
421
+ "required": true,
422
+ "content": {
423
+ "application/json": {
424
+ "schema": {
425
+ "$ref": "#/components/schemas/VerifyEmailRequestDto"
426
+ }
427
+ }
428
+ }
429
+ },
430
+ "responses": {
431
+ "200": {
432
+ "description": "",
433
+ "content": {
434
+ "application/json": {
435
+ "schema": {
436
+ "$ref": "#/components/schemas/MessageResponseDto"
437
+ }
438
+ }
439
+ }
440
+ }
441
+ },
442
+ "summary": "Verify Email",
443
+ "tags": [
444
+ "Auth"
445
+ ]
446
+ }
447
+ },
448
+ "/auth/client-config": {
449
+ "get": {
450
+ "description": "Returns backend configuration for frontend clients. Includes enabled auth methods, registration settings, MFA options, tenant configuration, and SSO providers. Can be customized via clientConfig.factory in AuthModuleOptions.",
451
+ "operationId": "AuthController_getClientConfig",
452
+ "parameters": [],
453
+ "responses": {
454
+ "200": {
455
+ "description": "",
456
+ "content": {
457
+ "application/json": {
458
+ "schema": {
459
+ "$ref": "#/components/schemas/ClientConfigResponseDto"
460
+ }
461
+ }
462
+ }
463
+ }
464
+ },
465
+ "summary": "Get Client Configuration",
466
+ "tags": [
467
+ "Auth"
468
+ ]
469
+ }
470
+ },
471
+ "/auth/callback/{provider}": {
472
+ "get": {
473
+ "description": "OAuth callback endpoint for SSO providers. Exchanges authorization code for access token and returns raw SSO user info. Returns HTML page that posts SSO data to parent window and auto-closes.",
474
+ "operationId": "AuthController_ssoCallback",
475
+ "parameters": [
476
+ {
477
+ "name": "provider",
478
+ "required": true,
479
+ "in": "path",
480
+ "schema": {
481
+ "type": "string"
482
+ }
483
+ }
484
+ ],
485
+ "responses": {
486
+ "200": {
487
+ "description": ""
488
+ }
489
+ },
490
+ "summary": "SSO Callback",
491
+ "tags": [
492
+ "Auth"
493
+ ]
494
+ }
495
+ },
496
+ "/auth/mfa/status": {
497
+ "get": {
498
+ "operationId": "MfaController_getStatus",
499
+ "parameters": [],
500
+ "responses": {
501
+ "200": {
502
+ "description": "",
503
+ "content": {
504
+ "application/json": {
505
+ "schema": {
506
+ "$ref": "#/components/schemas/MfaStatusResponseDto"
507
+ }
508
+ }
509
+ }
510
+ }
511
+ },
512
+ "summary": "Get MFA status for the current user",
513
+ "tags": [
514
+ "Mfa"
515
+ ]
516
+ }
517
+ },
518
+ "/auth/mfa/toggle": {
519
+ "post": {
520
+ "operationId": "MfaController_toggleMfa",
521
+ "parameters": [],
522
+ "requestBody": {
523
+ "required": true,
524
+ "content": {
525
+ "application/json": {
526
+ "schema": {
527
+ "$ref": "#/components/schemas/ToggleMfaRequestDto"
528
+ }
529
+ }
530
+ }
531
+ },
532
+ "responses": {
533
+ "200": {
534
+ "description": ""
535
+ }
536
+ },
537
+ "summary": "Enable or disable MFA for the current user",
538
+ "tags": [
539
+ "Mfa"
540
+ ]
541
+ }
542
+ },
543
+ "/auth/mfa/devices": {
544
+ "get": {
545
+ "operationId": "MfaController_listDevices",
546
+ "parameters": [],
547
+ "responses": {
548
+ "200": {
549
+ "description": "",
550
+ "content": {
551
+ "application/json": {
552
+ "schema": {
553
+ "type": "array",
554
+ "items": {
555
+ "$ref": "#/components/schemas/MfaDeviceDto"
556
+ }
557
+ }
558
+ }
559
+ }
560
+ }
561
+ },
562
+ "summary": "List registered MFA devices",
563
+ "tags": [
564
+ "Mfa"
565
+ ]
566
+ }
567
+ },
568
+ "/auth/mfa/devices/{deviceId}": {
569
+ "delete": {
570
+ "operationId": "MfaController_removeDevice",
571
+ "parameters": [
572
+ {
573
+ "name": "deviceId",
574
+ "required": true,
575
+ "in": "path",
576
+ "schema": {
577
+ "type": "string"
578
+ }
579
+ }
580
+ ],
581
+ "responses": {
582
+ "200": {
583
+ "description": ""
584
+ }
585
+ },
586
+ "summary": "Remove a registered MFA device",
587
+ "tags": [
588
+ "Mfa"
589
+ ]
590
+ }
591
+ },
592
+ "/auth/mfa/send-mfa-code": {
593
+ "post": {
594
+ "operationId": "MfaController_sendMfaCode",
595
+ "parameters": [],
596
+ "requestBody": {
597
+ "required": true,
598
+ "content": {
599
+ "application/json": {
600
+ "schema": {
601
+ "$ref": "#/components/schemas/SendMfaCodeRequestDto"
602
+ }
603
+ }
604
+ }
605
+ },
606
+ "responses": {
607
+ "200": {
608
+ "description": ""
609
+ }
610
+ },
611
+ "summary": "Send MFA Code",
612
+ "tags": [
613
+ "Mfa"
614
+ ]
615
+ }
616
+ },
617
+ "/auth/mfa/setup-totp": {
618
+ "post": {
619
+ "operationId": "MfaController_setupTotp",
620
+ "parameters": [],
621
+ "responses": {
622
+ "200": {
623
+ "description": ""
624
+ }
625
+ },
626
+ "summary": "Setup TOTP Device",
627
+ "tags": [
628
+ "Mfa"
629
+ ]
630
+ }
631
+ },
632
+ "/auth/mfa/verify-totp-setup": {
633
+ "post": {
634
+ "operationId": "MfaController_verifyTotpSetup",
635
+ "parameters": [],
636
+ "requestBody": {
637
+ "required": true,
638
+ "content": {
639
+ "application/json": {
640
+ "schema": {
641
+ "$ref": "#/components/schemas/VerifyTotpSetupRequestDto"
642
+ }
643
+ }
644
+ }
645
+ },
646
+ "responses": {
647
+ "200": {
648
+ "description": ""
649
+ }
650
+ },
651
+ "summary": "Verify TOTP Setup",
652
+ "tags": [
653
+ "Mfa"
654
+ ]
655
+ }
656
+ },
657
+ "/auth/mfa/generate-recovery-code": {
658
+ "post": {
659
+ "operationId": "MfaController_generateRecoveryCodes",
660
+ "parameters": [],
661
+ "responses": {
662
+ "200": {
663
+ "description": ""
664
+ }
665
+ },
666
+ "summary": "Generate Recovery Codes",
667
+ "tags": [
668
+ "Mfa"
669
+ ]
670
+ }
671
+ },
672
+ "/auth/mfa/reset-totp": {
673
+ "post": {
674
+ "operationId": "MfaController_resetTotp",
675
+ "parameters": [],
676
+ "responses": {
677
+ "200": {
678
+ "description": ""
679
+ }
680
+ },
681
+ "summary": "Reset TOTP Device",
682
+ "tags": [
683
+ "Mfa"
684
+ ]
685
+ }
686
+ }
687
+ },
688
+ "info": {
689
+ "title": "@ackplus/nest-auth API",
690
+ "description": "OpenAPI specification generated from the Nest Auth module",
691
+ "version": "1.1.29",
692
+ "contact": {}
693
+ },
694
+ "tags": [],
695
+ "servers": [],
696
+ "components": {
697
+ "securitySchemes": {
698
+ "bearer": {
699
+ "scheme": "bearer",
700
+ "bearerFormat": "JWT",
701
+ "type": "http"
702
+ }
703
+ },
704
+ "schemas": {
705
+ "SignupRequestDto": {
706
+ "type": "object",
707
+ "properties": {
708
+ "email": {
709
+ "type": "string",
710
+ "description": "User email address (required if phone not provided)",
711
+ "example": "user@example.com"
712
+ },
713
+ "phone": {
714
+ "type": "string",
715
+ "description": "User phone number (required if email not provided)",
716
+ "example": "+1234567890"
717
+ },
718
+ "password": {
719
+ "type": "string",
720
+ "description": "User password",
721
+ "example": "SecurePass123!",
722
+ "minLength": 8
723
+ },
724
+ "tenantId": {
725
+ "type": "string",
726
+ "description": "Tenant ID for multi-tenant applications",
727
+ "example": "123e4567-e89b-12d3-a456-426614174000"
728
+ }
729
+ },
730
+ "required": [
731
+ "password"
732
+ ]
733
+ },
734
+ "UserResponseDto": {
735
+ "type": "object",
736
+ "properties": {
737
+ "id": {
738
+ "type": "string",
739
+ "description": "User unique identifier",
740
+ "example": "123e4567-e89b-12d3-a456-426614174000"
741
+ },
742
+ "email": {
743
+ "type": "string",
744
+ "description": "User email address",
745
+ "example": "user@example.com"
746
+ },
747
+ "phone": {
748
+ "type": "string",
749
+ "description": "User phone number",
750
+ "example": "+1234567890"
751
+ },
752
+ "isVerified": {
753
+ "type": "boolean",
754
+ "description": "Email verification status",
755
+ "example": true
756
+ },
757
+ "metadata": {
758
+ "type": "object",
759
+ "description": "Additional user metadata",
760
+ "example": {
761
+ "firstName": "John",
762
+ "lastName": "Doe"
763
+ }
764
+ }
765
+ },
766
+ "required": [
767
+ "id",
768
+ "isVerified"
769
+ ]
770
+ },
771
+ "AuthWithTokensResponseDto": {
772
+ "type": "object",
773
+ "properties": {
774
+ "accessToken": {
775
+ "type": "string",
776
+ "description": "JWT access token (short-lived)",
777
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJpYXQiOjE2OTk5OTk5OTksImV4cCI6MTY5OTk5OTk5OX0.xyz"
778
+ },
779
+ "refreshToken": {
780
+ "type": "string",
781
+ "description": "JWT refresh token (long-lived)",
782
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTY5OTk5OTk5OX0.abc"
783
+ },
784
+ "message": {
785
+ "type": "string",
786
+ "description": "Success message (added by controller based on configuration)",
787
+ "example": "Login successful"
788
+ },
789
+ "isRequiresMfa": {
790
+ "type": "boolean",
791
+ "description": "Whether multi-factor authentication is required",
792
+ "example": false
793
+ },
794
+ "user": {
795
+ "description": "User information",
796
+ "allOf": [
797
+ {
798
+ "$ref": "#/components/schemas/UserResponseDto"
799
+ }
800
+ ]
801
+ }
802
+ },
803
+ "required": [
804
+ "accessToken",
805
+ "refreshToken",
806
+ "isRequiresMfa"
807
+ ]
808
+ },
809
+ "EmailCredentialsDto": {
810
+ "type": "object",
811
+ "properties": {
812
+ "email": {
813
+ "type": "string",
814
+ "description": "User email address",
815
+ "example": "user@example.com"
816
+ },
817
+ "password": {
818
+ "type": "string",
819
+ "description": "User password",
820
+ "example": "SecurePass123!",
821
+ "minLength": 8
822
+ }
823
+ },
824
+ "required": [
825
+ "email",
826
+ "password"
827
+ ]
828
+ },
829
+ "PhoneCredentialsDto": {
830
+ "type": "object",
831
+ "properties": {
832
+ "phone": {
833
+ "type": "string",
834
+ "description": "User phone number",
835
+ "example": "+1234567890"
836
+ },
837
+ "password": {
838
+ "type": "string",
839
+ "description": "User password",
840
+ "example": "SecurePass123!",
841
+ "minLength": 8
842
+ }
843
+ },
844
+ "required": [
845
+ "phone",
846
+ "password"
847
+ ]
848
+ },
849
+ "SocialCredentialsDto": {
850
+ "type": "object",
851
+ "properties": {
852
+ "accessToken": {
853
+ "type": "string",
854
+ "description": "OAuth token or ID token from social provider",
855
+ "example": "ya29.a0AfH6SMBx1234567890abcdefghijklmnop"
856
+ }
857
+ },
858
+ "required": [
859
+ "accessToken"
860
+ ]
861
+ },
862
+ "LoginRequestDto": {
863
+ "type": "object",
864
+ "properties": {
865
+ "providerName": {
866
+ "type": "string",
867
+ "description": "Authentication provider name",
868
+ "example": "email",
869
+ "enum": [
870
+ "email",
871
+ "phone",
872
+ "google",
873
+ "facebook",
874
+ "apple",
875
+ "github"
876
+ ],
877
+ "default": "email"
878
+ },
879
+ "credentials": {
880
+ "description": "Login credentials - type varies by provider",
881
+ "examples": {
882
+ "emailLogin": {
883
+ "summary": "Email Login",
884
+ "value": {
885
+ "email": "user@example.com",
886
+ "password": "SecurePass123!"
887
+ }
888
+ },
889
+ "phoneLogin": {
890
+ "summary": "Phone Login",
891
+ "value": {
892
+ "phone": "+1234567890",
893
+ "password": "SecurePass123!"
894
+ }
895
+ },
896
+ "socialLogin": {
897
+ "summary": "Social Login (Google/Facebook/etc)",
898
+ "value": {
899
+ "token": "ya29.a0AfH6SMBx..."
900
+ }
901
+ }
902
+ },
903
+ "oneOf": [
904
+ {
905
+ "$ref": "#/components/schemas/EmailCredentialsDto"
906
+ },
907
+ {
908
+ "$ref": "#/components/schemas/PhoneCredentialsDto"
909
+ },
910
+ {
911
+ "$ref": "#/components/schemas/SocialCredentialsDto"
912
+ }
913
+ ]
914
+ },
915
+ "tenantId": {
916
+ "type": "string",
917
+ "description": "Tenant ID for multi-tenant applications",
918
+ "example": "123e4567-e89b-12d3-a456-426614174000"
919
+ },
920
+ "createUserIfNotExists": {
921
+ "type": "boolean",
922
+ "description": "Auto-create user if not exists (for social auth)",
923
+ "default": false
924
+ }
925
+ }
926
+ },
927
+ "RefreshTokenRequestDto": {
928
+ "type": "object",
929
+ "properties": {
930
+ "refreshToken": {
931
+ "type": "string",
932
+ "description": "Refresh token to obtain new access token",
933
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCJ9.abc123"
934
+ }
935
+ },
936
+ "required": [
937
+ "refreshToken"
938
+ ]
939
+ },
940
+ "MessageResponseDto": {
941
+ "type": "object",
942
+ "properties": {
943
+ "message": {
944
+ "type": "string",
945
+ "description": "Response message"
946
+ }
947
+ },
948
+ "required": [
949
+ "message"
950
+ ]
951
+ },
952
+ "MFAMethodEnum": {
953
+ "type": "string",
954
+ "enum": [
955
+ "totp",
956
+ "sms",
957
+ "email"
958
+ ]
959
+ },
960
+ "Verify2faRequestDto": {
961
+ "type": "object",
962
+ "properties": {
963
+ "method": {
964
+ "description": "MFA method used",
965
+ "example": "totp",
966
+ "allOf": [
967
+ {
968
+ "$ref": "#/components/schemas/MFAMethodEnum"
969
+ }
970
+ ]
971
+ },
972
+ "otp": {
973
+ "type": "string",
974
+ "description": "One-time password code",
975
+ "example": "123456",
976
+ "minLength": 6,
977
+ "maxLength": 8
978
+ },
979
+ "rememberDevice": {
980
+ "type": "boolean",
981
+ "description": "Whether to trust this device for future logins",
982
+ "example": true
983
+ }
984
+ },
985
+ "required": [
986
+ "method",
987
+ "otp"
988
+ ]
989
+ },
990
+ "Verify2faWithTokensResponseDto": {
991
+ "type": "object",
992
+ "properties": {
993
+ "accessToken": {
994
+ "type": "string",
995
+ "description": "JWT access token (short-lived)",
996
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJpYXQiOjE2OTk5OTk5OTksImV4cCI6MTY5OTk5OTk5OX0.xyz"
997
+ },
998
+ "refreshToken": {
999
+ "type": "string",
1000
+ "description": "JWT refresh token (long-lived)",
1001
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTY5OTk5OTk5OX0.abc"
1002
+ },
1003
+ "message": {
1004
+ "type": "string",
1005
+ "description": "Verification success message (added by controller)",
1006
+ "example": "2FA verification successful"
1007
+ }
1008
+ },
1009
+ "required": [
1010
+ "accessToken",
1011
+ "refreshToken"
1012
+ ]
1013
+ },
1014
+ "ChangePasswordRequestDto": {
1015
+ "type": "object",
1016
+ "properties": {
1017
+ "currentPassword": {
1018
+ "type": "string",
1019
+ "description": "Current password",
1020
+ "example": "DemoOwner1!",
1021
+ "minLength": 8
1022
+ },
1023
+ "newPassword": {
1024
+ "type": "string",
1025
+ "description": "New password",
1026
+ "example": "DemoOwner1!New",
1027
+ "minLength": 8
1028
+ }
1029
+ },
1030
+ "required": [
1031
+ "currentPassword",
1032
+ "newPassword"
1033
+ ]
1034
+ },
1035
+ "ForgotPasswordRequestDto": {
1036
+ "type": "object",
1037
+ "properties": {
1038
+ "email": {
1039
+ "type": "string",
1040
+ "description": "User email address (required if phone not provided)",
1041
+ "example": "user@example.com"
1042
+ },
1043
+ "phone": {
1044
+ "type": "string",
1045
+ "description": "User phone number (required if email not provided)",
1046
+ "example": "+1234567890"
1047
+ },
1048
+ "tenantId": {
1049
+ "type": "string",
1050
+ "description": "Tenant ID for multi-tenant applications",
1051
+ "example": "123e4567-e89b-12d3-a456-426614174000"
1052
+ }
1053
+ }
1054
+ },
1055
+ "VerifyForgotPasswordOtpRequestDto": {
1056
+ "type": "object",
1057
+ "properties": {
1058
+ "email": {
1059
+ "type": "string",
1060
+ "description": "User email address (required if phone not provided)",
1061
+ "example": "user@example.com"
1062
+ },
1063
+ "phone": {
1064
+ "type": "string",
1065
+ "description": "User phone number (required if email not provided)",
1066
+ "example": "+1234567890"
1067
+ },
1068
+ "otp": {
1069
+ "type": "string",
1070
+ "description": "One-time password code received via email or SMS",
1071
+ "example": "123456",
1072
+ "minLength": 6,
1073
+ "maxLength": 8
1074
+ },
1075
+ "tenantId": {
1076
+ "type": "string",
1077
+ "description": "Tenant ID for multi-tenant applications",
1078
+ "example": "123e4567-e89b-12d3-a456-426614174000"
1079
+ }
1080
+ },
1081
+ "required": [
1082
+ "otp"
1083
+ ]
1084
+ },
1085
+ "VerifyOtpResponseDto": {
1086
+ "type": "object",
1087
+ "properties": {
1088
+ "message": {
1089
+ "type": "string",
1090
+ "description": "Success message"
1091
+ },
1092
+ "resetToken": {
1093
+ "type": "string",
1094
+ "description": "Password reset token - use this to reset password"
1095
+ }
1096
+ },
1097
+ "required": [
1098
+ "message"
1099
+ ]
1100
+ },
1101
+ "ResetPasswordRequestDto": {
1102
+ "type": "object",
1103
+ "properties": {
1104
+ "email": {
1105
+ "type": "string",
1106
+ "description": "User email address (required if phone not provided)",
1107
+ "example": "user@example.com"
1108
+ },
1109
+ "phone": {
1110
+ "type": "string",
1111
+ "description": "User phone number (required if email not provided)",
1112
+ "example": "+1234567890"
1113
+ },
1114
+ "otp": {
1115
+ "type": "string",
1116
+ "description": "One-time password (OTP) received via email or SMS",
1117
+ "example": "123456",
1118
+ "minLength": 6,
1119
+ "maxLength": 8
1120
+ },
1121
+ "newPassword": {
1122
+ "type": "string",
1123
+ "description": "New password",
1124
+ "example": "NewSecurePass123!",
1125
+ "minLength": 8
1126
+ },
1127
+ "tenantId": {
1128
+ "type": "string",
1129
+ "description": "Tenant ID for multi-tenant applications",
1130
+ "example": "123e4567-e89b-12d3-a456-426614174000"
1131
+ }
1132
+ },
1133
+ "required": [
1134
+ "otp",
1135
+ "newPassword"
1136
+ ]
1137
+ },
1138
+ "ResetPasswordWithTokenRequestDto": {
1139
+ "type": "object",
1140
+ "properties": {
1141
+ "token": {
1142
+ "type": "string",
1143
+ "description": "Password reset token (JWT) received after OTP verification",
1144
+ "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoicGFzc3dvcmQtcmVzZXQifQ.xyz"
1145
+ },
1146
+ "newPassword": {
1147
+ "type": "string",
1148
+ "description": "New password",
1149
+ "example": "NewSecurePass123!",
1150
+ "minLength": 8
1151
+ }
1152
+ },
1153
+ "required": [
1154
+ "token",
1155
+ "newPassword"
1156
+ ]
1157
+ },
1158
+ "SendEmailVerificationRequestDto": {
1159
+ "type": "object",
1160
+ "properties": {
1161
+ "tenantId": {
1162
+ "type": "string",
1163
+ "description": "Tenant ID for multi-tenant applications",
1164
+ "example": "123e4567-e89b-12d3-a456-426614174000"
1165
+ }
1166
+ }
1167
+ },
1168
+ "VerifyEmailRequestDto": {
1169
+ "type": "object",
1170
+ "properties": {
1171
+ "otp": {
1172
+ "type": "string",
1173
+ "description": "One-time password code received via email",
1174
+ "example": "123456",
1175
+ "minLength": 6,
1176
+ "maxLength": 8
1177
+ },
1178
+ "tenantId": {
1179
+ "type": "string",
1180
+ "description": "Tenant ID for multi-tenant applications",
1181
+ "example": "123e4567-e89b-12d3-a456-426614174000"
1182
+ }
1183
+ },
1184
+ "required": [
1185
+ "otp"
1186
+ ]
1187
+ },
1188
+ "EmailAuthConfigDto": {
1189
+ "type": "object",
1190
+ "properties": {
1191
+ "enabled": {
1192
+ "type": "boolean",
1193
+ "example": true
1194
+ }
1195
+ },
1196
+ "required": [
1197
+ "enabled"
1198
+ ]
1199
+ },
1200
+ "PhoneAuthConfigDto": {
1201
+ "type": "object",
1202
+ "properties": {
1203
+ "enabled": {
1204
+ "type": "boolean",
1205
+ "example": false
1206
+ }
1207
+ },
1208
+ "required": [
1209
+ "enabled"
1210
+ ]
1211
+ },
1212
+ "RegistrationConfigDto": {
1213
+ "type": "object",
1214
+ "properties": {
1215
+ "enabled": {
1216
+ "type": "boolean",
1217
+ "example": true,
1218
+ "description": "Whether user registration is enabled"
1219
+ },
1220
+ "requireInvitation": {
1221
+ "type": "boolean",
1222
+ "example": false,
1223
+ "description": "Whether registration requires an invitation"
1224
+ },
1225
+ "collectProfileFields": {
1226
+ "type": "array",
1227
+ "description": "Additional profile fields to collect during registration",
1228
+ "items": {
1229
+ "type": "object",
1230
+ "properties": {
1231
+ "id": {
1232
+ "type": "string"
1233
+ },
1234
+ "label": {
1235
+ "type": "string"
1236
+ },
1237
+ "required": {
1238
+ "type": "boolean"
1239
+ },
1240
+ "type": {
1241
+ "type": "string",
1242
+ "enum": [
1243
+ "text",
1244
+ "email",
1245
+ "phone",
1246
+ "select",
1247
+ "checkbox",
1248
+ "password"
1249
+ ]
1250
+ },
1251
+ "placeholder": {
1252
+ "type": "string"
1253
+ },
1254
+ "options": {
1255
+ "type": "array",
1256
+ "items": {
1257
+ "type": "object",
1258
+ "properties": {
1259
+ "label": {
1260
+ "type": "string"
1261
+ },
1262
+ "value": {
1263
+ "type": "string"
1264
+ }
1265
+ }
1266
+ }
1267
+ }
1268
+ }
1269
+ }
1270
+ }
1271
+ },
1272
+ "required": [
1273
+ "enabled"
1274
+ ]
1275
+ },
1276
+ "MfaConfigDto": {
1277
+ "type": "object",
1278
+ "properties": {
1279
+ "enabled": {
1280
+ "type": "boolean",
1281
+ "example": true
1282
+ },
1283
+ "methods": {
1284
+ "example": [
1285
+ "email",
1286
+ "totp"
1287
+ ],
1288
+ "type": "array",
1289
+ "items": {
1290
+ "type": "array"
1291
+ }
1292
+ },
1293
+ "allowUserToggle": {
1294
+ "type": "boolean",
1295
+ "example": true
1296
+ },
1297
+ "allowMethodSelection": {
1298
+ "type": "boolean",
1299
+ "example": true
1300
+ }
1301
+ },
1302
+ "required": [
1303
+ "enabled"
1304
+ ]
1305
+ },
1306
+ "TenantOptionDto": {
1307
+ "type": "object",
1308
+ "properties": {
1309
+ "id": {
1310
+ "type": "string"
1311
+ },
1312
+ "name": {
1313
+ "type": "string"
1314
+ },
1315
+ "slug": {
1316
+ "type": "string"
1317
+ },
1318
+ "isActive": {
1319
+ "type": "boolean"
1320
+ },
1321
+ "metadata": {
1322
+ "type": "object"
1323
+ }
1324
+ },
1325
+ "required": [
1326
+ "id",
1327
+ "name",
1328
+ "slug",
1329
+ "isActive"
1330
+ ]
1331
+ },
1332
+ "TenantsConfigDto": {
1333
+ "type": "object",
1334
+ "properties": {
1335
+ "mode": {
1336
+ "type": "string",
1337
+ "example": "single",
1338
+ "enum": [
1339
+ "single",
1340
+ "multi"
1341
+ ]
1342
+ },
1343
+ "defaultTenantId": {
1344
+ "type": "string",
1345
+ "nullable": true
1346
+ },
1347
+ "options": {
1348
+ "type": "array",
1349
+ "items": {
1350
+ "$ref": "#/components/schemas/TenantOptionDto"
1351
+ }
1352
+ }
1353
+ },
1354
+ "required": [
1355
+ "mode"
1356
+ ]
1357
+ },
1358
+ "SsoProviderConfigDto": {
1359
+ "type": "object",
1360
+ "properties": {
1361
+ "id": {
1362
+ "type": "string"
1363
+ },
1364
+ "name": {
1365
+ "type": "string"
1366
+ },
1367
+ "logoUrl": {
1368
+ "type": "string"
1369
+ },
1370
+ "authorizationUrl": {
1371
+ "type": "string"
1372
+ },
1373
+ "clientId": {
1374
+ "type": "string"
1375
+ },
1376
+ "hint": {
1377
+ "type": "string"
1378
+ }
1379
+ },
1380
+ "required": [
1381
+ "id",
1382
+ "name"
1383
+ ]
1384
+ },
1385
+ "SsoConfigDto": {
1386
+ "type": "object",
1387
+ "properties": {
1388
+ "enabled": {
1389
+ "type": "boolean",
1390
+ "example": false
1391
+ },
1392
+ "providers": {
1393
+ "type": "array",
1394
+ "items": {
1395
+ "$ref": "#/components/schemas/SsoProviderConfigDto"
1396
+ }
1397
+ }
1398
+ },
1399
+ "required": [
1400
+ "enabled"
1401
+ ]
1402
+ },
1403
+ "UiConfigDto": {
1404
+ "type": "object",
1405
+ "properties": {
1406
+ "brandName": {
1407
+ "type": "string"
1408
+ },
1409
+ "brandColor": {
1410
+ "type": "string"
1411
+ },
1412
+ "logoUrl": {
1413
+ "type": "string"
1414
+ },
1415
+ "backgroundImageUrl": {
1416
+ "type": "string"
1417
+ }
1418
+ }
1419
+ },
1420
+ "ClientConfigResponseDto": {
1421
+ "type": "object",
1422
+ "properties": {
1423
+ "emailAuth": {
1424
+ "$ref": "#/components/schemas/EmailAuthConfigDto"
1425
+ },
1426
+ "phoneAuth": {
1427
+ "$ref": "#/components/schemas/PhoneAuthConfigDto"
1428
+ },
1429
+ "registration": {
1430
+ "$ref": "#/components/schemas/RegistrationConfigDto"
1431
+ },
1432
+ "mfa": {
1433
+ "$ref": "#/components/schemas/MfaConfigDto"
1434
+ },
1435
+ "tenants": {
1436
+ "$ref": "#/components/schemas/TenantsConfigDto"
1437
+ },
1438
+ "sso": {
1439
+ "$ref": "#/components/schemas/SsoConfigDto"
1440
+ },
1441
+ "ui": {
1442
+ "$ref": "#/components/schemas/UiConfigDto"
1443
+ }
1444
+ },
1445
+ "required": [
1446
+ "emailAuth",
1447
+ "phoneAuth",
1448
+ "registration",
1449
+ "mfa",
1450
+ "tenants",
1451
+ "sso"
1452
+ ]
1453
+ },
1454
+ "MfaDeviceDto": {
1455
+ "type": "object",
1456
+ "properties": {
1457
+ "id": {
1458
+ "type": "string",
1459
+ "description": "Unique identifier of the MFA device",
1460
+ "example": "4b3c9c9c-9a9d-4d1e-8d9f-123456789abc"
1461
+ },
1462
+ "deviceName": {
1463
+ "type": "string",
1464
+ "description": "Friendly name of the registered device",
1465
+ "example": "Work laptop"
1466
+ },
1467
+ "method": {
1468
+ "type": "string",
1469
+ "description": "MFA method this device supports",
1470
+ "enum": [
1471
+ "totp",
1472
+ "sms",
1473
+ "email"
1474
+ ],
1475
+ "example": "totp"
1476
+ },
1477
+ "lastUsedAt": {
1478
+ "format": "date-time",
1479
+ "type": "string",
1480
+ "description": "Timestamp of when the device was last used",
1481
+ "example": "2024-05-20T12:34:56.000Z"
1482
+ },
1483
+ "verified": {
1484
+ "type": "boolean",
1485
+ "description": "Whether the device setup has been verified",
1486
+ "example": true
1487
+ },
1488
+ "createdAt": {
1489
+ "format": "date-time",
1490
+ "type": "string",
1491
+ "description": "Timestamp of when the device was registered",
1492
+ "example": "2024-05-18T10:15:00.000Z"
1493
+ }
1494
+ },
1495
+ "required": [
1496
+ "id",
1497
+ "deviceName",
1498
+ "method",
1499
+ "verified"
1500
+ ]
1501
+ },
1502
+ "MfaStatusResponseDto": {
1503
+ "type": "object",
1504
+ "properties": {
1505
+ "isEnabled": {
1506
+ "type": "boolean",
1507
+ "description": "Whether MFA is currently enabled for the user",
1508
+ "example": true
1509
+ },
1510
+ "verifiedMethods": {
1511
+ "type": "array",
1512
+ "description": "MFA methods the user has verified and can currently use (includes EMAIL/SMS if configured, and TOTP if user has verified device)",
1513
+ "example": [
1514
+ "email",
1515
+ "totp"
1516
+ ],
1517
+ "items": {
1518
+ "type": "string",
1519
+ "enum": [
1520
+ "totp",
1521
+ "sms",
1522
+ "email"
1523
+ ]
1524
+ }
1525
+ },
1526
+ "configuredMethods": {
1527
+ "type": "array",
1528
+ "description": "All MFA methods configured and available in the application (methods user can potentially set up)",
1529
+ "example": [
1530
+ "email",
1531
+ "totp",
1532
+ "sms"
1533
+ ],
1534
+ "items": {
1535
+ "type": "string",
1536
+ "enum": [
1537
+ "totp",
1538
+ "sms",
1539
+ "email"
1540
+ ]
1541
+ }
1542
+ },
1543
+ "allowUserToggle": {
1544
+ "type": "boolean",
1545
+ "description": "Indicates if MFA toggling is allowed for the user",
1546
+ "example": true
1547
+ },
1548
+ "allowMethodSelection": {
1549
+ "type": "boolean",
1550
+ "description": "Indicates if users can choose their preferred MFA method",
1551
+ "example": true
1552
+ },
1553
+ "totpDevices": {
1554
+ "description": "Registered TOTP devices for the user",
1555
+ "type": "array",
1556
+ "items": {
1557
+ "$ref": "#/components/schemas/MfaDeviceDto"
1558
+ }
1559
+ },
1560
+ "hasRecoveryCode": {
1561
+ "type": "boolean",
1562
+ "description": "Whether a recovery code has been generated for the user",
1563
+ "example": false
1564
+ }
1565
+ },
1566
+ "required": [
1567
+ "isEnabled",
1568
+ "verifiedMethods",
1569
+ "configuredMethods",
1570
+ "allowUserToggle",
1571
+ "allowMethodSelection",
1572
+ "totpDevices",
1573
+ "hasRecoveryCode"
1574
+ ]
1575
+ },
1576
+ "ToggleMfaRequestDto": {
1577
+ "type": "object",
1578
+ "properties": {
1579
+ "enabled": {
1580
+ "type": "boolean",
1581
+ "description": "Whether MFA should be enabled for the current user",
1582
+ "example": true
1583
+ }
1584
+ },
1585
+ "required": [
1586
+ "enabled"
1587
+ ]
1588
+ },
1589
+ "SendMfaCodeRequestDto": {
1590
+ "type": "object",
1591
+ "properties": {
1592
+ "method": {
1593
+ "description": "MFA delivery method",
1594
+ "example": "email",
1595
+ "examples": {
1596
+ "email": {
1597
+ "value": "email",
1598
+ "description": "Send OTP via email"
1599
+ },
1600
+ "sms": {
1601
+ "value": "sms",
1602
+ "description": "Send OTP via SMS"
1603
+ },
1604
+ "totp": {
1605
+ "value": "totp",
1606
+ "description": "Use authenticator app (TOTP)"
1607
+ }
1608
+ },
1609
+ "allOf": [
1610
+ {
1611
+ "$ref": "#/components/schemas/MFAMethodEnum"
1612
+ }
1613
+ ]
1614
+ }
1615
+ },
1616
+ "required": [
1617
+ "method"
1618
+ ]
1619
+ },
1620
+ "VerifyTotpSetupRequestDto": {
1621
+ "type": "object",
1622
+ "properties": {
1623
+ "otp": {
1624
+ "type": "string",
1625
+ "description": "The TOTP code from authenticator app",
1626
+ "example": "123456",
1627
+ "minLength": 6,
1628
+ "maxLength": 6
1629
+ },
1630
+ "secret": {
1631
+ "type": "string",
1632
+ "description": "Secret key from TOTP setup",
1633
+ "example": "JBSWY3DPEHPK3PXP"
1634
+ }
1635
+ },
1636
+ "required": [
1637
+ "otp",
1638
+ "secret"
1639
+ ]
1640
+ }
1641
+ }
1642
+ }
1643
+ }