fix: don't fail if OIDCClientSecretCheckSucceeded event can not be pushed (#1131)

This commit is contained in:
Livio Amstutz 2020-12-22 10:41:22 +01:00 committed by GitHub
parent 6a05527f18
commit 273b7487b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -811,12 +811,13 @@ func (es *ProjectEventstore) VerifyOIDCClientSecret(ctx context.Context, project
err = crypto.CompareHash(app.OIDCConfig.ClientSecret, []byte(secret), es.passwordAlg) err = crypto.CompareHash(app.OIDCConfig.ClientSecret, []byte(secret), es.passwordAlg)
spanHash.EndWithError(err) spanHash.EndWithError(err)
if err == nil { if err == nil {
return es.setOIDCClientSecretCheckResult(ctx, existingProject, app.AppID, OIDCClientSecretCheckSucceededAggregate) err = es.setOIDCClientSecretCheckResult(ctx, existingProject, app.AppID, OIDCClientSecretCheckSucceededAggregate)
logging.Log("EVENT-AE1vf").OnError(err).Warn("could not push event OIDCClientSecretCheckSucceeded")
return nil
} }
if err := es.setOIDCClientSecretCheckResult(ctx, existingProject, app.AppID, OIDCClientSecretCheckFailedAggregate); err != nil { err = es.setOIDCClientSecretCheckResult(ctx, existingProject, app.AppID, OIDCClientSecretCheckFailedAggregate)
return err logging.Log("EVENT-GD1gh").OnError(err).Warn("could not push event OIDCClientSecretCheckFailed")
} return caos_errs.ThrowInvalidArgument(nil, "EVENT-wg24q", "Errors.Project.OIDCSecretInvalid")
return caos_errs.ThrowInvalidArgument(nil, "EVENT-wg24q", "Errors.Internal")
} }
func (es *ProjectEventstore) setOIDCClientSecretCheckResult(ctx context.Context, project *proj_model.Project, appID string, check func(*es_models.AggregateCreator, *model.Project, string) es_sdk.AggregateFunc) error { func (es *ProjectEventstore) setOIDCClientSecretCheckResult(ctx context.Context, project *proj_model.Project, appID string, check func(*es_models.AggregateCreator, *model.Project, string) es_sdk.AggregateFunc) error {

View File

@ -165,6 +165,7 @@ Errors:
GrantNotExists: Projekt Grant existiert nicht GrantNotExists: Projekt Grant existiert nicht
GrantHasNotExistingRole: Eine der Rollen existiert nicht auf dem Projekt GrantHasNotExistingRole: Eine der Rollen existiert nicht auf dem Projekt
UserIDMisisng: User ID fehlt UserIDMisisng: User ID fehlt
OIDCSecretInvalid: Client Secret ist ungültig
IAM: IAM:
MemberInvalid: Member ist ungültig MemberInvalid: Member ist ungültig
MemberAlreadyExisting: Member existiert bereits MemberAlreadyExisting: Member existiert bereits

View File

@ -165,6 +165,7 @@ Errors:
GrantNotExists: Project grant doesn't exist GrantNotExists: Project grant doesn't exist
GrantHasNotExistingRole: One role doesn't exist on project GrantHasNotExistingRole: One role doesn't exist on project
UserIDMisisng: User ID missing UserIDMisisng: User ID missing
OIDCSecretInvalid: Client Secret is invalid
IAM: IAM:
MemberInvalid: Member is invalid MemberInvalid: Member is invalid
MemberAlreadyExisting: Member already exists MemberAlreadyExisting: Member already exists