@Test public void shouldEnableSsl() { given(mockSsl.isEnabled()).willReturn(true); customizer.apply(mockHttpServerOptions); verify(mockHttpServerOptions).setSsl(true); }
@Override public HttpServerOptions apply(HttpServerOptions options) { Ssl ssl = factory.getSsl(); if (ssl == null) { return options; } options.setSsl(ssl.isEnabled()); options.setKeyCertOptions(keyCertOptionsAdapter(ssl)); options.setTrustOptions(trustOptionsAdapter(ssl)); propertyMapper.from(ssl.getClientAuth()) .whenNonNull() .as(this::clientAuthAdapter) .to(options::setClientAuth); propertyMapper.from(ssl.getEnabledProtocols()) .whenNonNull() .as(Arrays::asList) .as(LinkedHashSet::new) .to(options::setEnabledSecureTransportProtocols); propertyMapper.from(ssl.getCiphers()) .whenNonNull() .as(Arrays::stream) .to(stream -> stream.forEach(options::addEnabledCipherSuite)); return options; }
SslCustomizer implements HttpServerOptionsCustomizer { @Override public HttpServerOptions apply(HttpServerOptions options) { Ssl ssl = factory.getSsl(); if (ssl == null) { return options; } options.setSsl(ssl.isEnabled()); options.setKeyCertOptions(keyCertOptionsAdapter(ssl)); options.setTrustOptions(trustOptionsAdapter(ssl)); propertyMapper.from(ssl.getClientAuth()) .whenNonNull() .as(this::clientAuthAdapter) .to(options::setClientAuth); propertyMapper.from(ssl.getEnabledProtocols()) .whenNonNull() .as(Arrays::asList) .as(LinkedHashSet::new) .to(options::setEnabledSecureTransportProtocols); propertyMapper.from(ssl.getCiphers()) .whenNonNull() .as(Arrays::stream) .to(stream -> stream.forEach(options::addEnabledCipherSuite)); return options; } }
SslCustomizer implements HttpServerOptionsCustomizer { @Override public HttpServerOptions apply(HttpServerOptions options) { Ssl ssl = factory.getSsl(); if (ssl == null) { return options; } options.setSsl(ssl.isEnabled()); options.setKeyCertOptions(keyCertOptionsAdapter(ssl)); options.setTrustOptions(trustOptionsAdapter(ssl)); propertyMapper.from(ssl.getClientAuth()) .whenNonNull() .as(this::clientAuthAdapter) .to(options::setClientAuth); propertyMapper.from(ssl.getEnabledProtocols()) .whenNonNull() .as(Arrays::asList) .as(LinkedHashSet::new) .to(options::setEnabledSecureTransportProtocols); propertyMapper.from(ssl.getCiphers()) .whenNonNull() .as(Arrays::stream) .to(stream -> stream.forEach(options::addEnabledCipherSuite)); return options; } SslCustomizer(AbstractConfigurableWebServerFactory factory); }
SslCustomizer implements HttpServerOptionsCustomizer { @Override public HttpServerOptions apply(HttpServerOptions options) { Ssl ssl = factory.getSsl(); if (ssl == null) { return options; } options.setSsl(ssl.isEnabled()); options.setKeyCertOptions(keyCertOptionsAdapter(ssl)); options.setTrustOptions(trustOptionsAdapter(ssl)); propertyMapper.from(ssl.getClientAuth()) .whenNonNull() .as(this::clientAuthAdapter) .to(options::setClientAuth); propertyMapper.from(ssl.getEnabledProtocols()) .whenNonNull() .as(Arrays::asList) .as(LinkedHashSet::new) .to(options::setEnabledSecureTransportProtocols); propertyMapper.from(ssl.getCiphers()) .whenNonNull() .as(Arrays::stream) .to(stream -> stream.forEach(options::addEnabledCipherSuite)); return options; } SslCustomizer(AbstractConfigurableWebServerFactory factory); @Override HttpServerOptions apply(HttpServerOptions options); }
SslCustomizer implements HttpServerOptionsCustomizer { @Override public HttpServerOptions apply(HttpServerOptions options) { Ssl ssl = factory.getSsl(); if (ssl == null) { return options; } options.setSsl(ssl.isEnabled()); options.setKeyCertOptions(keyCertOptionsAdapter(ssl)); options.setTrustOptions(trustOptionsAdapter(ssl)); propertyMapper.from(ssl.getClientAuth()) .whenNonNull() .as(this::clientAuthAdapter) .to(options::setClientAuth); propertyMapper.from(ssl.getEnabledProtocols()) .whenNonNull() .as(Arrays::asList) .as(LinkedHashSet::new) .to(options::setEnabledSecureTransportProtocols); propertyMapper.from(ssl.getCiphers()) .whenNonNull() .as(Arrays::stream) .to(stream -> stream.forEach(options::addEnabledCipherSuite)); return options; } SslCustomizer(AbstractConfigurableWebServerFactory factory); @Override HttpServerOptions apply(HttpServerOptions options);  }