-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathDomain.go
3852 lines (3528 loc) · 169 KB
/
Domain.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
/*
* Copyright (c) 2019, FusionAuth, All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package fusionauth
import(
"fmt"
"strings"
)
type StatusAble interface {
SetStatus(status int)
}
/**
* Base Response which contains the HTTP status code
*
* @author Matthew Altman
*/
type BaseHTTPResponse struct {
StatusCode int `json:"statusCode,omitempty"`
}
func (b *BaseHTTPResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* @author Daniel DeGroff
*/
type AccessToken struct {
BaseHTTPResponse
AccessToken string `json:"access_token,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"`
IdToken string `json:"id_token,omitempty"`
RefreshToken string `json:"refresh_token,omitempty"`
Scope string `json:"scope,omitempty"`
TokenType TokenType `json:"token_type,omitempty"`
UserId string `json:"userId,omitempty"`
}
func (b *AccessToken) SetStatus(status int) {
b.StatusCode = status
}
type ActionData struct {
ActioneeUserId string `json:"actioneeUserId,omitempty"`
ActionerUserId string `json:"actionerUserId,omitempty"`
ApplicationIds []string `json:"applicationIds,omitempty"`
Comment string `json:"comment,omitempty"`
EmailUser bool `json:"emailUser"`
Expiry int64 `json:"expiry,omitempty"`
NotifyUser bool `json:"notifyUser"`
Option string `json:"option,omitempty"`
ReasonId string `json:"reasonId,omitempty"`
UserActionId string `json:"userActionId,omitempty"`
}
/**
* The user action request object.
*
* @author Brian Pontarelli
*/
type ActionRequest struct {
Action ActionData `json:"action,omitempty"`
Broadcast bool `json:"broadcast"`
}
/**
* The user action response object.
*
* @author Brian Pontarelli
*/
type ActionResponse struct {
BaseHTTPResponse
Action UserActionLog `json:"action,omitempty"`
Actions []UserActionLog `json:"actions,omitempty"`
}
func (b *ActionResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* Available JSON Web Algorithms (JWA) as described in RFC 7518 available for this JWT implementation.
*
* @author Daniel DeGroff
*/
type Algorithm string
const (
Algorithm_ES256 Algorithm = "ES256"
Algorithm_ES384 Algorithm = "ES384"
Algorithm_ES512 Algorithm = "ES512"
Algorithm_HS256 Algorithm = "HS256"
Algorithm_HS384 Algorithm = "HS384"
Algorithm_HS512 Algorithm = "HS512"
Algorithm_RS256 Algorithm = "RS256"
Algorithm_RS384 Algorithm = "RS384"
Algorithm_RS512 Algorithm = "RS512"
Algorithm_None Algorithm = "none"
)
/**
* @author Daniel DeGroff
*/
type AppleApplicationConfiguration struct {
BaseIdentityProviderApplicationConfiguration
ButtonText string `json:"buttonText,omitempty"`
KeyId string `json:"keyId,omitempty"`
Scope string `json:"scope,omitempty"`
ServicesId string `json:"servicesId,omitempty"`
TeamId string `json:"teamId,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type AppleIdentityProvider struct {
BaseIdentityProvider
ButtonText string `json:"buttonText,omitempty"`
KeyId string `json:"keyId,omitempty"`
Scope string `json:"scope,omitempty"`
ServicesId string `json:"servicesId,omitempty"`
TeamId string `json:"teamId,omitempty"`
}
/**
* @author Seth Musselman
*/
type Application struct {
Active bool `json:"active"`
AuthenticationTokenConfiguration AuthenticationTokenConfiguration `json:"authenticationTokenConfiguration,omitempty"`
CleanSpeakConfiguration CleanSpeakConfiguration `json:"cleanSpeakConfiguration,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
EmailConfiguration ApplicationEmailConfiguration `json:"emailConfiguration,omitempty"`
FormConfiguration ApplicationFormConfiguration `json:"formConfiguration,omitempty"`
Id string `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
JwtConfiguration JWTConfiguration `json:"jwtConfiguration,omitempty"`
LambdaConfiguration LambdaConfiguration `json:"lambdaConfiguration,omitempty"`
LastUpdateInstant int64 `json:"lastUpdateInstant,omitempty"`
LoginConfiguration LoginConfiguration `json:"loginConfiguration,omitempty"`
Name string `json:"name,omitempty"`
OauthConfiguration OAuth2Configuration `json:"oauthConfiguration,omitempty"`
PasswordlessConfiguration PasswordlessConfiguration `json:"passwordlessConfiguration,omitempty"`
RegistrationConfiguration RegistrationConfiguration `json:"registrationConfiguration,omitempty"`
RegistrationDeletePolicy ApplicationRegistrationDeletePolicy `json:"registrationDeletePolicy,omitempty"`
Roles []ApplicationRole `json:"roles,omitempty"`
Samlv2Configuration SAMLv2Configuration `json:"samlv2Configuration,omitempty"`
State ObjectState `json:"state,omitempty"`
TenantId string `json:"tenantId,omitempty"`
VerificationEmailTemplateId string `json:"verificationEmailTemplateId,omitempty"`
VerifyRegistration bool `json:"verifyRegistration"`
}
type ApplicationEmailConfiguration struct {
EmailVerificationEmailTemplateId string `json:"emailVerificationEmailTemplateId,omitempty"`
ForgotPasswordEmailTemplateId string `json:"forgotPasswordEmailTemplateId,omitempty"`
PasswordlessEmailTemplateId string `json:"passwordlessEmailTemplateId,omitempty"`
SetPasswordEmailTemplateId string `json:"setPasswordEmailTemplateId,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type ApplicationFormConfiguration struct {
AdminRegistrationFormId string `json:"adminRegistrationFormId,omitempty"`
}
/**
* A Application-level policy for deleting Users.
*
* @author Trevor Smith
*/
type ApplicationRegistrationDeletePolicy struct {
Unverified TimeBasedDeletePolicy `json:"unverified,omitempty"`
}
/**
* The Application API request object.
*
* @author Brian Pontarelli
*/
type ApplicationRequest struct {
Application Application `json:"application,omitempty"`
Role ApplicationRole `json:"role,omitempty"`
WebhookIds []string `json:"webhookIds,omitempty"`
}
/**
* The Application API response.
*
* @author Brian Pontarelli
*/
type ApplicationResponse struct {
BaseHTTPResponse
Application Application `json:"application,omitempty"`
Applications []Application `json:"applications,omitempty"`
Role ApplicationRole `json:"role,omitempty"`
}
func (b *ApplicationResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* A role given to a user for a specific application.
*
* @author Seth Musselman
*/
type ApplicationRole struct {
Description string `json:"description,omitempty"`
Id string `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
IsDefault bool `json:"isDefault"`
IsSuperRole bool `json:"isSuperRole"`
LastUpdateInstant int64 `json:"lastUpdateInstant,omitempty"`
Name string `json:"name,omitempty"`
}
/**
* This class is a simple attachment with a byte array, name and MIME type.
*
* @author Brian Pontarelli
*/
type Attachment struct {
Attachment []byte `json:"attachment,omitempty"`
Mime string `json:"mime,omitempty"`
Name string `json:"name,omitempty"`
}
/**
* An audit log.
*
* @author Brian Pontarelli
*/
type AuditLog struct {
Data map[string]interface{} `json:"data,omitempty"`
Id int64 `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
InsertUser string `json:"insertUser,omitempty"`
Message string `json:"message,omitempty"`
NewValue interface{} `json:"newValue,omitempty"`
OldValue interface{} `json:"oldValue,omitempty"`
Reason string `json:"reason,omitempty"`
}
type AuditLogConfiguration struct {
Delete DeleteConfiguration `json:"delete,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type AuditLogExportRequest struct {
BaseExportRequest
Criteria AuditLogSearchCriteria `json:"criteria,omitempty"`
}
/**
* @author Brian Pontarelli
*/
type AuditLogRequest struct {
AuditLog AuditLog `json:"auditLog,omitempty"`
}
/**
* Audit log response.
*
* @author Brian Pontarelli
*/
type AuditLogResponse struct {
BaseHTTPResponse
AuditLog AuditLog `json:"auditLog,omitempty"`
}
func (b *AuditLogResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* @author Brian Pontarelli
*/
type AuditLogSearchCriteria struct {
BaseSearchCriteria
End int64 `json:"end,omitempty"`
Message string `json:"message,omitempty"`
Start int64 `json:"start,omitempty"`
User string `json:"user,omitempty"`
}
/**
* @author Brian Pontarelli
*/
type AuditLogSearchRequest struct {
Search AuditLogSearchCriteria `json:"search,omitempty"`
}
/**
* Audit log response.
*
* @author Brian Pontarelli
*/
type AuditLogSearchResponse struct {
BaseHTTPResponse
AuditLogs []AuditLog `json:"auditLogs,omitempty"`
Total int64 `json:"total,omitempty"`
}
func (b *AuditLogSearchResponse) SetStatus(status int) {
b.StatusCode = status
}
type AuthenticationTokenConfiguration struct {
Enableable
}
// Do not require a setter for 'type', it is defined by the concrete class and is not mutable
type BaseConnectorConfiguration struct {
Data map[string]interface{} `json:"data,omitempty"`
Debug bool `json:"debug"`
Id string `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
LastUpdateInstant int64 `json:"lastUpdateInstant,omitempty"`
Name string `json:"name,omitempty"`
Type ConnectorType `json:"type,omitempty"`
}
/**
* Base-class for all FusionAuth events.
*
* @author Brian Pontarelli
*/
type BaseEvent struct {
CreateInstant int64 `json:"createInstant,omitempty"`
Id string `json:"id,omitempty"`
TenantId string `json:"tenantId,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type BaseExportRequest struct {
DateTimeSecondsFormat string `json:"dateTimeSecondsFormat,omitempty"`
ZoneId string `json:"zoneId,omitempty"`
}
// Do not require a setter for 'type', it is defined by the concrete class and is not mutable
type BaseIdentityProvider struct {
Enableable
ApplicationConfiguration map[string]interface{} `json:"applicationConfiguration,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Debug bool `json:"debug"`
Id string `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
LambdaConfiguration ProviderLambdaConfiguration `json:"lambdaConfiguration,omitempty"`
LastUpdateInstant int64 `json:"lastUpdateInstant,omitempty"`
Name string `json:"name,omitempty"`
Type IdentityProviderType `json:"type,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type BaseIdentityProviderApplicationConfiguration struct {
Enableable
CreateRegistration bool `json:"createRegistration"`
Data map[string]interface{} `json:"data,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type BaseLoginRequest struct {
ApplicationId string `json:"applicationId,omitempty"`
IpAddress string `json:"ipAddress,omitempty"`
MetaData MetaData `json:"metaData,omitempty"`
NoJWT bool `json:"noJWT"`
}
/**
* @author Brian Pontarelli
*/
type BaseSearchCriteria struct {
NumberOfResults int `json:"numberOfResults,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
StartRow int `json:"startRow,omitempty"`
}
type BreachAction string
const (
BreachAction_Off BreachAction = "Off"
BreachAction_RecordOnly BreachAction = "RecordOnly"
BreachAction_NotifyUser BreachAction = "NotifyUser"
BreachAction_RequireChange BreachAction = "RequireChange"
)
/**
* @author Daniel DeGroff
*/
type BreachedPasswordStatus string
const (
BreachedPasswordStatus_None BreachedPasswordStatus = "None"
BreachedPasswordStatus_ExactMatch BreachedPasswordStatus = "ExactMatch"
BreachedPasswordStatus_SubAddressMatch BreachedPasswordStatus = "SubAddressMatch"
BreachedPasswordStatus_PasswordOnly BreachedPasswordStatus = "PasswordOnly"
BreachedPasswordStatus_CommonPassword BreachedPasswordStatus = "CommonPassword"
)
type BreachMatchMode string
const (
BreachMatchMode_Low BreachMatchMode = "Low"
BreachMatchMode_Medium BreachMatchMode = "Medium"
BreachMatchMode_High BreachMatchMode = "High"
)
/**
* XML canonicalization method enumeration. This is used for the IdP and SP side of FusionAuth SAML.
*
* @author Brian Pontarelli
*/
type CanonicalizationMethod string
const (
CanonicalizationMethod_Exclusive CanonicalizationMethod = "exclusive"
CanonicalizationMethod_ExclusiveWithComments CanonicalizationMethod = "exclusive_with_comments"
CanonicalizationMethod_Inclusive CanonicalizationMethod = "inclusive"
CanonicalizationMethod_InclusiveWithComments CanonicalizationMethod = "inclusive_with_comments"
)
type CertificateInformation struct {
Issuer string `json:"issuer,omitempty"`
Md5Fingerprint string `json:"md5Fingerprint,omitempty"`
SerialNumber string `json:"serialNumber,omitempty"`
Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"`
Sha1Thumbprint string `json:"sha1Thumbprint,omitempty"`
Sha256Fingerprint string `json:"sha256Fingerprint,omitempty"`
Sha256Thumbprint string `json:"sha256Thumbprint,omitempty"`
Subject string `json:"subject,omitempty"`
ValidFrom int64 `json:"validFrom,omitempty"`
ValidTo int64 `json:"validTo,omitempty"`
}
/**
* @author Trevor Smith
*/
type ChangePasswordReason string
const (
ChangePasswordReason_Administrative ChangePasswordReason = "Administrative"
ChangePasswordReason_Breached ChangePasswordReason = "Breached"
ChangePasswordReason_Expired ChangePasswordReason = "Expired"
ChangePasswordReason_Validation ChangePasswordReason = "Validation"
)
/**
* Change password request object.
*
* @author Brian Pontarelli
*/
type ChangePasswordRequest struct {
CurrentPassword string `json:"currentPassword,omitempty"`
LoginId string `json:"loginId,omitempty"`
Password string `json:"password,omitempty"`
RefreshToken string `json:"refreshToken,omitempty"`
}
/**
* Change password response object.
*
* @author Daniel DeGroff
*/
type ChangePasswordResponse struct {
BaseHTTPResponse
OneTimePassword string `json:"oneTimePassword,omitempty"`
State map[string]interface{} `json:"state,omitempty"`
}
func (b *ChangePasswordResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* CleanSpeak configuration at the system and application level.
*
* @author Brian Pontarelli
*/
type CleanSpeakConfiguration struct {
Enableable
ApiKey string `json:"apiKey,omitempty"`
ApplicationIds []string `json:"applicationIds,omitempty"`
Url string `json:"url,omitempty"`
UsernameModeration UsernameModeration `json:"usernameModeration,omitempty"`
}
type ClientAuthenticationMethod string
const (
ClientAuthenticationMethod_None ClientAuthenticationMethod = "none"
ClientAuthenticationMethod_ClientSecretBasic ClientAuthenticationMethod = "client_secret_basic"
ClientAuthenticationMethod_ClientSecretPost ClientAuthenticationMethod = "client_secret_post"
)
/**
* @author Trevor Smith
*/
type ConnectorPolicy struct {
ConnectorId string `json:"connectorId,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Domains []string `json:"domains,omitempty"`
Migrate bool `json:"migrate"`
}
/**
* @author Trevor Smith
*/
type ConnectorRequest struct {
Connector BaseConnectorConfiguration `json:"connector,omitempty"`
}
/**
* @author Trevor Smith
*/
type ConnectorResponse struct {
BaseHTTPResponse
Connector BaseConnectorConfiguration `json:"connector,omitempty"`
Connectors []BaseConnectorConfiguration `json:"connectors,omitempty"`
}
func (b *ConnectorResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* The types of connectors. This enum is stored as an ordinal on the <code>identities</code> table, order must be maintained.
*
* @author Trevor Smith
*/
type ConnectorType string
const (
ConnectorType_FusionAuth ConnectorType = "FusionAuth"
ConnectorType_Generic ConnectorType = "Generic"
ConnectorType_LDAP ConnectorType = "LDAP"
)
/**
* Models a consent.
*
* @author Daniel DeGroff
*/
type Consent struct {
ConsentEmailTemplateId string `json:"consentEmailTemplateId,omitempty"`
CountryMinimumAgeForSelfConsent map[string]int `json:"countryMinimumAgeForSelfConsent,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
DefaultMinimumAgeForSelfConsent int `json:"defaultMinimumAgeForSelfConsent,omitempty"`
EmailPlus EmailPlus `json:"emailPlus,omitempty"`
Id string `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
LastUpdateInstant int64 `json:"lastUpdateInstant,omitempty"`
MultipleValuesAllowed bool `json:"multipleValuesAllowed"`
Name string `json:"name,omitempty"`
Values []string `json:"values,omitempty"`
}
/**
* API request for User consent types.
*
* @author Daniel DeGroff
*/
type ConsentRequest struct {
Consent Consent `json:"consent,omitempty"`
}
/**
* API response for consent.
*
* @author Daniel DeGroff
*/
type ConsentResponse struct {
BaseHTTPResponse
Consent Consent `json:"consent,omitempty"`
Consents []Consent `json:"consents,omitempty"`
}
func (b *ConsentResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* Models a consent.
*
* @author Daniel DeGroff
*/
type ConsentStatus string
const (
ConsentStatus_Active ConsentStatus = "Active"
ConsentStatus_Revoked ConsentStatus = "Revoked"
)
/**
* Status for content like usernames, profile attributes, etc.
*
* @author Brian Pontarelli
*/
type ContentStatus string
const (
ContentStatus_ACTIVE ContentStatus = "ACTIVE"
ContentStatus_PENDING ContentStatus = "PENDING"
ContentStatus_REJECTED ContentStatus = "REJECTED"
)
/**
* @author Trevor Smith
*/
type CORSConfiguration struct {
Enableable
AllowCredentials bool `json:"allowCredentials"`
AllowedHeaders []string `json:"allowedHeaders,omitempty"`
AllowedMethods []HTTPMethod `json:"allowedMethods,omitempty"`
AllowedOrigins []string `json:"allowedOrigins,omitempty"`
ExposedHeaders []string `json:"exposedHeaders,omitempty"`
PreflightMaxAgeInSeconds int `json:"preflightMaxAgeInSeconds,omitempty"`
}
/**
* @author Brian Pontarelli
*/
type Count struct {
Count int `json:"count,omitempty"`
Interval int `json:"interval,omitempty"`
}
/**
* Response for the daily active user report.
*
* @author Brian Pontarelli
*/
type DailyActiveUserReportResponse struct {
BaseHTTPResponse
DailyActiveUsers []Count `json:"dailyActiveUsers,omitempty"`
Total int64 `json:"total,omitempty"`
}
func (b *DailyActiveUserReportResponse) SetStatus(status int) {
b.StatusCode = status
}
type DeleteConfiguration struct {
Enableable
NumberOfDaysToRetain int `json:"numberOfDaysToRetain,omitempty"`
}
/**
* @author Daniel DeGroff
*/
type DeviceInfo struct {
Description string `json:"description,omitempty"`
LastAccessedAddress string `json:"lastAccessedAddress,omitempty"`
LastAccessedInstant int64 `json:"lastAccessedInstant,omitempty"`
Name string `json:"name,omitempty"`
Type DeviceType `json:"type,omitempty"`
}
/**
* @author Trevor Smith
*/
type DeviceResponse struct {
BaseHTTPResponse
DeviceCode string `json:"device_code,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"`
Interval int `json:"interval,omitempty"`
UserCode string `json:"user_code,omitempty"`
VerificationUri string `json:"verification_uri,omitempty"`
VerificationUriComplete string `json:"verification_uri_complete,omitempty"`
}
func (b *DeviceResponse) SetStatus(status int) {
b.StatusCode = status
}
type DeviceType string
const (
DeviceType_BROWSER DeviceType = "BROWSER"
DeviceType_DESKTOP DeviceType = "DESKTOP"
DeviceType_LAPTOP DeviceType = "LAPTOP"
DeviceType_MOBILE DeviceType = "MOBILE"
DeviceType_OTHER DeviceType = "OTHER"
DeviceType_SERVER DeviceType = "SERVER"
DeviceType_TABLET DeviceType = "TABLET"
DeviceType_TV DeviceType = "TV"
DeviceType_UNKNOWN DeviceType = "UNKNOWN"
)
/**
* A displayable raw login that includes application name and user loginId.
*
* @author Brian Pontarelli
*/
type DisplayableRawLogin struct {
RawLogin
ApplicationName string `json:"applicationName,omitempty"`
LoginId string `json:"loginId,omitempty"`
}
/**
* Interface for all identity providers that can be domain based.
*/
type DomainBasedIdentityProvider struct {
}
/**
* This class is an abstraction of a simple email message.
*
* @author Brian Pontarelli
*/
type Email struct {
Attachments []Attachment `json:"attachments,omitempty"`
Bcc []EmailAddress `json:"bcc,omitempty"`
Cc []EmailAddress `json:"cc,omitempty"`
From EmailAddress `json:"from,omitempty"`
Html string `json:"html,omitempty"`
ReplyTo EmailAddress `json:"replyTo,omitempty"`
Subject string `json:"subject,omitempty"`
Text string `json:"text,omitempty"`
To []EmailAddress `json:"to,omitempty"`
}
/**
* An email address.
*
* @author Brian Pontarelli
*/
type EmailAddress struct {
Address string `json:"address,omitempty"`
Display string `json:"display,omitempty"`
}
/**
* @author Brian Pontarelli
*/
type EmailConfiguration struct {
DefaultFromEmail string `json:"defaultFromEmail,omitempty"`
DefaultFromName string `json:"defaultFromName,omitempty"`
ForgotPasswordEmailTemplateId string `json:"forgotPasswordEmailTemplateId,omitempty"`
Host string `json:"host,omitempty"`
Password string `json:"password,omitempty"`
PasswordlessEmailTemplateId string `json:"passwordlessEmailTemplateId,omitempty"`
Port int `json:"port,omitempty"`
Properties string `json:"properties,omitempty"`
Security EmailSecurityType `json:"security,omitempty"`
SetPasswordEmailTemplateId string `json:"setPasswordEmailTemplateId,omitempty"`
Username string `json:"username,omitempty"`
VerificationEmailTemplateId string `json:"verificationEmailTemplateId,omitempty"`
VerifyEmail bool `json:"verifyEmail"`
VerifyEmailWhenChanged bool `json:"verifyEmailWhenChanged"`
}
type EmailPlus struct {
Enableable
EmailTemplateId string `json:"emailTemplateId,omitempty"`
MaximumTimeToSendEmailInHours int `json:"maximumTimeToSendEmailInHours,omitempty"`
MinimumTimeToSendEmailInHours int `json:"minimumTimeToSendEmailInHours,omitempty"`
}
type EmailSecurityType string
const (
EmailSecurityType_NONE EmailSecurityType = "NONE"
EmailSecurityType_SSL EmailSecurityType = "SSL"
EmailSecurityType_TLS EmailSecurityType = "TLS"
)
/**
* Stores an email template used to send emails to users.
*
* @author Brian Pontarelli
*/
type EmailTemplate struct {
DefaultFromName string `json:"defaultFromName,omitempty"`
DefaultHtmlTemplate string `json:"defaultHtmlTemplate,omitempty"`
DefaultSubject string `json:"defaultSubject,omitempty"`
DefaultTextTemplate string `json:"defaultTextTemplate,omitempty"`
FromEmail string `json:"fromEmail,omitempty"`
Id string `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
LastUpdateInstant int64 `json:"lastUpdateInstant,omitempty"`
LocalizedFromNames map[string]string `json:"localizedFromNames,omitempty"`
LocalizedHtmlTemplates map[string]string `json:"localizedHtmlTemplates,omitempty"`
LocalizedSubjects map[string]string `json:"localizedSubjects,omitempty"`
LocalizedTextTemplates map[string]string `json:"localizedTextTemplates,omitempty"`
Name string `json:"name,omitempty"`
}
type EmailTemplateErrors struct {
ParseErrors map[string]string `json:"parseErrors,omitempty"`
RenderErrors map[string]string `json:"renderErrors,omitempty"`
}
/**
* Email template request.
*
* @author Brian Pontarelli
*/
type EmailTemplateRequest struct {
EmailTemplate EmailTemplate `json:"emailTemplate,omitempty"`
}
/**
* Email template response.
*
* @author Brian Pontarelli
*/
type EmailTemplateResponse struct {
BaseHTTPResponse
EmailTemplate EmailTemplate `json:"emailTemplate,omitempty"`
EmailTemplates []EmailTemplate `json:"emailTemplates,omitempty"`
}
func (b *EmailTemplateResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* Something that can be enabled and thus also disabled.
*
* @author Daniel DeGroff
*/
type Enableable struct {
Enabled bool `json:"enabled"`
}
/**
* Defines an error.
*
* @author Brian Pontarelli
*/
type Error struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
/**
* Standard error domain object that can also be used as the response from an API call.
*
* @author Brian Pontarelli
*/
type Errors struct {
FieldErrors map[string][]Error `json:"fieldErrors,omitempty"`
GeneralErrors []Error `json:"generalErrors,omitempty"`
}
func (e Errors) Present() bool {
return len(e.FieldErrors) != 0 || len(e.GeneralErrors) != 0
}
func (e Errors) Error() string {
var messages []string
for _, generalError := range e.GeneralErrors {
messages = append(messages, generalError.Message)
}
for fieldName, fieldErrors := range e.FieldErrors {
var fieldMessages []string
for _, fieldError := range fieldErrors {
fieldMessages = append(fieldMessages, fieldError.Message)
}
messages = append(messages, fmt.Sprintf("%s: %s", fieldName, strings.Join(fieldMessages, ",")))
}
return strings.Join(messages, " ")
}
/**
* @author Brian Pontarelli
*/
type EventConfiguration struct {
Events map[EventType]EventConfigurationData `json:"events,omitempty"`
}
type EventConfigurationData struct {
Enableable
TransactionType TransactionType `json:"transactionType,omitempty"`
}
/**
* Event log used internally by FusionAuth to help developers debug hooks, Webhooks, email templates, etc.
*
* @author Brian Pontarelli
*/
type EventLog struct {
Id int64 `json:"id,omitempty"`
InsertInstant int64 `json:"insertInstant,omitempty"`
Message string `json:"message,omitempty"`
Type EventLogType `json:"type,omitempty"`
}
type EventLogConfiguration struct {
NumberToRetain int `json:"numberToRetain,omitempty"`
}
/**
* Event log response.
*
* @author Daniel DeGroff
*/
type EventLogResponse struct {
BaseHTTPResponse
EventLog EventLog `json:"eventLog,omitempty"`
}
func (b *EventLogResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* Search criteria for the event log.
*
* @author Brian Pontarelli
*/
type EventLogSearchCriteria struct {
BaseSearchCriteria
End int64 `json:"end,omitempty"`
Message string `json:"message,omitempty"`
Start int64 `json:"start,omitempty"`
Type EventLogType `json:"type,omitempty"`
}
/**
* @author Brian Pontarelli
*/
type EventLogSearchRequest struct {
Search EventLogSearchCriteria `json:"search,omitempty"`
}
/**
* Event log response.
*
* @author Brian Pontarelli
*/
type EventLogSearchResponse struct {
BaseHTTPResponse
EventLogs []EventLog `json:"eventLogs,omitempty"`
Total int64 `json:"total,omitempty"`
}
func (b *EventLogSearchResponse) SetStatus(status int) {
b.StatusCode = status
}
/**
* Event Log Type
*
* @author Daniel DeGroff
*/
type EventLogType string
const (
EventLogType_Information EventLogType = "Information"
EventLogType_Debug EventLogType = "Debug"
EventLogType_Error EventLogType = "Error"
)
/**
* Container for the event information. This is the JSON that is sent from FusionAuth to webhooks.
*
* @author Brian Pontarelli
*/
type EventRequest struct {
Event BaseEvent `json:"event,omitempty"`
}
/**
* Models the event types that FusionAuth produces.
*
* @author Brian Pontarelli
*/
type EventType string
const (
EventType_UserDelete EventType = "user.delete"
EventType_UserCreate EventType = "user.create"
EventType_UserUpdate EventType = "user.update"
EventType_UserDeactivate EventType = "user.deactivate"
EventType_UserBulkCreate EventType = "user.bulk.create"
EventType_UserReactivate EventType = "user.reactivate"
EventType_UserAction EventType = "user.action"
EventType_JWTRefreshTokenRevoke EventType = "jwt.refresh-token.revoke"
EventType_JWTRefresh EventType = "jwt.refresh"
EventType_JWTPublicKeyUpdate EventType = "jwt.public-key.update"
EventType_UserLoginSuccess EventType = "user.login.success"
EventType_UserLoginFailed EventType = "user.login.failed"
EventType_UserRegistrationCreate EventType = "user.registration.create"
EventType_UserRegistrationUpdate EventType = "user.registration.update"
EventType_UserRegistrationDelete EventType = "user.registration.delete"
EventType_UserRegistrationVerified EventType = "user.registration.verified"
EventType_UserEmailVerified EventType = "user.email.verified"
EventType_UserPasswordBreach EventType = "user.password.breach"
EventType_Test EventType = "test"
)
/**
* @author Brian Pontarelli
*/
type ExpiryUnit string
const (
ExpiryUnit_MINUTES ExpiryUnit = "MINUTES"
ExpiryUnit_HOURS ExpiryUnit = "HOURS"