@Test public void testCustomValidate() throws InitializationException { runner.setProperty(ListenTCP.PORT, "1"); runner.assertValid(); configureProcessorSslContextService(); runner.setProperty(ListenTCP.CLIENT_AUTH, ""); runner.assertNotValid(); runner.setProperty(ListenTCP.CLIENT_AUTH, SslContextFactory.ClientAuth.REQUIRED.name()); runner.assertValid(); }
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final String clientAuth = validationContext.getProperty(CLIENT_AUTH).getValue(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && StringUtils.isBlank(clientAuth)) { results.add(new ValidationResult.Builder() .explanation("Client Auth must be provided when using TLS/SSL") .valid(false).subject("Client Auth").build()); } return results; }
ListenTCP extends AbstractListenEventBatchingProcessor<StandardEvent> { @Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final String clientAuth = validationContext.getProperty(CLIENT_AUTH).getValue(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && StringUtils.isBlank(clientAuth)) { results.add(new ValidationResult.Builder() .explanation("Client Auth must be provided when using TLS/SSL") .valid(false).subject("Client Auth").build()); } return results; } }
ListenTCP extends AbstractListenEventBatchingProcessor<StandardEvent> { @Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final String clientAuth = validationContext.getProperty(CLIENT_AUTH).getValue(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && StringUtils.isBlank(clientAuth)) { results.add(new ValidationResult.Builder() .explanation("Client Auth must be provided when using TLS/SSL") .valid(false).subject("Client Auth").build()); } return results; }  }
ListenTCP extends AbstractListenEventBatchingProcessor<StandardEvent> { @Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final String clientAuth = validationContext.getProperty(CLIENT_AUTH).getValue(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && StringUtils.isBlank(clientAuth)) { results.add(new ValidationResult.Builder() .explanation("Client Auth must be provided when using TLS/SSL") .valid(false).subject("Client Auth").build()); } return results; }   }
ListenTCP extends AbstractListenEventBatchingProcessor<StandardEvent> { @Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final String clientAuth = validationContext.getProperty(CLIENT_AUTH).getValue(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && StringUtils.isBlank(clientAuth)) { results.add(new ValidationResult.Builder() .explanation("Client Auth must be provided when using TLS/SSL") .valid(false).subject("Client Auth").build()); } return results; }   static final PropertyDescriptor SSL_CONTEXT_SERVICE; static final PropertyDescriptor CLIENT_AUTH; }