use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class AuthenticationConfigurationFieldModelValidator method validate.
@Override
public Set<AlertFieldStatus> validate(FieldModel fieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromFieldModel(fieldModel);
boolean ldapEnabled = configurationFieldValidator.getBooleanValue(AuthenticationDescriptor.KEY_LDAP_ENABLED).orElse(false);
boolean samlEnabled = configurationFieldValidator.getBooleanValue(AuthenticationDescriptor.KEY_SAML_ENABLED).orElse(false);
if (ldapEnabled && samlEnabled) {
configurationFieldValidator.addValidationResults(AlertFieldStatus.error(AuthenticationDescriptor.KEY_LDAP_ENABLED, SAML_LDAP_ENABLED_ERROR));
configurationFieldValidator.addValidationResults(AlertFieldStatus.error(AuthenticationDescriptor.KEY_SAML_ENABLED, SAML_LDAP_ENABLED_ERROR));
}
if (ldapEnabled) {
configurationFieldValidator.validateRequiredFieldsAreNotBlank(List.of(AuthenticationDescriptor.KEY_LDAP_SERVER, AuthenticationDescriptor.KEY_LDAP_MANAGER_DN, AuthenticationDescriptor.KEY_LDAP_MANAGER_PWD));
}
if (samlEnabled) {
configurationFieldValidator.validateRequiredFieldsAreNotBlank(List.of(AuthenticationDescriptor.KEY_SAML_ENTITY_ID, AuthenticationDescriptor.KEY_SAML_ENTITY_BASE_URL));
if (configurationFieldValidator.fieldHasNoReadableValue(AuthenticationDescriptor.KEY_SAML_METADATA_URL) && !filePersistenceUtil.uploadFileExists(AuthenticationDescriptor.SAML_METADATA_FILE)) {
configurationFieldValidator.addValidationResults(AlertFieldStatus.error(AuthenticationDescriptor.KEY_SAML_METADATA_FILE, AuthenticationDescriptor.FIELD_ERROR_SAML_METADATA_FILE_MISSING));
}
validateMetaData(configurationFieldValidator, AuthenticationDescriptor.KEY_SAML_METADATA_URL, AuthenticationDescriptor.FIELD_ERROR_SAML_METADATA_URL_MISSING);
validateMetaData(configurationFieldValidator, AuthenticationDescriptor.KEY_SAML_ENTITY_BASE_URL, AuthenticationDescriptor.FIELD_ERROR_SAML_METADATA_URL_MISSING);
}
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class SlackDistributionConfigurationValidator method validate.
@Override
public Set<AlertFieldStatus> validate(JobFieldModel jobFieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromJobFieldModel(jobFieldModel);
commonChannelDistributionValidator.validate(configurationFieldValidator);
configurationFieldValidator.validateRequiredFieldsAreNotBlank(List.of(SlackDescriptor.KEY_WEBHOOK, SlackDescriptor.KEY_CHANNEL_NAME));
configurationFieldValidator.validateIsAURL(SlackDescriptor.KEY_WEBHOOK);
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class MsTeamsDistributionConfigurationValidator method validate.
@Override
public Set<AlertFieldStatus> validate(JobFieldModel jobFieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromJobFieldModel(jobFieldModel);
commonChannelDistributionValidator.validate(configurationFieldValidator);
configurationFieldValidator.validateRequiredFieldIsNotBlank(MsTeamsDescriptor.KEY_WEBHOOK);
configurationFieldValidator.validateIsAURL(MsTeamsDescriptor.KEY_WEBHOOK);
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class SchedulingConfigurationFieldModelValidator method validate.
@Override
public Set<AlertFieldStatus> validate(FieldModel fieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromFieldModel(fieldModel);
configurationFieldValidator.validateRequiredFieldsAreNotBlank(List.of(SchedulingDescriptor.KEY_DAILY_PROCESSOR_HOUR_OF_DAY, SchedulingDescriptor.KEY_PURGE_DATA_FREQUENCY_DAYS));
configurationFieldValidator.validateIsAValidOption(SchedulingDescriptor.KEY_DAILY_PROCESSOR_HOUR_OF_DAY, getDigestHours());
configurationFieldValidator.validateIsAValidOption(SchedulingDescriptor.KEY_PURGE_DATA_FREQUENCY_DAYS, getPurgeFrequency());
return configurationFieldValidator.getValidationResults();
}
use of com.synopsys.integration.alert.common.descriptor.validator.ConfigurationFieldValidator in project hub-alert by blackducksoftware.
the class SettingsGlobalConfigurationFieldModelValidator method validate.
@Override
public Set<AlertFieldStatus> validate(FieldModel fieldModel) {
ConfigurationFieldValidator configurationFieldValidator = ConfigurationFieldValidator.fromFieldModel(fieldModel);
configurationFieldValidator.validateRequiredFieldsAreNotBlank(List.of(SettingsDescriptor.KEY_ENCRYPTION_PWD, SettingsDescriptor.KEY_ENCRYPTION_GLOBAL_SALT));
minimumEncryptionFieldLength(configurationFieldValidator, SettingsDescriptor.KEY_ENCRYPTION_PWD);
minimumEncryptionFieldLength(configurationFieldValidator, SettingsDescriptor.KEY_ENCRYPTION_GLOBAL_SALT);
validateProxySettings(configurationFieldValidator);
return configurationFieldValidator.getValidationResults();
}
Aggregations