Merge branch '3.4.x'

This commit is contained in:
Andy Wilkinson 2025-02-28 12:26:04 +00:00
commit f715a3676f

View File

@ -662,12 +662,12 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
} }
@Test @Test
@WithPackageResources({ "1.crt", "1.key", "2.crt", "2.key" })
void shouldUpdateSslWhenReloadingSslBundles() throws Exception { void shouldUpdateSslWhenReloadingSslBundles() throws Exception {
TomcatServletWebServerFactory factory = getFactory(); TomcatServletWebServerFactory factory = getFactory();
addTestTxtFile(factory); addTestTxtFile(factory);
DefaultSslBundleRegistry bundles = new DefaultSslBundleRegistry("test", DefaultSslBundleRegistry bundles = new DefaultSslBundleRegistry("test",
createPemSslBundle("classpath:org/springframework/boot/web/embedded/tomcat/1.crt", createPemSslBundle("classpath:1.crt", "classpath:1.key"));
"classpath:org/springframework/boot/web/embedded/tomcat/1.key"));
factory.setSslBundles(bundles); factory.setSslBundles(bundles);
factory.setSsl(Ssl.forBundle("test")); factory.setSsl(Ssl.forBundle("test"));
this.webServer = factory.getWebServer(); this.webServer = factory.getWebServer();
@ -679,8 +679,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test"); assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test");
assertThat(verifier.getLastPrincipal()).isEqualTo("CN=1"); assertThat(verifier.getLastPrincipal()).isEqualTo("CN=1");
requestFactory = createHttpComponentsRequestFactory(tlsSocketStrategy); requestFactory = createHttpComponentsRequestFactory(tlsSocketStrategy);
bundles.updateBundle("test", createPemSslBundle("classpath:org/springframework/boot/web/embedded/tomcat/2.crt", bundles.updateBundle("test", createPemSslBundle("classpath:2.crt", "classpath:2.key"));
"classpath:org/springframework/boot/web/embedded/tomcat/2.key"));
assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test"); assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test");
assertThat(verifier.getLastPrincipal()).isEqualTo("CN=2"); assertThat(verifier.getLastPrincipal()).isEqualTo("CN=2");
} }