Authn: Prevent empty username and email during sync (#76330)

* Move errors to error file

* Move check for both empty username and email to user service

* Move check for empty email and username to user service Update

* Wrap inner error

* Set username in test
This commit is contained in:
Karl Persson
2023-10-11 14:27:43 +02:00
committed by GitHub
parent e46e66313d
commit 1528d6f5c4
8 changed files with 67 additions and 30 deletions

View File

@@ -91,7 +91,7 @@ func (s *UserSync) SyncUserHook(ctx context.Context, id *authn.Identity, _ *auth
usr, errCreate = s.createUser(ctx, id)
if errCreate != nil {
s.log.FromContext(ctx).Error("Failed to create user", "error", errCreate, "auth_module", id.AuthenticatedBy, "auth_id", id.AuthID)
return errSyncUserInternal.Errorf("unable to create user")
return errSyncUserInternal.Errorf("unable to create user: %w", errCreate)
}
} else {
// update user