/
auth_actions.gen.go
1864 lines (1465 loc) · 42.7 KB
/
auth_actions.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package service
// This file is auto-generated.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// Definitions file that controls how this file is generated:
// system/service/auth_actions.yaml
import (
"context"
"fmt"
"github.com/cortezaproject/corteza-server/pkg/actionlog"
"github.com/cortezaproject/corteza-server/pkg/errors"
"github.com/cortezaproject/corteza-server/pkg/locale"
"github.com/cortezaproject/corteza-server/system/types"
"strings"
"time"
)
type (
authActionProps struct {
email string
provider string
credentials *types.Credentials
role *types.Role
user *types.User
}
authAction struct {
timestamp time.Time
resource string
action string
log string
severity actionlog.Severity
// prefix for error when action fails
errorMessage string
props *authActionProps
}
authLogMetaKey struct{}
authPropsMetaKey struct{}
)
var (
// just a placeholder to cover template cases w/o fmt package use
_ = fmt.Println
)
// *********************************************************************************************************************
// *********************************************************************************************************************
// Props methods
// setEmail updates authActionProps's email
//
// Allows method chaining
//
// This function is auto-generated.
//
func (p *authActionProps) setEmail(email string) *authActionProps {
p.email = email
return p
}
// setProvider updates authActionProps's provider
//
// Allows method chaining
//
// This function is auto-generated.
//
func (p *authActionProps) setProvider(provider string) *authActionProps {
p.provider = provider
return p
}
// setCredentials updates authActionProps's credentials
//
// Allows method chaining
//
// This function is auto-generated.
//
func (p *authActionProps) setCredentials(credentials *types.Credentials) *authActionProps {
p.credentials = credentials
return p
}
// setRole updates authActionProps's role
//
// Allows method chaining
//
// This function is auto-generated.
//
func (p *authActionProps) setRole(role *types.Role) *authActionProps {
p.role = role
return p
}
// setUser updates authActionProps's user
//
// Allows method chaining
//
// This function is auto-generated.
//
func (p *authActionProps) setUser(user *types.User) *authActionProps {
p.user = user
return p
}
// Serialize converts authActionProps to actionlog.Meta
//
// This function is auto-generated.
//
func (p authActionProps) Serialize() actionlog.Meta {
var (
m = make(actionlog.Meta)
)
m.Set("email", p.email, true)
m.Set("provider", p.provider, true)
if p.credentials != nil {
m.Set("credentials.kind", p.credentials.Kind, true)
m.Set("credentials.label", p.credentials.Label, true)
m.Set("credentials.ID", p.credentials.ID, true)
}
if p.role != nil {
m.Set("role.handle", p.role.Handle, true)
m.Set("role.name", p.role.Name, true)
m.Set("role.ID", p.role.ID, true)
}
if p.user != nil {
m.Set("user.handle", p.user.Handle, true)
m.Set("user.name", p.user.Name, true)
m.Set("user.ID", p.user.ID, true)
m.Set("user.email", p.user.Email, true)
m.Set("user.suspendedAt", p.user.SuspendedAt, true)
m.Set("user.deletedAt", p.user.DeletedAt, true)
}
return m
}
// tr translates string and replaces meta value placeholder with values
//
// This function is auto-generated.
//
func (p authActionProps) Format(in string, err error) string {
var (
pairs = []string{"{{err}}"}
// first non-empty string
fns = func(ii ...interface{}) string {
for _, i := range ii {
if s := fmt.Sprintf("%v", i); len(s) > 0 {
return s
}
}
return ""
}
)
if err != nil {
pairs = append(pairs, err.Error())
} else {
pairs = append(pairs, "nil")
}
pairs = append(pairs, "{{email}}", fns(p.email))
pairs = append(pairs, "{{provider}}", fns(p.provider))
if p.credentials != nil {
// replacement for "{{credentials}}" (in order how fields are defined)
pairs = append(
pairs,
"{{credentials}}",
fns(
p.credentials.Kind,
p.credentials.Label,
p.credentials.ID,
),
)
pairs = append(pairs, "{{credentials.kind}}", fns(p.credentials.Kind))
pairs = append(pairs, "{{credentials.label}}", fns(p.credentials.Label))
pairs = append(pairs, "{{credentials.ID}}", fns(p.credentials.ID))
}
if p.role != nil {
// replacement for "{{role}}" (in order how fields are defined)
pairs = append(
pairs,
"{{role}}",
fns(
p.role.Handle,
p.role.Name,
p.role.ID,
),
)
pairs = append(pairs, "{{role.handle}}", fns(p.role.Handle))
pairs = append(pairs, "{{role.name}}", fns(p.role.Name))
pairs = append(pairs, "{{role.ID}}", fns(p.role.ID))
}
if p.user != nil {
// replacement for "{{user}}" (in order how fields are defined)
pairs = append(
pairs,
"{{user}}",
fns(
p.user.Handle,
p.user.Name,
p.user.ID,
p.user.Email,
p.user.SuspendedAt,
p.user.DeletedAt,
),
)
pairs = append(pairs, "{{user.handle}}", fns(p.user.Handle))
pairs = append(pairs, "{{user.name}}", fns(p.user.Name))
pairs = append(pairs, "{{user.ID}}", fns(p.user.ID))
pairs = append(pairs, "{{user.email}}", fns(p.user.Email))
pairs = append(pairs, "{{user.suspendedAt}}", fns(p.user.SuspendedAt))
pairs = append(pairs, "{{user.deletedAt}}", fns(p.user.DeletedAt))
}
return strings.NewReplacer(pairs...).Replace(in)
}
// *********************************************************************************************************************
// *********************************************************************************************************************
// Action methods
// String returns loggable description as string
//
// This function is auto-generated.
//
func (a *authAction) String() string {
var props = &authActionProps{}
if a.props != nil {
props = a.props
}
return props.Format(a.log, nil)
}
func (e *authAction) ToAction() *actionlog.Action {
return &actionlog.Action{
Resource: e.resource,
Action: e.action,
Severity: e.severity,
Description: e.String(),
Meta: e.props.Serialize(),
}
}
// *********************************************************************************************************************
// *********************************************************************************************************************
// Action constructors
// AuthActionAuthenticate returns "system:auth.authenticate" action
//
// This function is auto-generated.
//
func AuthActionAuthenticate(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "authenticate",
log: "successfully authenticated with {{credentials.kind}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionIssueToken returns "system:auth.issueToken" action
//
// This function is auto-generated.
//
func AuthActionIssueToken(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "issueToken",
log: "token '{{credentials.kind}}' issued",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionValidateToken returns "system:auth.validateToken" action
//
// This function is auto-generated.
//
func AuthActionValidateToken(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "validateToken",
log: "token '{{credentials.kind}}' validated",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionChangePassword returns "system:auth.changePassword" action
//
// This function is auto-generated.
//
func AuthActionChangePassword(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "changePassword",
log: "password changed",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionInternalSignup returns "system:auth.internalSignup" action
//
// This function is auto-generated.
//
func AuthActionInternalSignup(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "internalSignup",
log: "{{user.email}} signed-up",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionConfirmEmail returns "system:auth.confirmEmail" action
//
// This function is auto-generated.
//
func AuthActionConfirmEmail(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "confirmEmail",
log: "email {{user.email}} confirmed",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionExternalSignup returns "system:auth.externalSignup" action
//
// This function is auto-generated.
//
func AuthActionExternalSignup(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "externalSignup",
log: "{{user.email}} signed-up after successful external authentication via {{credentials.kind}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionSendEmailConfirmationToken returns "system:auth.sendEmailConfirmationToken" action
//
// This function is auto-generated.
//
func AuthActionSendEmailConfirmationToken(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "sendEmailConfirmationToken",
log: "confirmation notification sent to {{email}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionSendPasswordResetToken returns "system:auth.sendPasswordResetToken" action
//
// This function is auto-generated.
//
func AuthActionSendPasswordResetToken(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "sendPasswordResetToken",
log: "password reset token sent to {{email}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionExchangePasswordResetToken returns "system:auth.exchangePasswordResetToken" action
//
// This function is auto-generated.
//
func AuthActionExchangePasswordResetToken(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "exchangePasswordResetToken",
log: "password reset token exchanged",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionGeneratePasswordCreateToken returns "system:auth.generatePasswordCreateToken" action
//
// This function is auto-generated.
//
func AuthActionGeneratePasswordCreateToken(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "generatePasswordCreateToken",
log: "password create token generated for {{email}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionAutoPromote returns "system:auth.autoPromote" action
//
// This function is auto-generated.
//
func AuthActionAutoPromote(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "autoPromote",
log: "auto-promoted to {{role}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionUpdateCredentials returns "system:auth.updateCredentials" action
//
// This function is auto-generated.
//
func AuthActionUpdateCredentials(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "updateCredentials",
log: "credentials {{credentials.kind}} updated",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionCreateCredentials returns "system:auth.createCredentials" action
//
// This function is auto-generated.
//
func AuthActionCreateCredentials(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "createCredentials",
log: "new credentials {{credentials.kind}} created",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionImpersonate returns "system:auth.impersonate" action
//
// This function is auto-generated.
//
func AuthActionImpersonate(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "impersonate",
log: "impersonating {{user}}",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionTotpConfigure returns "system:auth.totpConfigure" action
//
// This function is auto-generated.
//
func AuthActionTotpConfigure(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "totpConfigure",
log: "time-based one-time-password for {{user}} configured",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionTotpRemove returns "system:auth.totpRemove" action
//
// This function is auto-generated.
//
func AuthActionTotpRemove(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "totpRemove",
log: "time-based one-time-password for {{user}} removed",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionTotpValidate returns "system:auth.totpValidate" action
//
// This function is auto-generated.
//
func AuthActionTotpValidate(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "totpValidate",
log: "time-based one-time-password for {{user}} validated",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionEmailOtpVerify returns "system:auth.emailOtpVerify" action
//
// This function is auto-generated.
//
func AuthActionEmailOtpVerify(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "emailOtpVerify",
log: "email one-time-password for {{user}} verified",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// AuthActionAccessTokensRemoved returns "system:auth.accessTokensRemoved" action
//
// This function is auto-generated.
//
func AuthActionAccessTokensRemoved(props ...*authActionProps) *authAction {
a := &authAction{
timestamp: time.Now(),
resource: "system:auth",
action: "accessTokensRemoved",
log: "access tokens for {{user}} removed",
severity: actionlog.Notice,
}
if len(props) > 0 {
a.props = props[0]
}
return a
}
// *********************************************************************************************************************
// *********************************************************************************************************************
// Error constructors
// AuthErrGeneric returns "system:auth.generic" as *errors.Error
//
//
// This function is auto-generated.
//
func AuthErrGeneric(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
p.Format("failed to complete request due to internal error", nil),
errors.Meta("type", "generic"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "{err}"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.generic"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
return e
}
// AuthErrInvalidCredentials returns "system:auth.invalidCredentials" as *errors.Error
//
//
// This function is auto-generated.
//
func AuthErrInvalidCredentials(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
p.Format("invalid username and password combination", nil),
errors.Meta("type", "invalidCredentials"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "{{email}} failed to authenticate with {{credentials.kind}}"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.invalidCredentials"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
return e
}
// AuthErrInvalidEmailFormat returns "system:auth.invalidEmailFormat" as *errors.Error
//
//
// This function is auto-generated.
//
func AuthErrInvalidEmailFormat(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
p.Format("invalid email", nil),
errors.Meta("type", "invalidEmailFormat"),
errors.Meta("resource", "system:auth"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.invalidEmailFormat"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
return e
}
// AuthErrInvalidHandle returns "system:auth.invalidHandle" as *errors.Error
//
//
// This function is auto-generated.
//
func AuthErrInvalidHandle(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
p.Format("invalid handle", nil),
errors.Meta("type", "invalidHandle"),
errors.Meta("resource", "system:auth"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.invalidHandle"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
return e
}
// AuthErrFailedForUnknownUser returns "system:auth.failedForUnknownUser" as *errors.Error
//
// Note: This error will be wrapped with safe (system:auth.invalidCredentials) error!
//
// This function is auto-generated.
//
func AuthErrFailedForUnknownUser(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
"failedForUnknownUser",
errors.Meta("type", "failedForUnknownUser"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "unknown user {{email}} tried to log-in with {{credentials.kind}}"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.failedForUnknownUser"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
// Wrap with safe error
e = AuthErrInvalidCredentials().Wrap(e)
return e
}
// AuthErrFailedForDeletedUser returns "system:auth.failedForDeletedUser" as *errors.Error
//
// Note: This error will be wrapped with safe (system:auth.invalidCredentials) error!
//
// This function is auto-generated.
//
func AuthErrFailedForDeletedUser(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
"failedForDeletedUser",
errors.Meta("type", "failedForDeletedUser"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "deleted user {{user}} tried to log-in with {{credentials.kind}}"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.failedForDeletedUser"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
// Wrap with safe error
e = AuthErrInvalidCredentials().Wrap(e)
return e
}
// AuthErrFailedForSuspendedUser returns "system:auth.failedForSuspendedUser" as *errors.Error
//
// Note: This error will be wrapped with safe (system:auth.invalidCredentials) error!
//
// This function is auto-generated.
//
func AuthErrFailedForSuspendedUser(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
"failedForSuspendedUser",
errors.Meta("type", "failedForSuspendedUser"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "suspended user {{user}} tried to log-in with {{credentials.kind}}"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.failedForSuspendedUser"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
// Wrap with safe error
e = AuthErrInvalidCredentials().Wrap(e)
return e
}
// AuthErrFailedForSystemUser returns "system:auth.failedForSystemUser" as *errors.Error
//
// Note: This error will be wrapped with safe (system:auth.invalidCredentials) error!
//
// This function is auto-generated.
//
func AuthErrFailedForSystemUser(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
"failedForSystemUser",
errors.Meta("type", "failedForSystemUser"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "system user {{user}} tried to log-in with {{credentials.kind}}"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.failedForSystemUser"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
// Wrap with safe error
e = AuthErrInvalidCredentials().Wrap(e)
return e
}
// AuthErrFailedUnconfirmedEmail returns "system:auth.failedUnconfirmedEmail" as *errors.Error
//
//
// This function is auto-generated.
//
func AuthErrFailedUnconfirmedEmail(mm ...*authActionProps) *errors.Error {
var p = &authActionProps{}
if len(mm) > 0 {
p = mm[0]
}
var e = errors.New(
errors.KindInternal,
p.Format("system requires confirmed email before logging in", nil),
errors.Meta("type", "failedUnconfirmedEmail"),
errors.Meta("resource", "system:auth"),
// action log entry; no formatting, it will be applied inside recordAction fn.
errors.Meta(authLogMetaKey{}, "failed to log-in with with unconfirmed email"),
errors.Meta(authPropsMetaKey{}, p),
// translation namespace & key
errors.Meta(locale.ErrorMetaNamespace{}, "system"),
errors.Meta(locale.ErrorMetaKey{}, "auth.errors.failedUnconfirmedEmail"),
errors.StackSkip(1),
)
if len(mm) > 0 {
}
return e
}
// AuthErrInternalLoginDisabledByConfig returns "system:auth.internalLoginDisabledByConfig" as *errors.Error
//