25
25
import java .net .InetSocketAddress ;
26
26
import java .net .MalformedURLException ;
27
27
import java .net .ServerSocket ;
28
+ import java .net .Socket ;
28
29
import java .net .URI ;
29
30
import java .net .URISyntaxException ;
30
31
import java .net .URL ;
74
75
import org .apache .http .impl .client .HttpClientBuilder ;
75
76
import org .apache .http .impl .client .HttpClients ;
76
77
import org .apache .http .protocol .HttpContext ;
78
+ import org .apache .http .ssl .PrivateKeyDetails ;
79
+ import org .apache .http .ssl .PrivateKeyStrategy ;
77
80
import org .apache .http .ssl .SSLContextBuilder ;
78
81
import org .apache .http .ssl .TrustStrategy ;
79
82
import org .apache .jasper .EmbeddedServletOptions ;
@@ -423,7 +426,7 @@ public void sslKeyAlias() throws Exception {
423
426
this .webServer = factory .getWebServer (registration );
424
427
this .webServer .start ();
425
428
TrustStrategy trustStrategy = new SerialNumberValidatingTrustSelfSignedStrategy (
426
- "3a3aaec8 " );
429
+ "5c7ae101 " );
427
430
SSLContext sslContext = new SSLContextBuilder ()
428
431
.loadTrustMaterial (null , trustStrategy ).build ();
429
432
HttpClient httpClient = HttpClients .custom ()
@@ -499,7 +502,18 @@ public void pkcs12KeyStoreAndTrustStore() throws Exception {
499
502
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory (
500
503
new SSLContextBuilder ()
501
504
.loadTrustMaterial (null , new TrustSelfSignedStrategy ())
502
- .loadKeyMaterial (keyStore , "secret" .toCharArray ()).build ());
505
+ .loadKeyMaterial (keyStore , "secret" .toCharArray (),
506
+ new PrivateKeyStrategy () {
507
+
508
+ @ Override
509
+ public String chooseAlias (
510
+ Map <String , PrivateKeyDetails > aliases ,
511
+ Socket socket ) {
512
+ return "spring-boot" ;
513
+ }
514
+
515
+ })
516
+ .build ());
503
517
HttpClient httpClient = HttpClients .custom ().setSSLSocketFactory (socketFactory )
504
518
.build ();
505
519
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory (
@@ -523,7 +537,17 @@ public void sslNeedsClientAuthenticationSucceedsWithClientCertificate()
523
537
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory (
524
538
new SSLContextBuilder ()
525
539
.loadTrustMaterial (null , new TrustSelfSignedStrategy ())
526
- .loadKeyMaterial (keyStore , "password" .toCharArray ()).build ());
540
+ .loadKeyMaterial (keyStore , "password" .toCharArray (),
541
+ new PrivateKeyStrategy () {
542
+
543
+ @ Override
544
+ public String chooseAlias (
545
+ Map <String , PrivateKeyDetails > aliases ,
546
+ Socket socket ) {
547
+ return "spring-boot" ;
548
+ }
549
+ })
550
+ .build ());
527
551
HttpClient httpClient = HttpClients .custom ().setSSLSocketFactory (socketFactory )
528
552
.build ();
529
553
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory (
@@ -614,7 +638,17 @@ public void sslWithCustomSslStoreProvider() throws Exception {
614
638
SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory (
615
639
new SSLContextBuilder ()
616
640
.loadTrustMaterial (null , new TrustSelfSignedStrategy ())
617
- .loadKeyMaterial (keyStore , "password" .toCharArray ()).build ());
641
+ .loadKeyMaterial (keyStore , "password" .toCharArray (),
642
+ new PrivateKeyStrategy () {
643
+
644
+ @ Override
645
+ public String chooseAlias (
646
+ Map <String , PrivateKeyDetails > aliases ,
647
+ Socket socket ) {
648
+ return "spring-boot" ;
649
+ }
650
+ })
651
+ .build ());
618
652
HttpClient httpClient = HttpClients .custom ().setSSLSocketFactory (socketFactory )
619
653
.build ();
620
654
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory (
0 commit comments