|
@@ -15,7 +15,6 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
|
@@ -15,7 +15,6 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
15
|
import org.apache.http.ssl.SSLContextBuilder;
|
15
|
import org.apache.http.ssl.SSLContextBuilder;
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
17
|
|
17
|
|
18
|
-import javax.annotation.PostConstruct;
|
|
|
19
|
import javax.net.ssl.HostnameVerifier;
|
18
|
import javax.net.ssl.HostnameVerifier;
|
20
|
import javax.net.ssl.SSLContext;
|
19
|
import javax.net.ssl.SSLContext;
|
21
|
|
20
|
|
|
@@ -32,6 +31,8 @@ public abstract class HttpSslClientAbstract extends HttpClient { |
|
@@ -32,6 +31,8 @@ public abstract class HttpSslClientAbstract extends HttpClient { |
32
|
|
31
|
|
33
|
protected abstract String getMchId();
|
32
|
protected abstract String getMchId();
|
34
|
|
33
|
|
|
|
34
|
+ protected abstract String getMchCertPath();
|
|
|
35
|
+
|
35
|
|
36
|
|
36
|
@Override
|
37
|
@Override
|
37
|
public CloseableHttpClient buildHttpClient() throws Exception {
|
38
|
public CloseableHttpClient buildHttpClient() throws Exception {
|
|
@@ -57,7 +58,7 @@ public abstract class HttpSslClientAbstract extends HttpClient { |
|
@@ -57,7 +58,7 @@ public abstract class HttpSslClientAbstract extends HttpClient { |
57
|
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(
|
58
|
SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(
|
58
|
sslContext, hostnameVerifier);
|
59
|
sslContext, hostnameVerifier);
|
59
|
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder
|
60
|
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder
|
60
|
- .<ConnectionSocketFactory> create()
|
61
|
+ .<ConnectionSocketFactory>create()
|
61
|
.register("http",
|
62
|
.register("http",
|
62
|
PlainConnectionSocketFactory.getSocketFactory())
|
63
|
PlainConnectionSocketFactory.getSocketFactory())
|
63
|
.register("https", sslSocketFactory).build();
|
64
|
.register("https", sslSocketFactory).build();
|
|
@@ -86,7 +87,7 @@ public abstract class HttpSslClientAbstract extends HttpClient { |
|
@@ -86,7 +87,7 @@ public abstract class HttpSslClientAbstract extends HttpClient { |
86
|
}
|
87
|
}
|
87
|
|
88
|
|
88
|
private void loadKeyMaterial(SSLContextBuilder sslContextBuilder) throws Exception {
|
89
|
private void loadKeyMaterial(SSLContextBuilder sslContextBuilder) throws Exception {
|
89
|
- wechatHelper.loadKeyMaterial(getMchId(), sslContextBuilder);
|
90
|
+ wechatHelper.loadKeyMaterial(getMchId(), getMchCertPath(), sslContextBuilder);
|
90
|
}
|
91
|
}
|
91
|
|
92
|
|
92
|
} |
93
|
} |