EventManager: add IDP login trigger and check account action

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-03-22 19:02:54 +01:00
parent 40344ec0ff
commit e29f6857db
58 changed files with 1660 additions and 385 deletions

View File

@@ -1596,6 +1596,9 @@ func checkEventAction(expected, actual dataprovider.BaseEventAction) error {
if expected.Options.PwdExpirationConfig.Threshold != actual.Options.PwdExpirationConfig.Threshold {
return errors.New("password expiration threshold mismatch")
}
if err := compareEventActionIDPConfigFields(expected.Options.IDPConfig, actual.Options.IDPConfig); err != nil {
return err
}
if err := compareEventActionCmdConfigFields(expected.Options.CmdConfig, actual.Options.CmdConfig); err != nil {
return err
}
@@ -1707,6 +1710,9 @@ func checkEventConditions(expected, actual dataprovider.EventConditions) error {
if err := checkEventConditionOptions(expected.Options, actual.Options); err != nil {
return err
}
if expected.IDPLoginEvent != actual.IDPLoginEvent {
return errors.New("IDP login event mismatch")
}
return checkEventSchedules(expected.Schedules, actual.Schedules)
}
@@ -2707,6 +2713,19 @@ func compareEventActionFsConfigFields(expected, actual dataprovider.EventActionF
return compareEventActionFsCompressFields(expected.Compress, actual.Compress)
}
func compareEventActionIDPConfigFields(expected, actual dataprovider.EventActionIDPAccountCheck) error {
if expected.Mode != actual.Mode {
return errors.New("mode mismatch")
}
if expected.TemplateAdmin != actual.TemplateAdmin {
return errors.New("admin template mismatch")
}
if expected.TemplateUser != actual.TemplateUser {
return errors.New("user template mismatch")
}
return nil
}
func compareEventActionCmdConfigFields(expected, actual dataprovider.EventActionCommandConfig) error {
if expected.Cmd != actual.Cmd {
return errors.New("command mismatch")