Merge branch '1.5.x'
This commit is contained in:
@@ -316,8 +316,12 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
|
||||
keyPassword = ssl.getKeyStorePassword().toCharArray();
|
||||
}
|
||||
keyManagerFactory.init(keyStore, keyPassword);
|
||||
return getConfigurableAliasKeyManagers(ssl,
|
||||
keyManagerFactory.getKeyManagers());
|
||||
if (ssl.getKeyAlias() != null) {
|
||||
return getConfigurableAliasKeyManagers(ssl,
|
||||
keyManagerFactory.getKeyManagers());
|
||||
}
|
||||
return keyManagerFactory.getKeyManagers();
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.SSLHandshakeException;
|
||||
|
||||
import io.undertow.Undertow.Builder;
|
||||
@@ -42,6 +43,7 @@ import org.springframework.boot.testsupport.web.servlet.ExampleServlet;
|
||||
import org.springframework.boot.web.server.ErrorPage;
|
||||
import org.springframework.boot.web.server.MimeMappings.Mapping;
|
||||
import org.springframework.boot.web.server.PortInUseException;
|
||||
import org.springframework.boot.web.server.Ssl;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests;
|
||||
@@ -248,6 +250,16 @@ public class UndertowServletWebServerFactoryTests
|
||||
new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getKeyManagersWhenAliasIsNullShouldNotDecorate() throws Exception {
|
||||
UndertowServletWebServerFactory factory = getFactory();
|
||||
Ssl ssl = getSsl(null, "password", "src/test/resources/test.jks");
|
||||
factory.setSsl(ssl);
|
||||
KeyManager[] keyManagers = ReflectionTestUtils.invokeMethod(factory, "getKeyManagers");
|
||||
Class<?> name = Class.forName("org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory$ConfigurableAliasKeyManager");
|
||||
assertThat(keyManagers[0]).isNotInstanceOf(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JspServlet getJspServlet() {
|
||||
return null; // Undertow does not support JSPs
|
||||
|
||||
Reference in New Issue
Block a user