fix: ignore otp.verified v1 event for usersessions (#1633)

* remove MFAOTPVerified from user session projection

* add tracing for VerifyOIDCClientSecret in commands

* fix test
This commit is contained in:
Livio Amstutz 2021-04-21 13:23:05 +02:00 committed by GitHub
parent c919fd6f13
commit 3f90d620b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -170,7 +170,10 @@ func (c *Commands) ChangeOIDCApplicationSecret(ctx context.Context, projectID, a
return result, err return result, err
} }
func (c *Commands) VerifyOIDCClientSecret(ctx context.Context, projectID, appID, secret string) error { func (c *Commands) VerifyOIDCClientSecret(ctx context.Context, projectID, appID, secret string) (err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
app, err := c.getOIDCAppWriteModel(ctx, projectID, appID, "") app, err := c.getOIDCAppWriteModel(ctx, projectID, appID, "")
if err != nil { if err != nil {
return err return err

View File

@ -120,8 +120,7 @@ func (v *UserSessionView) AppendEvent(event *models.Event) error {
if v.UserAgentID != data.UserAgentID { if v.UserAgentID != data.UserAgentID {
v.PasswordVerification = time.Time{} v.PasswordVerification = time.Time{}
} }
case es_model.MFAOTPVerified, case es_model.HumanMFAOTPVerified:
es_model.HumanMFAOTPVerified:
data := new(es_model.OTPVerified) data := new(es_model.OTPVerified)
err := data.SetData(event) err := data.SetData(event)
if err != nil { if err != nil {

View File

@ -119,7 +119,7 @@ func TestAppendEvent(t *testing.T) {
args: args{ args: args{
event: &es_models.Event{ event: &es_models.Event{
CreationDate: now(), CreationDate: now(),
Type: es_model.MFAOTPVerified, Type: es_model.HumanMFAOTPVerified,
Data: nil, Data: nil,
}, },
userView: &UserSessionView{UserAgentID: "id"}, userView: &UserSessionView{UserAgentID: "id"},
@ -131,7 +131,7 @@ func TestAppendEvent(t *testing.T) {
args: args{ args: args{
event: &es_models.Event{ event: &es_models.Event{
CreationDate: now(), CreationDate: now(),
Type: es_model.MFAOTPVerified, Type: es_model.HumanMFAOTPVerified,
Data: func() []byte { Data: func() []byte {
d, _ := json.Marshal(&es_model.OTPVerified{ d, _ := json.Marshal(&es_model.OTPVerified{
UserAgentID: "id", UserAgentID: "id",