mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-13 09:25:12 +00:00
new pkg structure (#1150)
* fix: split command query side * fix: split command query side * fix: members in correct pkg structure * fix: label policy in correct pkg structure * fix: structure * fix: structure of login policy * fix: identityprovider structure * fix: org iam policy structure * fix: password age policy structure * fix: password complexity policy structure * fix: password lockout policy structure * fix: idp structure * fix: user events structure * fix: user write model * fix: profile email changed command * fix: address changed command * fix: user states * fix: user * fix: org structure and add human * begin iam setup command side * setup * step2 * step2 * fix: add user * step2 * isvalid * fix: folder structure v2 business Co-authored-by: Fabiennne <[email protected]>
This commit is contained in:
co-authored by
Fabiennne
parent
762941f0ea
commit
21ffe1b0cb
@@ -29,21 +29,3 @@ func NewAggregate(
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func AggregateFromWriteModel(wm *eventstore.WriteModel) *Aggregate {
|
||||
return &Aggregate{
|
||||
Aggregate: *eventstore.AggregateFromWriteModel(wm, AggregateType, AggregateVersion),
|
||||
}
|
||||
}
|
||||
|
||||
func AggregateFromReadModel(rm *ReadModel) *Aggregate {
|
||||
return &Aggregate{
|
||||
Aggregate: *eventstore.NewAggregate(
|
||||
rm.AggregateID,
|
||||
AggregateType,
|
||||
rm.ResourceOwner,
|
||||
AggregateVersion,
|
||||
rm.ProcessedSequence,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,113 +2,100 @@ package user
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/address"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/email"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/external_idp"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa/otp"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa/web_auth_n"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/password"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/phone"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/profile"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/machine"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/machine/keys"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/v1"
|
||||
)
|
||||
|
||||
func RegisterEventMappers(es *eventstore.Eventstore) {
|
||||
es.RegisterFilterEventMapper(v1.UserV1AddedType, human.AddedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1RegisteredType, human.RegisteredEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1InitialCodeAddedType, human.InitialCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1InitialCodeSentType, human.InitialCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1InitializedCheckSucceededType, human.InitializedCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1InitializedCheckFailedType, human.InitializedCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1SignedOutType, human.SignedOutEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PasswordChangedType, password.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PasswordCodeAddedType, password.CodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PasswordCodeSentType, password.CodeSentEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PasswordCheckSucceededType, password.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PasswordCheckFailedType, password.CheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1EmailChangedType, email.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1EmailVerifiedType, email.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1EmailVerificationFailedType, email.VerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1EmailCodeAddedType, email.CodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1EmailCodeSentType, email.CodeSentEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PhoneChangedType, phone.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PhoneRemovedType, phone.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PhoneVerifiedType, phone.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PhoneVerificationFailedType, phone.VerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PhoneCodeAddedType, phone.CodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1PhoneCodeSentType, phone.CodeSentEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1ProfileChangedType, profile.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1AddressChangedType, address.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1MFAInitSkippedType, mfa.InitSkippedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1MFAOTPAddedType, otp.AddedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1MFAOTPVerifiedType, otp.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1MFAOTPRemovedType, otp.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1MFAOTPCheckSucceededType, otp.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(v1.UserV1MFAOTPCheckFailedType, otp.CheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(UserLockedType, LockedEventMapper).
|
||||
RegisterFilterEventMapper(UserUnlockedType, LockedEventMapper).
|
||||
RegisterFilterEventMapper(UserDeactivatedType, DeactivatedEventMapper).
|
||||
RegisterFilterEventMapper(UserReactivatedType, ReactivatedEventMapper).
|
||||
RegisterFilterEventMapper(UserRemovedType, RemovedEventMapper).
|
||||
RegisterFilterEventMapper(UserTokenAddedType, TokenAddedEventMapper).
|
||||
es.RegisterFilterEventMapper(UserV1AddedType, HumanAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1RegisteredType, HumanRegisteredEventMapper).
|
||||
RegisterFilterEventMapper(UserV1InitialCodeAddedType, HumanInitialCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1InitialCodeSentType, HumanInitialCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(UserV1InitializedCheckSucceededType, HumanInitializedCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(UserV1InitializedCheckFailedType, HumanInitializedCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1SignedOutType, HumanSignedOutEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PasswordChangedType, HumanPasswordChangedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PasswordCodeAddedType, HumanPasswordCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PasswordCodeSentType, HumanPasswordCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PasswordCheckSucceededType, HumanPasswordCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PasswordCheckFailedType, HumanPasswordCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1EmailChangedType, HumanEmailChangedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1EmailVerifiedType, HumanEmailVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1EmailVerificationFailedType, HumanEmailVerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1EmailCodeAddedType, HumanEmailCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1EmailCodeSentType, HumanEmailCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PhoneChangedType, HumanPhoneChangedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PhoneRemovedType, HumanPhoneRemovedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PhoneVerifiedType, HumanPhoneVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PhoneVerificationFailedType, HumanPhoneVerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PhoneCodeAddedType, HumanPhoneCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1PhoneCodeSentType, HumanPhoneCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(UserV1ProfileChangedType, HumanProfileChangedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1AddressChangedType, HumanAddressChangedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1MFAInitSkippedType, HumanMFAInitSkippedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1MFAOTPAddedType, HumanOTPAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1MFAOTPVerifiedType, HumanOTPVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1MFAOTPRemovedType, HumanOTPRemovedEventMapper).
|
||||
RegisterFilterEventMapper(UserV1MFAOTPCheckSucceededType, HumanOTPCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(UserV1MFAOTPCheckFailedType, HumanOTPCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(UserLockedType, UserLockedEventMapper).
|
||||
RegisterFilterEventMapper(UserUnlockedType, UserLockedEventMapper).
|
||||
RegisterFilterEventMapper(UserDeactivatedType, UserDeactivatedEventMapper).
|
||||
RegisterFilterEventMapper(UserReactivatedType, UserReactivatedEventMapper).
|
||||
RegisterFilterEventMapper(UserRemovedType, UserRemovedEventMapper).
|
||||
RegisterFilterEventMapper(UserTokenAddedType, UserTokenAddedEventMapper).
|
||||
RegisterFilterEventMapper(UserDomainClaimedType, DomainClaimedEventMapper).
|
||||
RegisterFilterEventMapper(UserDomainClaimedSentType, DomainClaimedEventMapper).
|
||||
RegisterFilterEventMapper(UserUserNameChangedType, UsernameChangedEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanAddedType, human.AddedEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanRegisteredType, human.RegisteredEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanInitialCodeAddedType, human.InitialCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanInitialCodeSentType, human.InitialCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanInitializedCheckSucceededType, human.InitializedCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanInitializedCheckFailedType, human.InitializedCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(human.HumanSignedOutType, human.SignedOutEventMapper).
|
||||
RegisterFilterEventMapper(password.HumanPasswordChangedType, password.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(password.HumanPasswordCodeAddedType, password.CodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(password.HumanPasswordCodeSentType, password.CodeSentEventMapper).
|
||||
RegisterFilterEventMapper(password.HumanPasswordCheckSucceededType, password.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(password.HumanPasswordCheckFailedType, password.CheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(external_idp.HumanExternalIDPAddedType, external_idp.AddedEventMapper).
|
||||
RegisterFilterEventMapper(external_idp.HumanExternalIDPRemovedType, external_idp.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(external_idp.HumanExternalIDPCascadeRemovedType, external_idp.CascadeRemovedEventMapper).
|
||||
RegisterFilterEventMapper(external_idp.HumanExternalLoginCheckSucceededType, external_idp.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(email.HumanEmailChangedType, email.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(email.HumanEmailVerifiedType, email.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(email.HumanEmailVerificationFailedType, email.VerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(email.HumanEmailCodeAddedType, email.CodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(email.HumanEmailCodeSentType, email.CodeSentEventMapper).
|
||||
RegisterFilterEventMapper(phone.HumanPhoneChangedType, phone.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(phone.HumanPhoneRemovedType, phone.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(phone.HumanPhoneVerifiedType, phone.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(phone.HumanPhoneVerificationFailedType, phone.VerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(phone.HumanPhoneCodeAddedType, phone.CodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(phone.HumanPhoneCodeSentType, phone.CodeSentEventMapper).
|
||||
RegisterFilterEventMapper(profile.HumanProfileChangedType, profile.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(address.HumanAddressChangedType, address.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(mfa.HumanMFAInitSkippedType, mfa.InitSkippedEventMapper).
|
||||
RegisterFilterEventMapper(otp.HumanMFAOTPAddedType, otp.AddedEventMapper).
|
||||
RegisterFilterEventMapper(otp.HumanMFAOTPVerifiedType, otp.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(otp.HumanMFAOTPRemovedType, otp.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(otp.HumanMFAOTPCheckSucceededType, otp.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(otp.HumanMFAOTPCheckFailedType, otp.CheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenAddedType, web_auth_n.AddedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenVerifiedType, web_auth_n.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenSignCountChangedType, web_auth_n.SignCountChangedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenRemovedType, web_auth_n.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenBeginLoginType, web_auth_n.BeginLoginEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenCheckSucceededType, web_auth_n.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanU2FTokenCheckFailedType, web_auth_n.CheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenAddedType, web_auth_n.AddedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenVerifiedType, web_auth_n.VerifiedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenSignCountChangedType, web_auth_n.SignCountChangedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenRemovedType, web_auth_n.RemovedEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenBeginLoginType, web_auth_n.BeginLoginEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenCheckSucceededType, web_auth_n.CheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(web_auth_n.HumanPasswordlessTokenCheckFailedType, web_auth_n.CheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(machine.MachineAddedEventType, machine.AddedEventMapper).
|
||||
RegisterFilterEventMapper(machine.MachineChangedEventType, machine.ChangedEventMapper).
|
||||
RegisterFilterEventMapper(keys.MachineKeyAddedEventType, keys.AddedEventMapper).
|
||||
RegisterFilterEventMapper(keys.MachineKeyRemovedEventType, keys.RemovedEventMapper)
|
||||
RegisterFilterEventMapper(HumanAddedType, HumanAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanRegisteredType, HumanRegisteredEventMapper).
|
||||
RegisterFilterEventMapper(HumanInitialCodeAddedType, HumanInitialCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanInitialCodeSentType, HumanInitialCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(HumanInitializedCheckSucceededType, HumanInitializedCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(HumanInitializedCheckFailedType, HumanInitializedCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(HumanSignedOutType, HumanSignedOutEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordChangedType, HumanPasswordChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordCodeAddedType, HumanPasswordCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordCodeSentType, HumanPasswordCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordCheckSucceededType, HumanPasswordCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordCheckFailedType, HumanPasswordCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(HumanExternalIDPAddedType, HumanExternalIDPAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanExternalIDPRemovedType, HumanExternalIDPRemovedEventMapper).
|
||||
RegisterFilterEventMapper(HumanExternalIDPCascadeRemovedType, HumanExternalIDPCascadeRemovedEventMapper).
|
||||
RegisterFilterEventMapper(HumanExternalLoginCheckSucceededType, HumanExternalIDPCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(HumanEmailChangedType, HumanEmailChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanEmailVerifiedType, HumanEmailVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(HumanEmailVerificationFailedType, HumanEmailVerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(HumanEmailCodeAddedType, HumanEmailCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanEmailCodeSentType, HumanEmailCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(HumanPhoneChangedType, HumanPhoneChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPhoneRemovedType, HumanPhoneRemovedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPhoneVerifiedType, HumanPhoneVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPhoneVerificationFailedType, HumanPhoneVerificationFailedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPhoneCodeAddedType, HumanPhoneCodeAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPhoneCodeSentType, HumanPhoneCodeSentEventMapper).
|
||||
RegisterFilterEventMapper(HumanProfileChangedType, HumanProfileChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanAddressChangedType, HumanAddressChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanMFAInitSkippedType, HumanMFAInitSkippedEventMapper).
|
||||
RegisterFilterEventMapper(HumanMFAOTPAddedType, HumanOTPAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanMFAOTPVerifiedType, HumanOTPVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(HumanMFAOTPRemovedType, HumanOTPRemovedEventMapper).
|
||||
RegisterFilterEventMapper(HumanMFAOTPCheckSucceededType, HumanOTPCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(HumanMFAOTPCheckFailedType, HumanOTPCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenAddedType, WebAuthNAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenVerifiedType, HumanWebAuthNVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenSignCountChangedType, HumanWebAuthNSignCountChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenRemovedType, HumanWebAuthNRemovedEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenBeginLoginType, HumanWebAuthNBeginLoginEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenCheckSucceededType, HumanWebAuthNCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(HumanU2FTokenCheckFailedType, HumanWebAuthNCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenAddedType, WebAuthNAddedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenVerifiedType, HumanWebAuthNVerifiedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenSignCountChangedType, HumanWebAuthNSignCountChangedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenRemovedType, HumanWebAuthNRemovedEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenBeginLoginType, HumanWebAuthNBeginLoginEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenCheckSucceededType, HumanWebAuthNCheckSucceededEventMapper).
|
||||
RegisterFilterEventMapper(HumanPasswordlessTokenCheckFailedType, HumanWebAuthNCheckFailedEventMapper).
|
||||
RegisterFilterEventMapper(MachineAddedEventType, MachineAddedEventMapper).
|
||||
RegisterFilterEventMapper(MachineChangedEventType, MachineChangedEventMapper).
|
||||
RegisterFilterEventMapper(MachineKeyAddedEventType, MachineKeyAddedEventMapper).
|
||||
RegisterFilterEventMapper(MachineKeyRemovedEventType, MachineKeyRemovedEventMapper)
|
||||
}
|
||||
|
||||
+65
-61
@@ -1,4 +1,4 @@
|
||||
package human
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -7,12 +7,13 @@ import (
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"golang.org/x/text/language"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
humanEventPrefix = eventstore.EventType("user.human.")
|
||||
humanEventPrefix = userEventTypePrefix + "human."
|
||||
HumanAddedType = humanEventPrefix + "added"
|
||||
HumanRegisteredType = humanEventPrefix + "selfregistered"
|
||||
HumanInitialCodeAddedType = humanEventPrefix + "initialization.code.added"
|
||||
@@ -22,17 +23,17 @@ const (
|
||||
HumanSignedOutType = humanEventPrefix + "signed.out"
|
||||
)
|
||||
|
||||
type AddedEvent struct {
|
||||
type HumanAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserName string `json:"userName"`
|
||||
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
NickName string `json:"nickName,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Gender Gender `json:"gender,omitempty"`
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
NickName string `json:"nickName,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Gender domain.Gender `json:"gender,omitempty"`
|
||||
|
||||
EmailAddress string `json:"email,omitempty"`
|
||||
|
||||
@@ -43,13 +44,16 @@ type AddedEvent struct {
|
||||
PostalCode string `json:"postalCode,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
StreetAddress string `json:"streetAddress,omitempty"`
|
||||
|
||||
Secret *crypto.CryptoValue `json:"secret,omitempty"`
|
||||
ChangeRequired bool `json:"changeRequired,omitempty"`
|
||||
}
|
||||
|
||||
func (e *AddedEvent) Data() interface{} {
|
||||
func (e *HumanAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewAddedEvent(
|
||||
func NewHumanAddedEvent(
|
||||
ctx context.Context,
|
||||
userName,
|
||||
firstName,
|
||||
@@ -57,7 +61,7 @@ func NewAddedEvent(
|
||||
nickName,
|
||||
displayName string,
|
||||
preferredLanguage language.Tag,
|
||||
gender Gender,
|
||||
gender domain.Gender,
|
||||
emailAddress,
|
||||
phoneNumber,
|
||||
country,
|
||||
@@ -65,8 +69,8 @@ func NewAddedEvent(
|
||||
postalCode,
|
||||
region,
|
||||
streetAddress string,
|
||||
) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
) *HumanAddedEvent {
|
||||
return &HumanAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanAddedType,
|
||||
@@ -88,8 +92,8 @@ func NewAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanAdded := &AddedEvent{
|
||||
func HumanAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanAdded := &HumanAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, humanAdded)
|
||||
@@ -100,17 +104,17 @@ func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return humanAdded, nil
|
||||
}
|
||||
|
||||
type RegisteredEvent struct {
|
||||
type HumanRegisteredEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserName string `json:"userName"`
|
||||
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
NickName string `json:"nickName,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Gender int32 `json:"gender,omitempty"`
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
NickName string `json:"nickName,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Gender domain.Gender `json:"gender,omitempty"`
|
||||
|
||||
EmailAddress string `json:"email,omitempty"`
|
||||
|
||||
@@ -123,11 +127,11 @@ type RegisteredEvent struct {
|
||||
StreetAddress string `json:"streetAddress,omitempty"`
|
||||
}
|
||||
|
||||
func (e *RegisteredEvent) Data() interface{} {
|
||||
func (e *HumanRegisteredEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewRegisteredEvent(
|
||||
func NewHumanRegisteredEvent(
|
||||
ctx context.Context,
|
||||
userName,
|
||||
firstName,
|
||||
@@ -135,7 +139,7 @@ func NewRegisteredEvent(
|
||||
nickName,
|
||||
displayName string,
|
||||
preferredLanguage language.Tag,
|
||||
gender int32,
|
||||
gender domain.Gender,
|
||||
emailAddress,
|
||||
phoneNumber,
|
||||
country,
|
||||
@@ -143,8 +147,8 @@ func NewRegisteredEvent(
|
||||
postalCode,
|
||||
region,
|
||||
streetAddress string,
|
||||
) *RegisteredEvent {
|
||||
return &RegisteredEvent{
|
||||
) *HumanRegisteredEvent {
|
||||
return &HumanRegisteredEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanRegisteredType,
|
||||
@@ -166,8 +170,8 @@ func NewRegisteredEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func RegisteredEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanRegistered := &RegisteredEvent{
|
||||
func HumanRegisteredEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanRegistered := &HumanRegisteredEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, humanRegistered)
|
||||
@@ -178,22 +182,22 @@ func RegisteredEventMapper(event *repository.Event) (eventstore.EventReader, err
|
||||
return humanRegistered, nil
|
||||
}
|
||||
|
||||
type InitialCodeAddedEvent struct {
|
||||
type HumanInitialCodeAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
Code *crypto.CryptoValue `json:"code,omitempty"`
|
||||
Expiry time.Duration `json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (e *InitialCodeAddedEvent) Data() interface{} {
|
||||
func (e *HumanInitialCodeAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewInitialCodeAddedEvent(
|
||||
func NewHumanInitialCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
) *InitialCodeAddedEvent {
|
||||
return &InitialCodeAddedEvent{
|
||||
) *HumanInitialCodeAddedEvent {
|
||||
return &HumanInitialCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanInitialCodeAddedType,
|
||||
@@ -203,8 +207,8 @@ func NewInitialCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func InitialCodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanRegistered := &InitialCodeAddedEvent{
|
||||
func HumanInitialCodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanRegistered := &HumanInitialCodeAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, humanRegistered)
|
||||
@@ -215,16 +219,16 @@ func InitialCodeAddedEventMapper(event *repository.Event) (eventstore.EventReade
|
||||
return humanRegistered, nil
|
||||
}
|
||||
|
||||
type InitialCodeSentEvent struct {
|
||||
type HumanInitialCodeSentEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *InitialCodeSentEvent) Data() interface{} {
|
||||
func (e *HumanInitialCodeSentEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewInitialCodeSentEvent(ctx context.Context) *InitialCodeSentEvent {
|
||||
return &InitialCodeSentEvent{
|
||||
func NewHumanInitialCodeSentEvent(ctx context.Context) *HumanInitialCodeSentEvent {
|
||||
return &HumanInitialCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanInitialCodeSentType,
|
||||
@@ -232,22 +236,22 @@ func NewInitialCodeSentEvent(ctx context.Context) *InitialCodeSentEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func InitialCodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &InitialCodeSentEvent{
|
||||
func HumanInitialCodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanInitialCodeSentEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type InitializedCheckSucceededEvent struct {
|
||||
type HumanInitializedCheckSucceededEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *InitializedCheckSucceededEvent) Data() interface{} {
|
||||
func (e *HumanInitializedCheckSucceededEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewInitializedCheckSucceededEvent(ctx context.Context) *InitializedCheckSucceededEvent {
|
||||
return &InitializedCheckSucceededEvent{
|
||||
func NewHumanInitializedCheckSucceededEvent(ctx context.Context) *HumanInitializedCheckSucceededEvent {
|
||||
return &HumanInitializedCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanInitializedCheckSucceededType,
|
||||
@@ -255,22 +259,22 @@ func NewInitializedCheckSucceededEvent(ctx context.Context) *InitializedCheckSuc
|
||||
}
|
||||
}
|
||||
|
||||
func InitializedCheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &InitializedCheckSucceededEvent{
|
||||
func HumanInitializedCheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanInitializedCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type InitializedCheckFailedEvent struct {
|
||||
type HumanInitializedCheckFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *InitializedCheckFailedEvent) Data() interface{} {
|
||||
func (e *HumanInitializedCheckFailedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewInitializedCheckFailedEvent(ctx context.Context) *InitializedCheckFailedEvent {
|
||||
return &InitializedCheckFailedEvent{
|
||||
func NewHumanInitializedCheckFailedEvent(ctx context.Context) *HumanInitializedCheckFailedEvent {
|
||||
return &HumanInitializedCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanInitializedCheckFailedType,
|
||||
@@ -278,22 +282,22 @@ func NewInitializedCheckFailedEvent(ctx context.Context) *InitializedCheckFailed
|
||||
}
|
||||
}
|
||||
|
||||
func InitializedCheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &InitializedCheckFailedEvent{
|
||||
func HumanInitializedCheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanInitializedCheckFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type SignedOutEvent struct {
|
||||
type HumanSignedOutEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *SignedOutEvent) Data() interface{} {
|
||||
func (e *HumanSignedOutEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewSignedOutEvent(ctx context.Context) *SignedOutEvent {
|
||||
return &SignedOutEvent{
|
||||
func NewHumanSignedOutEvent(ctx context.Context) *HumanSignedOutEvent {
|
||||
return &HumanSignedOutEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanSignedOutType,
|
||||
@@ -301,8 +305,8 @@ func NewSignedOutEvent(ctx context.Context) *SignedOutEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func SignedOutEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &SignedOutEvent{
|
||||
func HumanSignedOutEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanSignedOutEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package address
|
||||
|
||||
import "github.com/caos/zitadel/internal/eventstore/v2"
|
||||
|
||||
type WriteModel struct {
|
||||
eventstore.WriteModel
|
||||
|
||||
Country string
|
||||
Locality string
|
||||
PostalCode string
|
||||
Region string
|
||||
StreetAddress string
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package email
|
||||
|
||||
import "github.com/caos/zitadel/internal/eventstore/v2"
|
||||
|
||||
type WriteModel struct {
|
||||
eventstore.WriteModel
|
||||
|
||||
Email string
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package human
|
||||
|
||||
type Gender int32
|
||||
|
||||
const (
|
||||
GenderUnspecified Gender = iota
|
||||
GenderFemale
|
||||
GenderMale
|
||||
GenderDiverse
|
||||
|
||||
genderCount
|
||||
)
|
||||
|
||||
func (f Gender) Valid() bool {
|
||||
return f >= 0 && f < genderCount
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package mfa
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
mfaEventPrefix = eventstore.EventType("user.human.mfa.")
|
||||
HumanMFAInitSkippedType = mfaEventPrefix + "init.skiped"
|
||||
)
|
||||
|
||||
type InitSkippedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *InitSkippedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewInitSkippedEvent(ctx context.Context) *InitSkippedEvent {
|
||||
return &InitSkippedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAInitSkippedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func InitSkippedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &InitSkippedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package mfa
|
||||
|
||||
type State int32
|
||||
|
||||
const (
|
||||
StateUnspecified State = iota
|
||||
StateNotReady
|
||||
StateReady
|
||||
|
||||
stateCount
|
||||
)
|
||||
|
||||
func (f State) Valid() bool {
|
||||
return f >= 0 && f < stateCount
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
package otp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa"
|
||||
)
|
||||
|
||||
const (
|
||||
otpEventPrefix = eventstore.EventType("user.human.mfa.otp.")
|
||||
HumanMFAOTPAddedType = otpEventPrefix + "added"
|
||||
HumanMFAOTPVerifiedType = otpEventPrefix + "verified"
|
||||
HumanMFAOTPRemovedType = otpEventPrefix + "removed"
|
||||
HumanMFAOTPCheckSucceededType = otpEventPrefix + "check.succeeded"
|
||||
HumanMFAOTPCheckFailedType = otpEventPrefix + "check.failed"
|
||||
)
|
||||
|
||||
type AddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Secret *crypto.CryptoValue `json:"otpSecret,omitempty"`
|
||||
State mfa.State `json:"-"`
|
||||
}
|
||||
|
||||
func (e *AddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewAddedEvent(ctx context.Context,
|
||||
secret *crypto.CryptoValue) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPAddedType,
|
||||
),
|
||||
Secret: secret,
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
otpAdded := &AddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
State: mfa.StateNotReady,
|
||||
}
|
||||
err := json.Unmarshal(event.Data, otpAdded)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-Ns9df", "unable to unmarshal human otp added")
|
||||
}
|
||||
return otpAdded, nil
|
||||
}
|
||||
|
||||
type VerifiedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
State mfa.State `json:"-"`
|
||||
}
|
||||
|
||||
func (e *VerifiedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewVerifiedEvent(ctx context.Context) *VerifiedEvent {
|
||||
return &VerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPVerifiedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func VerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &VerifiedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
State: mfa.StateReady,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *RemovedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewRemovedEvent(ctx context.Context) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPRemovedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &RemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type CheckSucceededEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CheckSucceededEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
return &CheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPCheckSucceededType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func CheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CheckSucceededEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type CheckFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CheckFailedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
return &CheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPCheckFailedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func CheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CheckFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package human
|
||||
|
||||
type NotificationType int32
|
||||
|
||||
const (
|
||||
NotificationTypeEmail NotificationType = iota
|
||||
NotificationTypeSms
|
||||
)
|
||||
@@ -1,80 +0,0 @@
|
||||
package profile
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
const (
|
||||
profileEventPrefix = eventstore.EventType("user.human.profile.")
|
||||
HumanProfileChangedType = profileEventPrefix + "changed"
|
||||
)
|
||||
|
||||
type ChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
NickName string `json:"nickName,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Gender human.Gender `json:"gender,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewChangedEvent(
|
||||
ctx context.Context,
|
||||
current *WriteModel,
|
||||
firstName,
|
||||
lastName,
|
||||
nickName,
|
||||
displayName string,
|
||||
preferredLanguage language.Tag,
|
||||
gender human.Gender,
|
||||
) *ChangedEvent {
|
||||
e := &ChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanProfileChangedType,
|
||||
),
|
||||
}
|
||||
if current.FirstName != firstName {
|
||||
e.FirstName = firstName
|
||||
}
|
||||
if current.LastName != lastName {
|
||||
e.LastName = lastName
|
||||
}
|
||||
if current.NickName != nickName {
|
||||
e.NickName = nickName
|
||||
}
|
||||
if current.DisplayName != displayName {
|
||||
e.DisplayName = displayName
|
||||
}
|
||||
if current.PreferredLanguage != preferredLanguage {
|
||||
e.PreferredLanguage = preferredLanguage
|
||||
}
|
||||
if current.Gender != gender {
|
||||
e.Gender = gender
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
profileChanged := &ChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, profileChanged)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-5M0pd", "unable to unmarshal human profile changed")
|
||||
}
|
||||
|
||||
return profileChanged, nil
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package profile
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
type WriteModel struct {
|
||||
eventstore.WriteModel
|
||||
|
||||
FirstName string
|
||||
LastName string
|
||||
NickName string
|
||||
DisplayName string
|
||||
PreferredLanguage language.Tag
|
||||
Gender human.Gender
|
||||
}
|
||||
+8
-34
@@ -1,4 +1,4 @@
|
||||
package address
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
addressEventPrefix = eventstore.EventType("user.human.address.")
|
||||
addressEventPrefix = humanEventPrefix + "address."
|
||||
HumanAddressChangedType = addressEventPrefix + "changed"
|
||||
)
|
||||
|
||||
type ChangedEvent struct {
|
||||
type HumanAddressChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Country string `json:"country,omitempty"`
|
||||
@@ -23,47 +23,21 @@ type ChangedEvent struct {
|
||||
StreetAddress string `json:"streetAddress,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) Data() interface{} {
|
||||
func (e *HumanAddressChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewChangedEvent(
|
||||
ctx context.Context,
|
||||
current *WriteModel,
|
||||
country,
|
||||
locality,
|
||||
postalCode,
|
||||
region,
|
||||
streetAddress string,
|
||||
) *ChangedEvent {
|
||||
e := &ChangedEvent{
|
||||
func NewHumanAddressChangedEvent(ctx context.Context) *HumanAddressChangedEvent {
|
||||
return &HumanAddressChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanAddressChangedType,
|
||||
),
|
||||
}
|
||||
|
||||
if current.Country != country {
|
||||
e.Country = country
|
||||
}
|
||||
if current.Locality != locality {
|
||||
e.Locality = locality
|
||||
}
|
||||
if current.PostalCode != postalCode {
|
||||
e.PostalCode = postalCode
|
||||
}
|
||||
if current.Region != region {
|
||||
e.Region = region
|
||||
}
|
||||
if current.StreetAddress != streetAddress {
|
||||
e.StreetAddress = streetAddress
|
||||
}
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
addressChanged := &ChangedEvent{
|
||||
func HumanAddressChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
addressChanged := &HumanAddressChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, addressChanged)
|
||||
+33
-41
@@ -1,4 +1,4 @@
|
||||
package email
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
emailEventPrefix = eventstore.EventType("user.human.email.")
|
||||
emailEventPrefix = humanEventPrefix + "email."
|
||||
HumanEmailChangedType = emailEventPrefix + "changed"
|
||||
HumanEmailVerifiedType = emailEventPrefix + "verified"
|
||||
HumanEmailVerificationFailedType = emailEventPrefix + "verification.failed"
|
||||
@@ -19,35 +19,27 @@ const (
|
||||
HumanEmailCodeSentType = emailEventPrefix + "code.sent"
|
||||
)
|
||||
|
||||
type ChangedEvent struct {
|
||||
type HumanEmailChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
EmailAddress string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) Data() interface{} {
|
||||
func (e *HumanEmailChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewChangedEvent(
|
||||
ctx context.Context,
|
||||
current *WriteModel,
|
||||
emailAddress string,
|
||||
) *ChangedEvent {
|
||||
e := &ChangedEvent{
|
||||
func NewHumanEmailChangedEvent(ctx context.Context) *HumanEmailChangedEvent {
|
||||
return &HumanEmailChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanEmailChangedType,
|
||||
),
|
||||
}
|
||||
if current.Email != emailAddress {
|
||||
e.EmailAddress = emailAddress
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
emailChangedEvent := &ChangedEvent{
|
||||
func HumanEmailChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
emailChangedEvent := &HumanEmailChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, emailChangedEvent)
|
||||
@@ -58,18 +50,18 @@ func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error)
|
||||
return emailChangedEvent, nil
|
||||
}
|
||||
|
||||
type VerifiedEvent struct {
|
||||
type HumanEmailVerifiedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
IsEmailVerified bool `json:"-"`
|
||||
}
|
||||
|
||||
func (e *VerifiedEvent) Data() interface{} {
|
||||
func (e *HumanEmailVerifiedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewVerifiedEvent(ctx context.Context) *VerifiedEvent {
|
||||
return &VerifiedEvent{
|
||||
func NewHumanEmailVerifiedEvent(ctx context.Context) *HumanEmailVerifiedEvent {
|
||||
return &HumanEmailVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanEmailVerifiedType,
|
||||
@@ -77,24 +69,24 @@ func NewVerifiedEvent(ctx context.Context) *VerifiedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func VerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
emailVerified := &VerifiedEvent{
|
||||
func HumanEmailVerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
emailVerified := &HumanEmailVerifiedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
IsEmailVerified: true,
|
||||
}
|
||||
return emailVerified, nil
|
||||
}
|
||||
|
||||
type VerificationFailedEvent struct {
|
||||
type HumanEmailVerificationFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *VerificationFailedEvent) Data() interface{} {
|
||||
func (e *HumanEmailVerificationFailedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewVerificationFailedEvent(ctx context.Context) *VerificationFailedEvent {
|
||||
return &VerificationFailedEvent{
|
||||
func NewHumanEmailVerificationFailedEvent(ctx context.Context) *HumanEmailVerificationFailedEvent {
|
||||
return &HumanEmailVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanEmailVerificationFailedType,
|
||||
@@ -102,28 +94,28 @@ func NewVerificationFailedEvent(ctx context.Context) *VerificationFailedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func VerificationFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &VerificationFailedEvent{
|
||||
func HumanEmailVerificationFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanEmailVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type CodeAddedEvent struct {
|
||||
type HumanEmailCodeAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Code *crypto.CryptoValue `json:"code,omitempty"`
|
||||
Expiry time.Duration `json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (e *CodeAddedEvent) Data() interface{} {
|
||||
func (e *HumanEmailCodeAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewCodeAddedEvent(
|
||||
func NewHumanEmailCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration) *CodeAddedEvent {
|
||||
return &CodeAddedEvent{
|
||||
expiry time.Duration) *HumanEmailCodeAddedEvent {
|
||||
return &HumanEmailCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanEmailCodeAddedType,
|
||||
@@ -133,8 +125,8 @@ func NewCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func CodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
codeAdded := &CodeAddedEvent{
|
||||
func HumanEmailCodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
codeAdded := &HumanEmailCodeAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, codeAdded)
|
||||
@@ -145,16 +137,16 @@ func CodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, erro
|
||||
return codeAdded, nil
|
||||
}
|
||||
|
||||
type CodeSentEvent struct {
|
||||
type HumanEmailCodeSentEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CodeSentEvent) Data() interface{} {
|
||||
func (e *HumanEmailCodeSentEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCodeSentEvent(ctx context.Context) *CodeSentEvent {
|
||||
return &CodeSentEvent{
|
||||
func NewHumanEmailCodeSentEvent(ctx context.Context) *HumanEmailCodeSentEvent {
|
||||
return &HumanEmailCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanEmailCodeSentType,
|
||||
@@ -162,8 +154,8 @@ func NewCodeSentEvent(ctx context.Context) *CodeSentEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CodeSentEvent{
|
||||
func HumanEmailCodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanEmailCodeSentEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
+35
-35
@@ -1,4 +1,4 @@
|
||||
package external_idp
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
externalIDPEventPrefix = eventstore.EventType("user.human.externalidp.")
|
||||
externalLoginEventPrefix = eventstore.EventType("user.human.externallogin.")
|
||||
externalIDPEventPrefix = humanEventPrefix + "externalidp."
|
||||
externalLoginEventPrefix = humanEventPrefix + "externallogin."
|
||||
|
||||
//TODO: Handle unique Aggregate
|
||||
HumanExternalIDPReservedType = externalIDPEventPrefix + "reserved"
|
||||
@@ -23,16 +23,16 @@ const (
|
||||
HumanExternalLoginCheckSucceededType = externalLoginEventPrefix + "check.succeeded"
|
||||
)
|
||||
|
||||
type ReservedEvent struct {
|
||||
type HumanExternalIDPReservedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *ReservedEvent) Data() interface{} {
|
||||
func (e *HumanExternalIDPReservedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewReservedEvent(ctx context.Context) *ReservedEvent {
|
||||
return &ReservedEvent{
|
||||
func NewHumanExternalIDPReservedEvent(ctx context.Context) *HumanExternalIDPReservedEvent {
|
||||
return &HumanExternalIDPReservedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanExternalIDPReservedType,
|
||||
@@ -40,16 +40,16 @@ func NewReservedEvent(ctx context.Context) *ReservedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
type ReleasedEvent struct {
|
||||
type HumanExternalIDPReleasedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *ReleasedEvent) Data() interface{} {
|
||||
func (e *HumanExternalIDPReleasedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewReleasedEvent(ctx context.Context) *ReleasedEvent {
|
||||
return &ReleasedEvent{
|
||||
func NewHumanExternalIDPReleasedEvent(ctx context.Context) *HumanExternalIDPReleasedEvent {
|
||||
return &HumanExternalIDPReleasedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanExternalIDPReleasedType,
|
||||
@@ -57,19 +57,19 @@ func NewReleasedEvent(ctx context.Context) *ReleasedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
type AddedEvent struct {
|
||||
type HumanExternalIDPAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
IDPConfigID string `json:"idpConfigId,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
}
|
||||
|
||||
func (e *AddedEvent) Data() interface{} {
|
||||
func (e *HumanExternalIDPAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewAddedEvent(ctx context.Context, idpConfigID, displayName string) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
func NewHumanExternalIDPAddedEvent(ctx context.Context, idpConfigID, displayName string) *HumanExternalIDPAddedEvent {
|
||||
return &HumanExternalIDPAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanExternalIDPAddedType,
|
||||
@@ -79,8 +79,8 @@ func NewAddedEvent(ctx context.Context, idpConfigID, displayName string) *AddedE
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &AddedEvent{
|
||||
func HumanExternalIDPAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &HumanExternalIDPAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
@@ -92,18 +92,18 @@ func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return e, nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
type HumanExternalIDPRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
IDPConfigID string `json:"idpConfigId"`
|
||||
}
|
||||
|
||||
func (e *RemovedEvent) Data() interface{} {
|
||||
func (e *HumanExternalIDPRemovedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewRemovedEvent(ctx context.Context, idpConfigID string) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
func NewHumanExternalIDPRemovedEvent(ctx context.Context, idpConfigID string) *HumanExternalIDPRemovedEvent {
|
||||
return &HumanExternalIDPRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanExternalIDPRemovedType,
|
||||
@@ -112,8 +112,8 @@ func NewRemovedEvent(ctx context.Context, idpConfigID string) *RemovedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &RemovedEvent{
|
||||
func HumanExternalIDPRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &HumanExternalIDPRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
@@ -125,18 +125,18 @@ func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error)
|
||||
return e, nil
|
||||
}
|
||||
|
||||
type CascadeRemovedEvent struct {
|
||||
type HumanExternalIDPCascadeRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
IDPConfigID string `json:"idpConfigId"`
|
||||
}
|
||||
|
||||
func (e *CascadeRemovedEvent) Data() interface{} {
|
||||
func (e *HumanExternalIDPCascadeRemovedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewCascadeRemovedEvent(ctx context.Context, idpConfigID string) *CascadeRemovedEvent {
|
||||
return &CascadeRemovedEvent{
|
||||
func NewHumanExternalIDPCascadeRemovedEvent(ctx context.Context, idpConfigID string) *HumanExternalIDPCascadeRemovedEvent {
|
||||
return &HumanExternalIDPCascadeRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanExternalIDPCascadeRemovedType,
|
||||
@@ -145,8 +145,8 @@ func NewCascadeRemovedEvent(ctx context.Context, idpConfigID string) *CascadeRem
|
||||
}
|
||||
}
|
||||
|
||||
func CascadeRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &CascadeRemovedEvent{
|
||||
func HumanExternalIDPCascadeRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
e := &HumanExternalIDPCascadeRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
|
||||
@@ -158,16 +158,16 @@ func CascadeRemovedEventMapper(event *repository.Event) (eventstore.EventReader,
|
||||
return e, nil
|
||||
}
|
||||
|
||||
type CheckSucceededEvent struct {
|
||||
type HumanExternalIDPCheckSucceededEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CheckSucceededEvent) Data() interface{} {
|
||||
func (e *HumanExternalIDPCheckSucceededEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
return &CheckSucceededEvent{
|
||||
func NewHumanExternalIDPCheckSucceededEvent(ctx context.Context) *HumanExternalIDPCheckSucceededEvent {
|
||||
return &HumanExternalIDPCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanExternalLoginCheckSucceededType,
|
||||
@@ -175,8 +175,8 @@ func NewCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CheckSucceededEvent{
|
||||
func HumanExternalIDPCheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanExternalIDPCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
mfaEventPrefix = humanEventPrefix + "mfa."
|
||||
HumanMFAInitSkippedType = mfaEventPrefix + "init.skiped"
|
||||
)
|
||||
|
||||
type HumanMFAInitSkippedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *HumanMFAInitSkippedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewHumanMFAInitSkippedEvent(ctx context.Context) *HumanMFAInitSkippedEvent {
|
||||
return &HumanMFAInitSkippedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAInitSkippedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HumanMFAInitSkippedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanMFAInitSkippedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
)
|
||||
|
||||
const (
|
||||
otpEventPrefix = mfaEventPrefix + "otp."
|
||||
HumanMFAOTPAddedType = otpEventPrefix + "added"
|
||||
HumanMFAOTPVerifiedType = otpEventPrefix + "verified"
|
||||
HumanMFAOTPRemovedType = otpEventPrefix + "removed"
|
||||
HumanMFAOTPCheckSucceededType = otpEventPrefix + "check.succeeded"
|
||||
HumanMFAOTPCheckFailedType = otpEventPrefix + "check.failed"
|
||||
)
|
||||
|
||||
type HumanOTPAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Secret *crypto.CryptoValue `json:"otpSecret,omitempty"`
|
||||
State domain.MFAState `json:"-"`
|
||||
}
|
||||
|
||||
func (e *HumanOTPAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewHumanOTPAddedEvent(ctx context.Context,
|
||||
secret *crypto.CryptoValue) *HumanOTPAddedEvent {
|
||||
return &HumanOTPAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPAddedType,
|
||||
),
|
||||
Secret: secret,
|
||||
}
|
||||
}
|
||||
|
||||
func HumanOTPAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
otpAdded := &HumanOTPAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
State: domain.MFAStateNotReady,
|
||||
}
|
||||
err := json.Unmarshal(event.Data, otpAdded)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-Ns9df", "unable to unmarshal human otp added")
|
||||
}
|
||||
return otpAdded, nil
|
||||
}
|
||||
|
||||
type HumanOTPVerifiedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
State domain.MFAState `json:"-"`
|
||||
}
|
||||
|
||||
func (e *HumanOTPVerifiedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewHumanOTPVerifiedEvent(ctx context.Context) *HumanOTPVerifiedEvent {
|
||||
return &HumanOTPVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPVerifiedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HumanOTPVerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanOTPVerifiedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
State: domain.MFAStateReady,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type HumanOTPRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *HumanOTPRemovedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewHumanOTPRemovedEvent(ctx context.Context) *HumanOTPRemovedEvent {
|
||||
return &HumanOTPRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPRemovedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HumanOTPRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanOTPRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type HumanOTPCheckSucceededEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *HumanOTPCheckSucceededEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewHumanOTPCheckSucceededEvent(ctx context.Context) *HumanOTPCheckSucceededEvent {
|
||||
return &HumanOTPCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPCheckSucceededType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HumanOTPCheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanOTPCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type HumanOTPCheckFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *HumanOTPCheckFailedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewHumanOTPCheckFailedEvent(ctx context.Context) *HumanOTPCheckFailedEvent {
|
||||
return &HumanOTPCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanMFAOTPCheckFailedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HumanOTPCheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanOTPCheckFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
+88
-88
@@ -1,4 +1,4 @@
|
||||
package web_auth_n
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
)
|
||||
|
||||
const (
|
||||
u2fEventPrefix = eventstore.EventType("user.human.mfa.u2f.token.")
|
||||
u2fEventPrefix = mfaEventPrefix + "u2f.token."
|
||||
HumanU2FTokenAddedType = u2fEventPrefix + "added"
|
||||
HumanU2FTokenVerifiedType = u2fEventPrefix + "verified"
|
||||
HumanU2FTokenSignCountChangedType = u2fEventPrefix + "signcount.changed"
|
||||
@@ -19,7 +19,7 @@ const (
|
||||
HumanU2FTokenCheckSucceededType = u2fEventPrefix + "check.succeeded"
|
||||
HumanU2FTokenCheckFailedType = u2fEventPrefix + "check.failed"
|
||||
|
||||
passwordlessEventPrefix = eventstore.EventType("user.human.mfa.passwordless.token.")
|
||||
passwordlessEventPrefix = humanEventPrefix + "passwordless.token."
|
||||
HumanPasswordlessTokenAddedType = passwordlessEventPrefix + "added"
|
||||
HumanPasswordlessTokenVerifiedType = passwordlessEventPrefix + "verified"
|
||||
HumanPasswordlessTokenSignCountChangedType = passwordlessEventPrefix + "signcount.changed"
|
||||
@@ -29,24 +29,24 @@ const (
|
||||
HumanPasswordlessTokenCheckFailedType = passwordlessEventPrefix + "check.failed"
|
||||
)
|
||||
|
||||
type AddedEvent struct {
|
||||
type HumanWebAuthNAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
Challenge string `json:"challenge"`
|
||||
State mfa.State `json:"-"`
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
Challenge string `json:"challenge"`
|
||||
State domain.MFAState `json:"-"`
|
||||
}
|
||||
|
||||
func (e *AddedEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FAddedEvent(
|
||||
func NewHumanU2FAddedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID,
|
||||
challenge string,
|
||||
) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
) *HumanWebAuthNAddedEvent {
|
||||
return &HumanWebAuthNAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenAddedType,
|
||||
@@ -56,12 +56,12 @@ func NewU2FAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessAddedEvent(
|
||||
func NewHumanPasswordlessAddedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID,
|
||||
challenge string,
|
||||
) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
) *HumanWebAuthNAddedEvent {
|
||||
return &HumanWebAuthNAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenAddedType,
|
||||
@@ -71,10 +71,10 @@ func NewPasswordlessAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &AddedEvent{
|
||||
func WebAuthNAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &HumanWebAuthNAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
State: mfa.StateNotReady,
|
||||
State: domain.MFAStateNotReady,
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webAuthNAdded)
|
||||
if err != nil {
|
||||
@@ -83,24 +83,24 @@ func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return webAuthNAdded, nil
|
||||
}
|
||||
|
||||
type VerifiedEvent struct {
|
||||
type HumanWebAuthNVerifiedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
KeyID []byte `json:"keyId"`
|
||||
PublicKey []byte `json:"publicKey"`
|
||||
AttestationType string `json:"attestationType"`
|
||||
AAGUID []byte `json:"aaguid"`
|
||||
SignCount uint32 `json:"signCount"`
|
||||
WebAuthNTokenName string `json:"webAuthNTokenName"`
|
||||
State mfa.State `json:"-"`
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
KeyID []byte `json:"keyId"`
|
||||
PublicKey []byte `json:"publicKey"`
|
||||
AttestationType string `json:"attestationType"`
|
||||
AAGUID []byte `json:"aaguid"`
|
||||
SignCount uint32 `json:"signCount"`
|
||||
WebAuthNTokenName string `json:"webAuthNTokenName"`
|
||||
State domain.MFAState `json:"-"`
|
||||
}
|
||||
|
||||
func (e *VerifiedEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNVerifiedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FVerifiedEvent(
|
||||
func NewHumanU2FVerifiedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID,
|
||||
webAuthNTokenName,
|
||||
@@ -109,8 +109,8 @@ func NewU2FVerifiedEvent(
|
||||
publicKey,
|
||||
aaguid []byte,
|
||||
signCount uint32,
|
||||
) *VerifiedEvent {
|
||||
return &VerifiedEvent{
|
||||
) *HumanWebAuthNVerifiedEvent {
|
||||
return &HumanWebAuthNVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenVerifiedType,
|
||||
@@ -125,7 +125,7 @@ func NewU2FVerifiedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessVerifiedEvent(
|
||||
func NewHumanPasswordlessVerifiedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID,
|
||||
webAuthNTokenName,
|
||||
@@ -134,8 +134,8 @@ func NewPasswordlessVerifiedEvent(
|
||||
publicKey,
|
||||
aaguid []byte,
|
||||
signCount uint32,
|
||||
) *VerifiedEvent {
|
||||
return &VerifiedEvent{
|
||||
) *HumanWebAuthNVerifiedEvent {
|
||||
return &HumanWebAuthNVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenVerifiedType,
|
||||
@@ -150,10 +150,10 @@ func NewPasswordlessVerifiedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func VerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webauthNVerified := &VerifiedEvent{
|
||||
func HumanWebAuthNVerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webauthNVerified := &HumanWebAuthNVerifiedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
State: mfa.StateReady,
|
||||
State: domain.MFAStateReady,
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webauthNVerified)
|
||||
if err != nil {
|
||||
@@ -162,24 +162,24 @@ func VerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error
|
||||
return webauthNVerified, nil
|
||||
}
|
||||
|
||||
type SignCountChangedEvent struct {
|
||||
type HumanWebAuthNSignCountChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
SignCount uint32 `json:"signCount"`
|
||||
State mfa.State `json:"-"`
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
SignCount uint32 `json:"signCount"`
|
||||
State domain.MFAState `json:"-"`
|
||||
}
|
||||
|
||||
func (e *SignCountChangedEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNSignCountChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FSignCountChangedEvent(
|
||||
func NewHumanU2FSignCountChangedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID string,
|
||||
signCount uint32,
|
||||
) *SignCountChangedEvent {
|
||||
return &SignCountChangedEvent{
|
||||
) *HumanWebAuthNSignCountChangedEvent {
|
||||
return &HumanWebAuthNSignCountChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenSignCountChangedType,
|
||||
@@ -189,12 +189,12 @@ func NewU2FSignCountChangedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessSignCountChangedEvent(
|
||||
func NewHumanPasswordlessSignCountChangedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID string,
|
||||
signCount uint32,
|
||||
) *SignCountChangedEvent {
|
||||
return &SignCountChangedEvent{
|
||||
) *HumanWebAuthNSignCountChangedEvent {
|
||||
return &HumanWebAuthNSignCountChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenSignCountChangedType,
|
||||
@@ -204,8 +204,8 @@ func NewPasswordlessSignCountChangedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func SignCountChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webauthNVerified := &SignCountChangedEvent{
|
||||
func HumanWebAuthNSignCountChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webauthNVerified := &HumanWebAuthNSignCountChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webauthNVerified)
|
||||
@@ -215,22 +215,22 @@ func SignCountChangedEventMapper(event *repository.Event) (eventstore.EventReade
|
||||
return webauthNVerified, nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
type HumanWebAuthNRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
State mfa.State `json:"-"`
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
State domain.MFAState `json:"-"`
|
||||
}
|
||||
|
||||
func (e *RemovedEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNRemovedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FRemovedEvent(
|
||||
func NewHumanU2FRemovedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID string,
|
||||
) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
) *HumanWebAuthNRemovedEvent {
|
||||
return &HumanWebAuthNRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenRemovedType,
|
||||
@@ -239,11 +239,11 @@ func NewU2FRemovedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessRemovedEvent(
|
||||
func NewHumanPasswordlessRemovedEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID string,
|
||||
) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
) *HumanWebAuthNRemovedEvent {
|
||||
return &HumanWebAuthNRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenRemovedType,
|
||||
@@ -252,8 +252,8 @@ func NewPasswordlessRemovedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webauthNVerified := &RemovedEvent{
|
||||
func HumanWebAuthNRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webauthNVerified := &HumanWebAuthNRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webauthNVerified)
|
||||
@@ -263,7 +263,7 @@ func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error)
|
||||
return webauthNVerified, nil
|
||||
}
|
||||
|
||||
type BeginLoginEvent struct {
|
||||
type HumanWebAuthNBeginLoginEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
WebAuthNTokenID string `json:"webAuthNTokenId"`
|
||||
@@ -272,16 +272,16 @@ type BeginLoginEvent struct {
|
||||
//*AuthRequest
|
||||
}
|
||||
|
||||
func (e *BeginLoginEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNBeginLoginEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FBeginLoginEvent(
|
||||
func NewHumanU2FBeginLoginEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID,
|
||||
challenge string,
|
||||
) *BeginLoginEvent {
|
||||
return &BeginLoginEvent{
|
||||
) *HumanWebAuthNBeginLoginEvent {
|
||||
return &HumanWebAuthNBeginLoginEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenRemovedType,
|
||||
@@ -291,12 +291,12 @@ func NewU2FBeginLoginEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessBeginLoginEvent(
|
||||
func NewHumanPasswordlessBeginLoginEvent(
|
||||
ctx context.Context,
|
||||
webAuthNTokenID,
|
||||
challenge string,
|
||||
) *BeginLoginEvent {
|
||||
return &BeginLoginEvent{
|
||||
) *HumanWebAuthNBeginLoginEvent {
|
||||
return &HumanWebAuthNBeginLoginEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenRemovedType,
|
||||
@@ -306,8 +306,8 @@ func NewPasswordlessBeginLoginEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func BeginLoginEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &BeginLoginEvent{
|
||||
func HumanWebAuthNBeginLoginEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &HumanWebAuthNBeginLoginEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webAuthNAdded)
|
||||
@@ -317,19 +317,19 @@ func BeginLoginEventMapper(event *repository.Event) (eventstore.EventReader, err
|
||||
return webAuthNAdded, nil
|
||||
}
|
||||
|
||||
type CheckSucceededEvent struct {
|
||||
type HumanWebAuthNCheckSucceededEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
//TODO: Handle Auth Req??
|
||||
//*AuthRequest
|
||||
}
|
||||
|
||||
func (e *CheckSucceededEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNCheckSucceededEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
return &CheckSucceededEvent{
|
||||
func NewHumanU2FCheckSucceededEvent(ctx context.Context) *HumanWebAuthNCheckSucceededEvent {
|
||||
return &HumanWebAuthNCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenCheckSucceededType,
|
||||
@@ -337,8 +337,8 @@ func NewU2FCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
return &CheckSucceededEvent{
|
||||
func NewHumanPasswordlessCheckSucceededEvent(ctx context.Context) *HumanWebAuthNCheckSucceededEvent {
|
||||
return &HumanWebAuthNCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenCheckSucceededType,
|
||||
@@ -346,8 +346,8 @@ func NewPasswordlessCheckSucceededEvent(ctx context.Context) *CheckSucceededEven
|
||||
}
|
||||
}
|
||||
|
||||
func CheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &CheckSucceededEvent{
|
||||
func HumanWebAuthNCheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &HumanWebAuthNCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webAuthNAdded)
|
||||
@@ -357,19 +357,19 @@ func CheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader,
|
||||
return webAuthNAdded, nil
|
||||
}
|
||||
|
||||
type CheckFailedEvent struct {
|
||||
type HumanWebAuthNCheckFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
//TODO: Handle Auth Req??
|
||||
//*AuthRequest
|
||||
}
|
||||
|
||||
func (e *CheckFailedEvent) Data() interface{} {
|
||||
func (e *HumanWebAuthNCheckFailedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewU2FCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
return &CheckFailedEvent{
|
||||
func NewHumanU2FCheckFailedEvent(ctx context.Context) *HumanWebAuthNCheckFailedEvent {
|
||||
return &HumanWebAuthNCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanU2FTokenCheckFailedType,
|
||||
@@ -377,8 +377,8 @@ func NewU2FCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewPasswordlessCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
return &CheckFailedEvent{
|
||||
func NewHumanPasswordlessCheckFailedEvent(ctx context.Context) *HumanWebAuthNCheckFailedEvent {
|
||||
return &HumanWebAuthNCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordlessTokenCheckFailedType,
|
||||
@@ -386,8 +386,8 @@ func NewPasswordlessCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &CheckFailedEvent{
|
||||
func HumanWebAuthNCheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
webAuthNAdded := &HumanWebAuthNCheckFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, webAuthNAdded)
|
||||
+39
-39
@@ -1,4 +1,4 @@
|
||||
package password
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
passwordEventPrefix = eventstore.EventType("user.human.password.")
|
||||
passwordEventPrefix = humanEventPrefix + "password."
|
||||
HumanPasswordChangedType = passwordEventPrefix + "changed"
|
||||
HumanPasswordCodeAddedType = passwordEventPrefix + "code.added"
|
||||
HumanPasswordCodeSentType = passwordEventPrefix + "code.sent"
|
||||
@@ -20,23 +20,23 @@ const (
|
||||
HumanPasswordCheckFailedType = passwordEventPrefix + "check.failed"
|
||||
)
|
||||
|
||||
type ChangedEvent struct {
|
||||
type HumanPasswordChangedChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Secret *crypto.CryptoValue `json:"secret,omitempty"`
|
||||
ChangeRequired bool `json:"changeRequired,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) Data() interface{} {
|
||||
func (e *HumanPasswordChangedChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewChangedEvent(
|
||||
func NewHumanPasswordChangedEvent(
|
||||
ctx context.Context,
|
||||
secret *crypto.CryptoValue,
|
||||
changeRequired bool,
|
||||
) *ChangedEvent {
|
||||
return &ChangedEvent{
|
||||
) *HumanPasswordChangedChangedEvent {
|
||||
return &HumanPasswordChangedChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordChangedType,
|
||||
@@ -46,8 +46,8 @@ func NewChangedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanAdded := &ChangedEvent{
|
||||
func HumanPasswordChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanAdded := &HumanPasswordChangedChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, humanAdded)
|
||||
@@ -58,25 +58,25 @@ func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error)
|
||||
return humanAdded, nil
|
||||
}
|
||||
|
||||
type CodeAddedEvent struct {
|
||||
type HumanPasswordCodeAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Code *crypto.CryptoValue `json:"code,omitempty"`
|
||||
Expiry time.Duration `json:"expiry,omitempty"`
|
||||
NotificationType human.NotificationType `json:"notificationType,omitempty"`
|
||||
Code *crypto.CryptoValue `json:"code,omitempty"`
|
||||
Expiry time.Duration `json:"expiry,omitempty"`
|
||||
NotificationType domain.NotificationType `json:"notificationType,omitempty"`
|
||||
}
|
||||
|
||||
func (e *CodeAddedEvent) Data() interface{} {
|
||||
func (e *HumanPasswordCodeAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewPasswordCodeAddedEvent(
|
||||
func NewHumanPasswordCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
notificationType human.NotificationType,
|
||||
) *CodeAddedEvent {
|
||||
return &CodeAddedEvent{
|
||||
notificationType domain.NotificationType,
|
||||
) *HumanPasswordCodeAddedEvent {
|
||||
return &HumanPasswordCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordCodeAddedType,
|
||||
@@ -87,8 +87,8 @@ func NewPasswordCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func CodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanAdded := &CodeAddedEvent{
|
||||
func HumanPasswordCodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
humanAdded := &HumanPasswordCodeAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, humanAdded)
|
||||
@@ -99,16 +99,16 @@ func CodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, erro
|
||||
return humanAdded, nil
|
||||
}
|
||||
|
||||
type CodeSentEvent struct {
|
||||
type HumanPasswordCodeSentEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CodeSentEvent) Data() interface{} {
|
||||
func (e *HumanPasswordCodeSentEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCodeSentEvent(ctx context.Context) *CodeSentEvent {
|
||||
return &CodeSentEvent{
|
||||
func NewHumanPasswordCodeSentEvent(ctx context.Context) *HumanPasswordCodeSentEvent {
|
||||
return &HumanPasswordCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordCodeSentType,
|
||||
@@ -116,22 +116,22 @@ func NewCodeSentEvent(ctx context.Context) *CodeSentEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CodeSentEvent{
|
||||
func HumanPasswordCodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPasswordCodeSentEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type CheckSucceededEvent struct {
|
||||
type HumanPasswordCheckSucceededEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CheckSucceededEvent) Data() interface{} {
|
||||
func (e *HumanPasswordCheckSucceededEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
return &CheckSucceededEvent{
|
||||
func NewHumanPasswordCheckSucceededEvent(ctx context.Context) *HumanPasswordCheckSucceededEvent {
|
||||
return &HumanPasswordCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordCheckSucceededType,
|
||||
@@ -139,22 +139,22 @@ func NewCheckSucceededEvent(ctx context.Context) *CheckSucceededEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CheckSucceededEvent{
|
||||
func HumanPasswordCheckSucceededEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPasswordCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type CheckFailedEvent struct {
|
||||
type HumanPasswordCheckFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CheckFailedEvent) Data() interface{} {
|
||||
func (e *HumanPasswordCheckFailedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
return &CheckFailedEvent{
|
||||
func NewHumanPasswordCheckFailedEvent(ctx context.Context) *HumanPasswordCheckFailedEvent {
|
||||
return &HumanPasswordCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPasswordCheckFailedType,
|
||||
@@ -162,8 +162,8 @@ func NewCheckFailedEvent(ctx context.Context) *CheckFailedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CheckFailedEvent{
|
||||
func HumanPasswordCheckFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPasswordCheckFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
+39
-39
@@ -1,4 +1,4 @@
|
||||
package phone
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
phoneEventPrefix = eventstore.EventType("user.human.phone.")
|
||||
phoneEventPrefix = humanEventPrefix + "phone."
|
||||
HumanPhoneChangedType = phoneEventPrefix + "changed"
|
||||
HumanPhoneRemovedType = phoneEventPrefix + "removed"
|
||||
HumanPhoneVerifiedType = phoneEventPrefix + "verified"
|
||||
@@ -20,18 +20,18 @@ const (
|
||||
HumanPhoneCodeSentType = phoneEventPrefix + "code.sent"
|
||||
)
|
||||
|
||||
type ChangedEvent struct {
|
||||
type HumanPhoneChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
PhoneNumber string `json:"phone,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) Data() interface{} {
|
||||
func (e *HumanPhoneChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewChangedEvent(ctx context.Context, phone string) *ChangedEvent {
|
||||
return &ChangedEvent{
|
||||
func NewHumanPhoneChangedEvent(ctx context.Context, phone string) *HumanPhoneChangedEvent {
|
||||
return &HumanPhoneChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPhoneChangedType,
|
||||
@@ -40,8 +40,8 @@ func NewChangedEvent(ctx context.Context, phone string) *ChangedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
phoneChangedEvent := &ChangedEvent{
|
||||
func HumanPhoneChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
phoneChangedEvent := &HumanPhoneChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, phoneChangedEvent)
|
||||
@@ -52,16 +52,16 @@ func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error)
|
||||
return phoneChangedEvent, nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
type HumanPhoneRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *RemovedEvent) Data() interface{} {
|
||||
func (e *HumanPhoneRemovedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewRemovedEvent(ctx context.Context) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
func NewHumanPhoneRemovedEvent(ctx context.Context) *HumanPhoneRemovedEvent {
|
||||
return &HumanPhoneRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPhoneRemovedType,
|
||||
@@ -69,24 +69,24 @@ func NewRemovedEvent(ctx context.Context) *RemovedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &ChangedEvent{
|
||||
func HumanPhoneRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPhoneChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type VerifiedEvent struct {
|
||||
type HumanPhoneVerifiedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
IsPhoneVerified bool `json:"-"`
|
||||
}
|
||||
|
||||
func (e *VerifiedEvent) Data() interface{} {
|
||||
func (e *HumanPhoneVerifiedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewVerifiedEvent(ctx context.Context) *VerifiedEvent {
|
||||
return &VerifiedEvent{
|
||||
func NewHumanPhoneVerifiedEvent(ctx context.Context) *HumanPhoneVerifiedEvent {
|
||||
return &HumanPhoneVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPhoneVerifiedType,
|
||||
@@ -94,23 +94,23 @@ func NewVerifiedEvent(ctx context.Context) *VerifiedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func VerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &VerifiedEvent{
|
||||
func HumanPhoneVerifiedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPhoneVerifiedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
IsPhoneVerified: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type VerificationFailedEvent struct {
|
||||
type HumanPhoneVerificationFailedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *VerificationFailedEvent) Data() interface{} {
|
||||
func (e *HumanPhoneVerificationFailedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewVerificationFailedEvent(ctx context.Context) *VerificationFailedEvent {
|
||||
return &VerificationFailedEvent{
|
||||
func NewHumanPhoneVerificationFailedEvent(ctx context.Context) *HumanPhoneVerificationFailedEvent {
|
||||
return &HumanPhoneVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPhoneVerificationFailedType,
|
||||
@@ -118,29 +118,29 @@ func NewVerificationFailedEvent(ctx context.Context) *VerificationFailedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func VerificationFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &VerificationFailedEvent{
|
||||
func HumanPhoneVerificationFailedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPhoneVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type CodeAddedEvent struct {
|
||||
type HumanPhoneCodeAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
Code *crypto.CryptoValue `json:"code,omitempty"`
|
||||
Expiry time.Duration `json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (e *CodeAddedEvent) Data() interface{} {
|
||||
func (e *HumanPhoneCodeAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewCodeAddedEvent(
|
||||
func NewHumanPhoneCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
) *CodeAddedEvent {
|
||||
return &CodeAddedEvent{
|
||||
) *HumanPhoneCodeAddedEvent {
|
||||
return &HumanPhoneCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPhoneCodeAddedType,
|
||||
@@ -150,8 +150,8 @@ func NewCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func CodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
codeAdded := &CodeAddedEvent{
|
||||
func HumanPhoneCodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
codeAdded := &HumanPhoneCodeAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, codeAdded)
|
||||
@@ -162,16 +162,16 @@ func CodeAddedEventMapper(event *repository.Event) (eventstore.EventReader, erro
|
||||
return codeAdded, nil
|
||||
}
|
||||
|
||||
type CodeSentEvent struct {
|
||||
type HumanPhoneCodeSentEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *CodeSentEvent) Data() interface{} {
|
||||
func (e *HumanPhoneCodeSentEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewCodeSentEvent(ctx context.Context) *CodeSentEvent {
|
||||
return &CodeSentEvent{
|
||||
func NewHumanPhoneCodeSentEvent(ctx context.Context) *HumanPhoneCodeSentEvent {
|
||||
return &HumanPhoneCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanPhoneCodeSentType,
|
||||
@@ -179,8 +179,8 @@ func NewCodeSentEvent(ctx context.Context) *CodeSentEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func CodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &CodeSentEvent{
|
||||
func HumanPhoneCodeSentEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &HumanPhoneCodeSentEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
const (
|
||||
profileEventPrefix = humanEventPrefix + "profile."
|
||||
HumanProfileChangedType = profileEventPrefix + "changed"
|
||||
)
|
||||
|
||||
type HumanProfileChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
FirstName string `json:"firstName,omitempty"`
|
||||
LastName string `json:"lastName,omitempty"`
|
||||
NickName string `json:"nickName,omitempty"`
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Gender domain.Gender `json:"gender,omitempty"`
|
||||
}
|
||||
|
||||
func (e *HumanProfileChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewHumanProfileChangedEvent(ctx context.Context) *HumanProfileChangedEvent {
|
||||
return &HumanProfileChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
HumanProfileChangedType,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func HumanProfileChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
profileChanged := &HumanProfileChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, profileChanged)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-5M0pd", "unable to unmarshal human profile changed")
|
||||
}
|
||||
|
||||
return profileChanged, nil
|
||||
}
|
||||
+16
-22
@@ -1,4 +1,4 @@
|
||||
package machine
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
machineEventPrefix = eventstore.EventType("user.machine.")
|
||||
machineEventPrefix = userEventTypePrefix + "machine."
|
||||
MachineAddedEventType = machineEventPrefix + "added"
|
||||
MachineChangedEventType = machineEventPrefix + "changed"
|
||||
)
|
||||
|
||||
type AddedEvent struct {
|
||||
type MachineAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserName string `json:"userName"`
|
||||
@@ -23,17 +23,17 @@ type AddedEvent struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (e *AddedEvent) Data() interface{} {
|
||||
func (e *MachineAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewAddedEvent(
|
||||
func NewMachineAddedEvent(
|
||||
ctx context.Context,
|
||||
userName,
|
||||
name,
|
||||
description string,
|
||||
) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
) *MachineAddedEvent {
|
||||
return &MachineAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
MachineAddedEventType,
|
||||
@@ -44,8 +44,8 @@ func NewAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineAdded := &AddedEvent{
|
||||
func MachineAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineAdded := &MachineAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, machineAdded)
|
||||
@@ -56,7 +56,7 @@ func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return machineAdded, nil
|
||||
}
|
||||
|
||||
type ChangedEvent struct {
|
||||
type MachineChangedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
UserName string `json:"userName"`
|
||||
@@ -65,29 +65,23 @@ type ChangedEvent struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
func (e *ChangedEvent) Data() interface{} {
|
||||
func (e *MachineChangedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewChangedEvent(
|
||||
func NewMachineChangedEvent(
|
||||
ctx context.Context,
|
||||
userName,
|
||||
name,
|
||||
description string,
|
||||
) *ChangedEvent {
|
||||
return &ChangedEvent{
|
||||
) *MachineChangedEvent {
|
||||
return &MachineChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
MachineChangedEventType,
|
||||
),
|
||||
UserName: userName,
|
||||
Name: name,
|
||||
Description: description,
|
||||
}
|
||||
}
|
||||
|
||||
func ChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineChanged := &ChangedEvent{
|
||||
func MachineChangedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineChanged := &MachineChangedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, machineChanged)
|
||||
@@ -1,95 +0,0 @@
|
||||
package keys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
machineKeyEventPrefix = eventstore.EventType("user.machine.key.")
|
||||
MachineKeyAddedEventType = machineKeyEventPrefix + "added"
|
||||
MachineKeyRemovedEventType = machineKeyEventPrefix + "removed"
|
||||
)
|
||||
|
||||
type AddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
KeyID string `json:"keyId,omitempty"`
|
||||
Type MachineKeyType `json:"type,omitempty"`
|
||||
ExpirationDate time.Time `json:"expirationDate,omitempty"`
|
||||
PublicKey []byte `json:"publicKey,omitempty"`
|
||||
}
|
||||
|
||||
func (e *AddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewAddedEvent(
|
||||
ctx context.Context,
|
||||
keyID string,
|
||||
keyType MachineKeyType,
|
||||
expirationDate time.Time,
|
||||
publicKey []byte,
|
||||
) *AddedEvent {
|
||||
return &AddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
MachineKeyAddedEventType,
|
||||
),
|
||||
KeyID: keyID,
|
||||
Type: keyType,
|
||||
ExpirationDate: expirationDate,
|
||||
PublicKey: publicKey,
|
||||
}
|
||||
}
|
||||
|
||||
func AddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineAdded := &AddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, machineAdded)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-rEs8f", "unable to unmarshal machine key added")
|
||||
}
|
||||
|
||||
return machineAdded, nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
KeyID string `json:"keyId,omitempty"`
|
||||
}
|
||||
|
||||
func (e *RemovedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewRemovedEvent(
|
||||
ctx context.Context,
|
||||
keyID string,
|
||||
) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
MachineKeyRemovedEventType,
|
||||
),
|
||||
KeyID: keyID,
|
||||
}
|
||||
}
|
||||
|
||||
func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineRemoved := &RemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, machineRemoved)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-5Gm9s", "unable to unmarshal machine key removed")
|
||||
}
|
||||
|
||||
return machineRemoved, nil
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package keys
|
||||
|
||||
type MachineKeyType int32
|
||||
|
||||
const (
|
||||
MachineKeyTypeNONE = iota
|
||||
MachineKeyTypeJSON
|
||||
|
||||
keyCount
|
||||
)
|
||||
|
||||
func (f MachineKeyType) Valid() bool {
|
||||
return f >= 0 && f < keyCount
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2/repository"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
machineKeyEventPrefix = machineEventPrefix + "key."
|
||||
MachineKeyAddedEventType = machineKeyEventPrefix + "added"
|
||||
MachineKeyRemovedEventType = machineKeyEventPrefix + "removed"
|
||||
)
|
||||
|
||||
type MachineKeyAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
KeyID string `json:"keyId,omitempty"`
|
||||
KeyType domain.MachineKeyType `json:"type,omitempty"`
|
||||
ExpirationDate time.Time `json:"expirationDate,omitempty"`
|
||||
PublicKey []byte `json:"publicKey,omitempty"`
|
||||
}
|
||||
|
||||
func (e *MachineKeyAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewMachineKeyAddedEvent(
|
||||
ctx context.Context,
|
||||
keyID string,
|
||||
keyType domain.MachineKeyType,
|
||||
expirationDate time.Time,
|
||||
publicKey []byte,
|
||||
) *MachineKeyAddedEvent {
|
||||
return &MachineKeyAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
MachineKeyAddedEventType,
|
||||
),
|
||||
KeyID: keyID,
|
||||
KeyType: keyType,
|
||||
ExpirationDate: expirationDate,
|
||||
PublicKey: publicKey,
|
||||
}
|
||||
}
|
||||
|
||||
func MachineKeyAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineKeyAdded := &MachineKeyAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, machineKeyAdded)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-p0ovS", "unable to unmarshal machine key removed")
|
||||
}
|
||||
|
||||
return machineKeyAdded, nil
|
||||
}
|
||||
|
||||
type MachineKeyRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
KeyID string `json:"keyId,omitempty"`
|
||||
}
|
||||
|
||||
func (e *MachineKeyRemovedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewMachineKeyRemovedEvent(
|
||||
ctx context.Context,
|
||||
keyID string,
|
||||
) *MachineKeyRemovedEvent {
|
||||
return &MachineKeyRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
MachineKeyRemovedEventType,
|
||||
),
|
||||
KeyID: keyID,
|
||||
}
|
||||
}
|
||||
|
||||
func MachineKeyRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
machineRemoved := &MachineKeyRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, machineRemoved)
|
||||
if err != nil {
|
||||
return nil, errors.ThrowInternal(err, "USER-5Gm9s", "unable to unmarshal machine key removed")
|
||||
}
|
||||
|
||||
return machineRemoved, nil
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
)
|
||||
|
||||
type ReadModel struct {
|
||||
eventstore.ReadModel
|
||||
}
|
||||
|
||||
func NewReadModel(id string) *ReadModel {
|
||||
return &ReadModel{
|
||||
ReadModel: eventstore.ReadModel{
|
||||
AggregateID: id,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
rm.ReadModel.AppendEvents(events...)
|
||||
for _, event := range events {
|
||||
switch event.(type) {
|
||||
// TODO: implement append events
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (rm *ReadModel) Reduce() (err error) {
|
||||
for _, event := range rm.Events {
|
||||
switch event.(type) {
|
||||
//TODO: implement reduce
|
||||
}
|
||||
}
|
||||
for _, reduce := range []func() error{
|
||||
rm.ReadModel.Reduce,
|
||||
} {
|
||||
if err = reduce(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rm *ReadModel) AppendAndReduce(events ...eventstore.EventReader) error {
|
||||
rm.AppendEvents(events...)
|
||||
return rm.Reduce()
|
||||
}
|
||||
|
||||
func (rm *ReadModel) Query() *eventstore.SearchQueryBuilder {
|
||||
return eventstore.NewSearchQueryBuilder(eventstore.ColumnsEvent, AggregateType).AggregateIDs(rm.AggregateID)
|
||||
}
|
||||
@@ -22,16 +22,16 @@ const (
|
||||
UserUserNameChangedType = userEventTypePrefix + "username.changed"
|
||||
)
|
||||
|
||||
type LockedEvent struct {
|
||||
type UserLockedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *LockedEvent) Data() interface{} {
|
||||
func (e *UserLockedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewLockedEvent(ctx context.Context) *LockedEvent {
|
||||
return &LockedEvent{
|
||||
func NewUserLockedEvent(ctx context.Context) *UserLockedEvent {
|
||||
return &UserLockedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserLockedType,
|
||||
@@ -39,22 +39,22 @@ func NewLockedEvent(ctx context.Context) *LockedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func LockedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &LockedEvent{
|
||||
func UserLockedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &UserLockedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type UnlockedEvent struct {
|
||||
type UserUnlockedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *UnlockedEvent) Data() interface{} {
|
||||
func (e *UserUnlockedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewUnlockedEvent(ctx context.Context) *UnlockedEvent {
|
||||
return &UnlockedEvent{
|
||||
func NewUserUnlockedEvent(ctx context.Context) *UserUnlockedEvent {
|
||||
return &UserUnlockedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserUnlockedType,
|
||||
@@ -62,22 +62,22 @@ func NewUnlockedEvent(ctx context.Context) *UnlockedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func UnlockedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &UnlockedEvent{
|
||||
func UserUnlockedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &UserUnlockedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type DeactivatedEvent struct {
|
||||
type UserDeactivatedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *DeactivatedEvent) Data() interface{} {
|
||||
func (e *UserDeactivatedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewDeactivatedEvent(ctx context.Context) *DeactivatedEvent {
|
||||
return &DeactivatedEvent{
|
||||
func NewUserDeactivatedEvent(ctx context.Context) *UserDeactivatedEvent {
|
||||
return &UserDeactivatedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserDeactivatedType,
|
||||
@@ -85,22 +85,22 @@ func NewDeactivatedEvent(ctx context.Context) *DeactivatedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func DeactivatedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &DeactivatedEvent{
|
||||
func UserDeactivatedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &UserDeactivatedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type ReactivatedEvent struct {
|
||||
type UserReactivatedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *ReactivatedEvent) Data() interface{} {
|
||||
func (e *UserReactivatedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewReactivatedEvent(ctx context.Context) *ReactivatedEvent {
|
||||
return &ReactivatedEvent{
|
||||
func NewUserReactivatedEvent(ctx context.Context) *UserReactivatedEvent {
|
||||
return &UserReactivatedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserReactivatedType,
|
||||
@@ -108,22 +108,22 @@ func NewReactivatedEvent(ctx context.Context) *ReactivatedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func ReactivatedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &ReactivatedEvent{
|
||||
func UserReactivatedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &UserReactivatedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type RemovedEvent struct {
|
||||
type UserRemovedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
}
|
||||
|
||||
func (e *RemovedEvent) Data() interface{} {
|
||||
func (e *UserRemovedEvent) Data() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewRemovedEvent(ctx context.Context) *RemovedEvent {
|
||||
return &RemovedEvent{
|
||||
func NewUserRemovedEvent(ctx context.Context) *UserRemovedEvent {
|
||||
return &UserRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserRemovedType,
|
||||
@@ -131,13 +131,13 @@ func NewRemovedEvent(ctx context.Context) *RemovedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func RemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &RemovedEvent{
|
||||
func UserRemovedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
return &UserRemovedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}, nil
|
||||
}
|
||||
|
||||
type TokenAddedEvent struct {
|
||||
type UserTokenAddedEvent struct {
|
||||
eventstore.BaseEvent `json:"-"`
|
||||
|
||||
TokenID string `json:"tokenId"`
|
||||
@@ -149,11 +149,11 @@ type TokenAddedEvent struct {
|
||||
PreferredLanguage string `json:"preferredLanguage"`
|
||||
}
|
||||
|
||||
func (e *TokenAddedEvent) Data() interface{} {
|
||||
func (e *UserTokenAddedEvent) Data() interface{} {
|
||||
return e
|
||||
}
|
||||
|
||||
func NewTokenAddedEvent(
|
||||
func NewUserTokenAddedEvent(
|
||||
ctx context.Context,
|
||||
tokenID,
|
||||
applicationID,
|
||||
@@ -162,8 +162,8 @@ func NewTokenAddedEvent(
|
||||
audience,
|
||||
scopes []string,
|
||||
expiration time.Time,
|
||||
) *TokenAddedEvent {
|
||||
return &TokenAddedEvent{
|
||||
) *UserTokenAddedEvent {
|
||||
return &UserTokenAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserTokenAddedType,
|
||||
@@ -177,8 +177,8 @@ func NewTokenAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func TokenAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
tokenAdded := &TokenAddedEvent{
|
||||
func UserTokenAddedEventMapper(event *repository.Event) (eventstore.EventReader, error) {
|
||||
tokenAdded := &UserTokenAddedEvent{
|
||||
BaseEvent: *eventstore.BaseEventFromRepo(event),
|
||||
}
|
||||
err := json.Unmarshal(event.Data, tokenAdded)
|
||||
@@ -1,23 +1,15 @@
|
||||
package v1
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/caos/zitadel/internal/crypto"
|
||||
"github.com/caos/zitadel/internal/eventstore/v2"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/address"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/email"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/mfa/otp"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/password"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/phone"
|
||||
"github.com/caos/zitadel/internal/v2/repository/user/human/profile"
|
||||
"github.com/caos/zitadel/internal/v2/domain"
|
||||
"golang.org/x/text/language"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
userEventTypePrefix = eventstore.EventType("user.")
|
||||
UserV1AddedType = userEventTypePrefix + "added"
|
||||
UserV1RegisteredType = userEventTypePrefix + "selfregistered"
|
||||
UserV1InitialCodeAddedType = userEventTypePrefix + "initialization.code.added"
|
||||
@@ -73,7 +65,7 @@ func NewUserV1AddedEvent(
|
||||
nickName,
|
||||
displayName string,
|
||||
preferredLanguage language.Tag,
|
||||
gender human.Gender,
|
||||
gender domain.Gender,
|
||||
emailAddress,
|
||||
phoneNumber,
|
||||
country,
|
||||
@@ -81,8 +73,8 @@ func NewUserV1AddedEvent(
|
||||
postalCode,
|
||||
region,
|
||||
streetAddress string,
|
||||
) *human.AddedEvent {
|
||||
return &human.AddedEvent{
|
||||
) *HumanAddedEvent {
|
||||
return &HumanAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1AddedType,
|
||||
@@ -112,7 +104,7 @@ func NewUserV1RegisteredEvent(
|
||||
nickName,
|
||||
displayName string,
|
||||
preferredLanguage language.Tag,
|
||||
gender int32,
|
||||
gender domain.Gender,
|
||||
emailAddress,
|
||||
phoneNumber,
|
||||
country,
|
||||
@@ -120,8 +112,8 @@ func NewUserV1RegisteredEvent(
|
||||
postalCode,
|
||||
region,
|
||||
streetAddress string,
|
||||
) *human.RegisteredEvent {
|
||||
return &human.RegisteredEvent{
|
||||
) *HumanRegisteredEvent {
|
||||
return &HumanRegisteredEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1RegisteredType,
|
||||
@@ -147,8 +139,8 @@ func NewUserV1InitialCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
) *human.InitialCodeAddedEvent {
|
||||
return &human.InitialCodeAddedEvent{
|
||||
) *HumanInitialCodeAddedEvent {
|
||||
return &HumanInitialCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1InitialCodeAddedType,
|
||||
@@ -158,8 +150,8 @@ func NewUserV1InitialCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1InitialCodeSentEvent(ctx context.Context) *human.InitialCodeSentEvent {
|
||||
return &human.InitialCodeSentEvent{
|
||||
func NewUserV1InitialCodeSentEvent(ctx context.Context) *HumanInitialCodeSentEvent {
|
||||
return &HumanInitialCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1InitialCodeSentType,
|
||||
@@ -167,8 +159,8 @@ func NewUserV1InitialCodeSentEvent(ctx context.Context) *human.InitialCodeSentEv
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1InitializedCheckSucceededEvent(ctx context.Context) *human.InitializedCheckSucceededEvent {
|
||||
return &human.InitializedCheckSucceededEvent{
|
||||
func NewUserV1InitializedCheckSucceededEvent(ctx context.Context) *HumanInitializedCheckSucceededEvent {
|
||||
return &HumanInitializedCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1InitializedCheckSucceededType,
|
||||
@@ -176,8 +168,8 @@ func NewUserV1InitializedCheckSucceededEvent(ctx context.Context) *human.Initial
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1InitializedCheckFailedEvent(ctx context.Context) *human.InitializedCheckFailedEvent {
|
||||
return &human.InitializedCheckFailedEvent{
|
||||
func NewUserV1InitializedCheckFailedEvent(ctx context.Context) *HumanInitializedCheckFailedEvent {
|
||||
return &HumanInitializedCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1InitializedCheckFailedType,
|
||||
@@ -185,8 +177,8 @@ func NewUserV1InitializedCheckFailedEvent(ctx context.Context) *human.Initialize
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1SignedOutEvent(ctx context.Context) *human.SignedOutEvent {
|
||||
return &human.SignedOutEvent{
|
||||
func NewUserV1SignedOutEvent(ctx context.Context) *HumanSignedOutEvent {
|
||||
return &HumanSignedOutEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1SignedOutType,
|
||||
@@ -198,8 +190,8 @@ func NewUserV1PasswordChangedEvent(
|
||||
ctx context.Context,
|
||||
secret *crypto.CryptoValue,
|
||||
changeRequired bool,
|
||||
) *password.ChangedEvent {
|
||||
return &password.ChangedEvent{
|
||||
) *HumanPasswordChangedChangedEvent {
|
||||
return &HumanPasswordChangedChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PasswordChangedType,
|
||||
@@ -213,9 +205,9 @@ func NewUserV1PasswordCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
notificationType human.NotificationType,
|
||||
) *password.CodeAddedEvent {
|
||||
return &password.CodeAddedEvent{
|
||||
notificationType domain.NotificationType,
|
||||
) *HumanPasswordCodeAddedEvent {
|
||||
return &HumanPasswordCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PasswordCodeAddedType,
|
||||
@@ -226,8 +218,8 @@ func NewUserV1PasswordCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PasswordCodeSentEvent(ctx context.Context) *password.CodeSentEvent {
|
||||
return &password.CodeSentEvent{
|
||||
func NewUserV1PasswordCodeSentEvent(ctx context.Context) *HumanPasswordCodeSentEvent {
|
||||
return &HumanPasswordCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PasswordCodeSentType,
|
||||
@@ -235,8 +227,8 @@ func NewUserV1PasswordCodeSentEvent(ctx context.Context) *password.CodeSentEvent
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PasswordCheckSucceededEvent(ctx context.Context) *password.CheckSucceededEvent {
|
||||
return &password.CheckSucceededEvent{
|
||||
func NewUserV1PasswordCheckSucceededEvent(ctx context.Context) *HumanPasswordCheckSucceededEvent {
|
||||
return &HumanPasswordCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PasswordCheckSucceededType,
|
||||
@@ -244,8 +236,8 @@ func NewUserV1PasswordCheckSucceededEvent(ctx context.Context) *password.CheckSu
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PasswordCheckFailedEvent(ctx context.Context) *password.CheckFailedEvent {
|
||||
return &password.CheckFailedEvent{
|
||||
func NewUserV1PasswordCheckFailedEvent(ctx context.Context) *HumanPasswordCheckFailedEvent {
|
||||
return &HumanPasswordCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PasswordCheckFailedType,
|
||||
@@ -253,8 +245,8 @@ func NewUserV1PasswordCheckFailedEvent(ctx context.Context) *password.CheckFaile
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1EmailChangedEvent(ctx context.Context, emailAddress string) *email.ChangedEvent {
|
||||
return &email.ChangedEvent{
|
||||
func NewUserV1EmailChangedEvent(ctx context.Context, emailAddress string) *HumanEmailChangedEvent {
|
||||
return &HumanEmailChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1EmailChangedType,
|
||||
@@ -263,8 +255,8 @@ func NewUserV1EmailChangedEvent(ctx context.Context, emailAddress string) *email
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1EmailVerifiedEvent(ctx context.Context) *email.VerifiedEvent {
|
||||
return &email.VerifiedEvent{
|
||||
func NewUserV1EmailVerifiedEvent(ctx context.Context) *HumanEmailVerifiedEvent {
|
||||
return &HumanEmailVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1EmailVerifiedType,
|
||||
@@ -272,8 +264,8 @@ func NewUserV1EmailVerifiedEvent(ctx context.Context) *email.VerifiedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1EmailVerificationFailedEvent(ctx context.Context) *email.VerificationFailedEvent {
|
||||
return &email.VerificationFailedEvent{
|
||||
func NewUserV1EmailVerificationFailedEvent(ctx context.Context) *HumanEmailVerificationFailedEvent {
|
||||
return &HumanEmailVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1EmailVerificationFailedType,
|
||||
@@ -285,8 +277,8 @@ func NewUserV1EmailCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
) *email.CodeAddedEvent {
|
||||
return &email.CodeAddedEvent{
|
||||
) *HumanEmailCodeAddedEvent {
|
||||
return &HumanEmailCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1EmailCodeAddedType,
|
||||
@@ -296,8 +288,8 @@ func NewUserV1EmailCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1EmailCodeSentEvent(ctx context.Context) *email.CodeSentEvent {
|
||||
return &email.CodeSentEvent{
|
||||
func NewUserV1EmailCodeSentEvent(ctx context.Context) *HumanEmailCodeSentEvent {
|
||||
return &HumanEmailCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1EmailCodeSentType,
|
||||
@@ -305,8 +297,8 @@ func NewUserV1EmailCodeSentEvent(ctx context.Context) *email.CodeSentEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PhoneChangedEvent(ctx context.Context, phone string) *phone.ChangedEvent {
|
||||
return phone.HumanPhoneChangedEvent{
|
||||
func NewUserV1PhoneChangedEvent(ctx context.Context, phone string) *HumanPhoneChangedEvent {
|
||||
return &HumanPhoneChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PhoneChangedType,
|
||||
@@ -315,8 +307,8 @@ func NewUserV1PhoneChangedEvent(ctx context.Context, phone string) *phone.Change
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PhoneRemovedEvent(ctx context.Context) *phone.RemovedEvent {
|
||||
return &phone.RemovedEvent{
|
||||
func NewUserV1PhoneRemovedEvent(ctx context.Context) *HumanPhoneRemovedEvent {
|
||||
return &HumanPhoneRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PhoneRemovedType,
|
||||
@@ -324,8 +316,8 @@ func NewUserV1PhoneRemovedEvent(ctx context.Context) *phone.RemovedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PhoneVerifiedEvent(ctx context.Context) *phone.VerifiedEvent {
|
||||
return &phone.VerifiedEvent{
|
||||
func NewUserV1PhoneVerifiedEvent(ctx context.Context) *HumanPhoneVerifiedEvent {
|
||||
return &HumanPhoneVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PhoneVerifiedType,
|
||||
@@ -333,8 +325,8 @@ func NewUserV1PhoneVerifiedEvent(ctx context.Context) *phone.VerifiedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PhoneVerificationFailedEvent(ctx context.Context) *phone.VerificationFailedEvent {
|
||||
return &phone.VerificationFailedEvent{
|
||||
func NewUserV1PhoneVerificationFailedEvent(ctx context.Context) *HumanPhoneVerificationFailedEvent {
|
||||
return &HumanPhoneVerificationFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PhoneVerificationFailedType,
|
||||
@@ -346,8 +338,8 @@ func NewUserV1PhoneCodeAddedEvent(
|
||||
ctx context.Context,
|
||||
code *crypto.CryptoValue,
|
||||
expiry time.Duration,
|
||||
) *phone.CodeAddedEvent {
|
||||
return &phone.CodeAddedEvent{
|
||||
) *HumanPhoneCodeAddedEvent {
|
||||
return &HumanPhoneCodeAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PhoneCodeAddedType,
|
||||
@@ -357,8 +349,8 @@ func NewUserV1PhoneCodeAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1PhoneCodeSentEvent(ctx context.Context) *phone.CodeSentEvent {
|
||||
return &phone.CodeSentEvent{
|
||||
func NewUserV1PhoneCodeSentEvent(ctx context.Context) *HumanPhoneCodeSentEvent {
|
||||
return &HumanPhoneCodeSentEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1PhoneCodeSentType,
|
||||
@@ -373,9 +365,9 @@ func NewUserV1ProfileChangedEvent(
|
||||
nickName,
|
||||
displayName string,
|
||||
preferredLanguage language.Tag,
|
||||
gender human.Gender,
|
||||
) *profile.ChangedEvent {
|
||||
return &profile.ChangedEvent{
|
||||
gender domain.Gender,
|
||||
) *HumanProfileChangedEvent {
|
||||
return &HumanProfileChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1ProfileChangedType,
|
||||
@@ -396,8 +388,8 @@ func NewUserV1AddressChangedEvent(
|
||||
postalCode,
|
||||
region,
|
||||
streetAddress string,
|
||||
) *address.HumanAddressChangedEvent {
|
||||
return &address.HumanAddressChangedEvent{
|
||||
) *HumanAddressChangedEvent {
|
||||
return &HumanAddressChangedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1AddressChangedType,
|
||||
@@ -410,8 +402,8 @@ func NewUserV1AddressChangedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1MFAInitSkippedEvent(ctx context.Context) *mfa.InitSkippedEvent {
|
||||
return &mfa.InitSkippedEvent{
|
||||
func NewUserV1MFAInitSkippedEvent(ctx context.Context) *HumanMFAInitSkippedEvent {
|
||||
return &HumanMFAInitSkippedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1MFAInitSkippedType,
|
||||
@@ -422,8 +414,8 @@ func NewUserV1MFAInitSkippedEvent(ctx context.Context) *mfa.InitSkippedEvent {
|
||||
func NewUserV1MFAOTPAddedEvent(
|
||||
ctx context.Context,
|
||||
secret *crypto.CryptoValue,
|
||||
) *otp.AddedEvent {
|
||||
return &otp.AddedEvent{
|
||||
) *HumanOTPAddedEvent {
|
||||
return &HumanOTPAddedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1MFAOTPAddedType,
|
||||
@@ -432,8 +424,8 @@ func NewUserV1MFAOTPAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1MFAOTPVerifiedEvent(ctx context.Context) *otp.VerifiedEvent {
|
||||
return &otp.VerifiedEvent{
|
||||
func NewUserV1MFAOTPVerifiedEvent(ctx context.Context) *HumanOTPVerifiedEvent {
|
||||
return &HumanOTPVerifiedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1MFAOTPVerifiedType,
|
||||
@@ -441,8 +433,8 @@ func NewUserV1MFAOTPVerifiedEvent(ctx context.Context) *otp.VerifiedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1MFAOTPRemovedEvent(ctx context.Context) *otp.RemovedEvent {
|
||||
return &otp.RemovedEvent{
|
||||
func NewUserV1MFAOTPRemovedEvent(ctx context.Context) *HumanOTPRemovedEvent {
|
||||
return &HumanOTPRemovedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1MFAOTPRemovedType,
|
||||
@@ -450,8 +442,8 @@ func NewUserV1MFAOTPRemovedEvent(ctx context.Context) *otp.RemovedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1MFAOTPCheckSucceededEvent(ctx context.Context) *otp.CheckSucceededEvent {
|
||||
return &otp.CheckSucceededEvent{
|
||||
func NewUserV1MFAOTPCheckSucceededEvent(ctx context.Context) *HumanOTPCheckSucceededEvent {
|
||||
return &HumanOTPCheckSucceededEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1MFAOTPCheckSucceededType,
|
||||
@@ -459,8 +451,8 @@ func NewUserV1MFAOTPCheckSucceededEvent(ctx context.Context) *otp.CheckSucceeded
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserV1MFAOTPCheckFailedEvent(ctx context.Context) *otp.CheckFailedEvent {
|
||||
return &otp.CheckFailedEvent{
|
||||
func NewUserV1MFAOTPCheckFailedEvent(ctx context.Context) *HumanOTPCheckFailedEvent {
|
||||
return &HumanOTPCheckFailedEvent{
|
||||
BaseEvent: *eventstore.NewBaseEventForPush(
|
||||
ctx,
|
||||
UserV1MFAOTPCheckFailedType,
|
||||
Reference in New Issue
Block a user