@Test public void infraconfig_with_uri_as_ftp_is_NOT_rejected() throws Exception { SecHubInfrastructureScanConfiguration webscan = mock(SecHubInfrastructureScanConfiguration.class); List<URI> list = new ArrayList<>(); list.add(URI.create("http: when(webscan.getUris()).thenReturn(list); when(target.getInfraScan()).thenReturn(Optional.of(webscan)); validatorToTest.validate(target, errors); assertNoIllegalSchemaError(); }
@Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } } }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }  }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }  @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors); }
SecHubConfigurationValidator implements Validator { @Override public void validate(Object target, Errors errors) { LOG.debug("Start validation for: {}", target); SecHubConfiguration configuration = (SecHubConfiguration) target; validateAPI(configuration, errors); validateAtLeastOneScanConfiguration(configuration, errors); validateWebScan(configuration, errors); validateInfraScan(configuration, errors); if (errors.hasErrors()) { List<ObjectError> objectErrors = errors.getAllErrors(); for (ObjectError error : objectErrors) { LOG.info("Rejected sechub configuration from user:{}. Reason: {}", userContextService.getUserId(), error.getDefaultMessage()); } } }  @Override boolean supports(Class<?> clazz); @Override void validate(Object target, Errors errors);  }