fix: todos (#1346)

* fix: pub sub in new eventstore

* fix: todos

* fix: todos

* fix: todos

* fix: todos

* fix: todos
This commit is contained in:
Fabi
2021-03-01 08:48:50 +01:00
committed by GitHub
parent c0f55e7209
commit 3c07a186fc
145 changed files with 645 additions and 575 deletions

View File

@@ -2,6 +2,7 @@ package command
import (
"context"
"github.com/caos/logging"
"github.com/caos/zitadel/internal/eventstore"
"github.com/caos/zitadel/internal/domain"
@@ -165,7 +166,7 @@ func (c *Commands) HumanVerifyU2FSetup(ctx context.Context, userID, resourceowne
usr_repo.NewHumanU2FVerifiedEvent(
ctx,
userAgg,
verifyWebAuthN.WebauthNTokenID, //TODO: webAuthN andverifyWebAuthN same TokenID?
verifyWebAuthN.WebauthNTokenID,
webAuthN.WebAuthNTokenName,
webAuthN.AttestationType,
webAuthN.KeyID,
@@ -191,7 +192,7 @@ func (c *Commands) HumanHumanPasswordlessSetup(ctx context.Context, userID, reso
usr_repo.NewHumanPasswordlessVerifiedEvent(
ctx,
userAgg,
verifyWebAuthN.WebauthNTokenID, //TODO: webAuthN andverifyWebAuthN same TokenID?
verifyWebAuthN.WebauthNTokenID,
webAuthN.WebAuthNTokenName,
webAuthN.AttestationType,
webAuthN.KeyID,
@@ -305,10 +306,23 @@ func (c *Commands) HumanFinishU2FLogin(ctx context.Context, userID, resourceOwne
userAgg, token, signCount, err := c.finishWebAuthNLogin(ctx, userID, resourceOwner, credentialData, webAuthNLogin, u2fTokens, isLoginUI)
if err != nil {
_, pushErr := c.eventstore.PushEvents(ctx,
usr_repo.NewHumanU2FCheckFailedEvent(
ctx,
userAgg,
authRequestDomainToAuthRequestInfo(authRequest),
),
)
logging.Log("EVENT-33M9f").OnError(pushErr).WithField("userID", userID).Warn("could not push failed passwordless check event")
return err
}
_, err = c.eventstore.PushEvents(ctx,
usr_repo.NewHumanU2FCheckSucceededEvent(
ctx,
userAgg,
authRequestDomainToAuthRequestInfo(authRequest),
),
usr_repo.NewHumanU2FSignCountChangedEvent(
ctx,
userAgg,
@@ -333,10 +347,23 @@ func (c *Commands) HumanFinishPasswordlessLogin(ctx context.Context, userID, res
userAgg, token, signCount, err := c.finishWebAuthNLogin(ctx, userID, resourceOwner, credentialData, webAuthNLogin, passwordlessTokens, isLoginUI)
if err != nil {
_, pushErr := c.eventstore.PushEvents(ctx,
usr_repo.NewHumanPasswordlessCheckFailedEvent(
ctx,
userAgg,
authRequestDomainToAuthRequestInfo(authRequest),
),
)
logging.Log("EVENT-33M9f").OnError(pushErr).WithField("userID", userID).Warn("could not push failed passwordless check event")
return err
}
_, err = c.eventstore.PushEvents(ctx,
usr_repo.NewHumanU2FCheckSucceededEvent(
ctx,
userAgg,
authRequestDomainToAuthRequestInfo(authRequest),
),
usr_repo.NewHumanPasswordlessSignCountChangedEvent(
ctx,
userAgg,