Merge branch '1.5.x' into 2.0.x
This commit is contained in:
commit
7990c8ba68
|
|
@ -99,7 +99,7 @@
|
||||||
<jedis.version>2.9.3</jedis.version>
|
<jedis.version>2.9.3</jedis.version>
|
||||||
<jersey.version>2.26</jersey.version>
|
<jersey.version>2.26</jersey.version>
|
||||||
<jest.version>5.3.4</jest.version>
|
<jest.version>5.3.4</jest.version>
|
||||||
<jetty.version>9.4.14.v20181114</jetty.version>
|
<jetty.version>9.4.15.v20190215</jetty.version>
|
||||||
<jetty-jsp.version>2.2.0.v201112011158</jetty-jsp.version>
|
<jetty-jsp.version>2.2.0.v201112011158</jetty-jsp.version>
|
||||||
<jetty-el.version>8.5.35.1</jetty-el.version>
|
<jetty-el.version>8.5.35.1</jetty-el.version>
|
||||||
<jmustache.version>1.14</jmustache.version>
|
<jmustache.version>1.14</jmustache.version>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -21,12 +21,16 @@ import java.io.FileInputStream;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import javax.net.ssl.KeyManager;
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
|
import javax.net.ssl.X509KeyManager;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||||
|
|
@ -169,10 +173,22 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
||||||
KeyManagerFactory clientKeyManagerFactory = KeyManagerFactory
|
KeyManagerFactory clientKeyManagerFactory = KeyManagerFactory
|
||||||
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||||
clientKeyManagerFactory.init(clientKeyStore, "password".toCharArray());
|
clientKeyManagerFactory.init(clientKeyStore, "password".toCharArray());
|
||||||
return new ReactorClientHttpConnector((options) -> options.sslSupport(
|
for (KeyManager keyManager : clientKeyManagerFactory.getKeyManagers()) {
|
||||||
(sslContextBuilder) -> sslContextBuilder.sslProvider(SslProvider.JDK)
|
if (keyManager instanceof X509KeyManager) {
|
||||||
.trustManager(InsecureTrustManagerFactory.INSTANCE)
|
X509KeyManager x509KeyManager = (X509KeyManager) keyManager;
|
||||||
.keyManager(clientKeyManagerFactory)));
|
PrivateKey privateKey = x509KeyManager.getPrivateKey("spring-boot");
|
||||||
|
if (privateKey != null) {
|
||||||
|
X509Certificate[] certificateChain = x509KeyManager
|
||||||
|
.getCertificateChain("spring-boot");
|
||||||
|
return new ReactorClientHttpConnector((options) -> options
|
||||||
|
.sslSupport((sslContextBuilder) -> sslContextBuilder
|
||||||
|
.sslProvider(SslProvider.JDK)
|
||||||
|
.trustManager(InsecureTrustManagerFactory.INSTANCE)
|
||||||
|
.keyManager(privateKey, certificateChain)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("Key with alias 'spring-boot' not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void testClientAuthSuccess(Ssl sslConfiguration,
|
protected void testClientAuthSuccess(Ssl sslConfiguration,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2018 the original author or authors.
|
* Copyright 2012-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -25,6 +25,7 @@ import java.io.PrintWriter;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
|
import java.net.Socket;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
@ -74,6 +75,8 @@ import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.http.impl.client.HttpClientBuilder;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.protocol.HttpContext;
|
import org.apache.http.protocol.HttpContext;
|
||||||
|
import org.apache.http.ssl.PrivateKeyDetails;
|
||||||
|
import org.apache.http.ssl.PrivateKeyStrategy;
|
||||||
import org.apache.http.ssl.SSLContextBuilder;
|
import org.apache.http.ssl.SSLContextBuilder;
|
||||||
import org.apache.http.ssl.TrustStrategy;
|
import org.apache.http.ssl.TrustStrategy;
|
||||||
import org.apache.jasper.EmbeddedServletOptions;
|
import org.apache.jasper.EmbeddedServletOptions;
|
||||||
|
|
@ -424,7 +427,7 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||||
this.webServer = factory.getWebServer(registration);
|
this.webServer = factory.getWebServer(registration);
|
||||||
this.webServer.start();
|
this.webServer.start();
|
||||||
TrustStrategy trustStrategy = new SerialNumberValidatingTrustSelfSignedStrategy(
|
TrustStrategy trustStrategy = new SerialNumberValidatingTrustSelfSignedStrategy(
|
||||||
"77e7c302");
|
"5c7ae101");
|
||||||
SSLContext sslContext = new SSLContextBuilder()
|
SSLContext sslContext = new SSLContextBuilder()
|
||||||
.loadTrustMaterial(null, trustStrategy).build();
|
.loadTrustMaterial(null, trustStrategy).build();
|
||||||
HttpClient httpClient = HttpClients.custom()
|
HttpClient httpClient = HttpClients.custom()
|
||||||
|
|
@ -500,7 +503,18 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||||
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
|
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
|
||||||
new SSLContextBuilder()
|
new SSLContextBuilder()
|
||||||
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
||||||
.loadKeyMaterial(keyStore, "secret".toCharArray()).build());
|
.loadKeyMaterial(keyStore, "secret".toCharArray(),
|
||||||
|
new PrivateKeyStrategy() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String chooseAlias(
|
||||||
|
Map<String, PrivateKeyDetails> aliases,
|
||||||
|
Socket socket) {
|
||||||
|
return "spring-boot";
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.build());
|
||||||
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
||||||
.build();
|
.build();
|
||||||
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
|
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
|
||||||
|
|
@ -524,7 +538,17 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||||
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
|
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
|
||||||
new SSLContextBuilder()
|
new SSLContextBuilder()
|
||||||
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
||||||
.loadKeyMaterial(keyStore, "password".toCharArray()).build());
|
.loadKeyMaterial(keyStore, "password".toCharArray(),
|
||||||
|
new PrivateKeyStrategy() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String chooseAlias(
|
||||||
|
Map<String, PrivateKeyDetails> aliases,
|
||||||
|
Socket socket) {
|
||||||
|
return "spring-boot";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build());
|
||||||
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
||||||
.build();
|
.build();
|
||||||
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
|
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
|
||||||
|
|
@ -613,7 +637,17 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||||
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
|
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
|
||||||
new SSLContextBuilder()
|
new SSLContextBuilder()
|
||||||
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
.loadTrustMaterial(null, new TrustSelfSignedStrategy())
|
||||||
.loadKeyMaterial(keyStore, "password".toCharArray()).build());
|
.loadKeyMaterial(keyStore, "password".toCharArray(),
|
||||||
|
new PrivateKeyStrategy() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String chooseAlias(
|
||||||
|
Map<String, PrivateKeyDetails> aliases,
|
||||||
|
Socket socket) {
|
||||||
|
return "spring-boot";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build());
|
||||||
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory)
|
||||||
.build();
|
.build();
|
||||||
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
|
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue