use of reactor.netty.http.Http11SslContextSpec in project spring-boot by spring-projects.
the class NettyRSocketServerFactoryTests method createSecureHttpClient.
private HttpClient createSecureHttpClient() {
HttpClient httpClient = createHttpClient();
Http11SslContextSpec sslContextSpec = Http11SslContextSpec.forClient().configure((builder) -> builder.sslProvider(SslProvider.JDK).trustManager(InsecureTrustManagerFactory.INSTANCE));
return httpClient.secure((spec) -> spec.sslContext(sslContextSpec));
}
use of reactor.netty.http.Http11SslContextSpec in project spring-framework by spring-projects.
the class ReactorHttpsServer method initServer.
@Override
protected void initServer() throws Exception {
SelfSignedCertificate cert = new SelfSignedCertificate();
Http11SslContextSpec http11SslContextSpec = Http11SslContextSpec.forServer(cert.certificate(), cert.privateKey());
this.reactorHandler = createHttpHandlerAdapter();
this.reactorServer = reactor.netty.http.server.HttpServer.create().host(getHost()).port(getPort()).secure(sslContextSpec -> sslContextSpec.sslContext(http11SslContextSpec));
}
use of reactor.netty.http.Http11SslContextSpec in project spring-boot by spring-projects.
the class AbstractReactiveWebServerFactoryTests method buildTrustAllSslConnector.
protected ReactorClientHttpConnector buildTrustAllSslConnector() {
Http11SslContextSpec sslContextSpec = Http11SslContextSpec.forClient().configure((builder) -> builder.sslProvider(SslProvider.JDK).trustManager(InsecureTrustManagerFactory.INSTANCE));
HttpClient client = HttpClient.create().wiretap(true).secure((spec) -> spec.sslContext(sslContextSpec));
return new ReactorClientHttpConnector(client);
}
use of reactor.netty.http.Http11SslContextSpec in project spring-boot by spring-projects.
the class AbstractReactiveWebServerFactoryTests method buildTrustAllSslWithClientKeyConnector.
protected ReactorClientHttpConnector buildTrustAllSslWithClientKeyConnector() throws Exception {
KeyStore clientKeyStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (InputStream stream = new FileInputStream("src/test/resources/test.jks")) {
clientKeyStore.load(stream, "secret".toCharArray());
}
KeyManagerFactory clientKeyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
clientKeyManagerFactory.init(clientKeyStore, "password".toCharArray());
Http11SslContextSpec sslContextSpec = Http11SslContextSpec.forClient().configure((builder) -> builder.sslProvider(SslProvider.JDK).trustManager(InsecureTrustManagerFactory.INSTANCE).keyManager(clientKeyManagerFactory));
HttpClient client = HttpClient.create().wiretap(true).secure((spec) -> spec.sslContext(sslContextSpec));
return new ReactorClientHttpConnector(client);
}
use of reactor.netty.http.Http11SslContextSpec in project spring-boot by spring-projects.
the class NettyRSocketServerFactoryTests method createSecureTcpClient.
private TcpClient createSecureTcpClient() {
TcpClient tcpClient = createTcpClient();
Http11SslContextSpec sslContextSpec = Http11SslContextSpec.forClient().configure((builder) -> builder.sslProvider(SslProvider.JDK).trustManager(InsecureTrustManagerFactory.INSTANCE));
return tcpClient.secure((spec) -> spec.sslContext(sslContextSpec));
}
Aggregations