fix: check oidc / api config (#1940)

This commit is contained in:
Livio Amstutz
2021-06-27 11:20:59 +02:00
committed by GitHub
parent 724df5d6c4
commit c6ad784a6c
6 changed files with 34 additions and 0 deletions

View File

@@ -80,6 +80,9 @@ func (c *Commands) ChangeAPIApplication(ctx context.Context, apiApp *domain.APIA
if existingAPI.State == domain.AppStateUnspecified || existingAPI.State == domain.AppStateRemoved {
return nil, caos_errs.ThrowNotFound(nil, "COMMAND-2n8uU", "Errors.Project.App.NotExisting")
}
if !existingAPI.IsAPI() {
return nil, caos_errs.ThrowInvalidArgument(nil, "COMMAND-Gnwt3", "Errors.Project.App.IsNotAPI")
}
projectAgg := ProjectAggregateFromWriteModel(&existingAPI.WriteModel)
changedEvent, hasChanged, err := existingAPI.NewChangedEvent(
ctx,
@@ -117,6 +120,9 @@ func (c *Commands) ChangeAPIApplicationSecret(ctx context.Context, projectID, ap
if existingAPI.State == domain.AppStateUnspecified || existingAPI.State == domain.AppStateRemoved {
return nil, caos_errs.ThrowNotFound(nil, "COMMAND-2g66f", "Errors.Project.App.NotExisting")
}
if !existingAPI.IsAPI() {
return nil, caos_errs.ThrowInvalidArgument(nil, "COMMAND-aeH4", "Errors.Project.App.IsNotAPI")
}
cryptoSecret, stringPW, err := domain.NewClientSecret(c.applicationSecretGenerator)
if err != nil {
return nil, err