Return error on reload on encountering an invalid identity

This commit is contained in:
Ingo Oppermann 2023-06-26 14:05:22 +02:00
parent abfe4918b4
commit ddb18a8c3c
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E
2 changed files with 12 additions and 5 deletions

View File

@ -41,15 +41,22 @@ func New(config iam.Config, store store.Store) (iam.IAM, error) {
func (m *manager) apply(op store.Operation) {
m.logger.Debug().WithField("operation", string(op)).Log("Applying action on operation")
var err error
switch op {
case store.OpAddIdentity:
m.ReloadIndentities()
err = m.ReloadIndentities()
case store.OpUpdateIdentity:
m.ReloadIndentities()
err = m.ReloadIndentities()
case store.OpRemoveIdentity:
m.ReloadIndentities()
err = m.ReloadIndentities()
case store.OpSetPolicies:
m.ReloadPolicies()
err = m.ReloadPolicies()
}
if err != nil {
m.logger.Error().WithError(err).WithField("operation", string(op)).Log("")
}
}

View File

@ -607,7 +607,7 @@ func (im *identityManager) Reload() error {
}
if err := u.Validate(); err != nil {
continue
return fmt.Errorf("invalid user from adapter: %s, %w", u.Name, err)
}
identity, err := im.create(u)