I am migrating from Jetty 9.0 to 9.4
Apparently, following method from SSLContextFactory is removed from 9.3.0
public void checkKeyStore()
I checked api documentation but did not get any replacement for this nor it was deprecated in 9.2.x and directly got removed in 9.3.0.
I am not security expert but here is my code and I am not exactly sure how should I get around this in 9.4.x
private void configureHttps(Server server, int httpsPort, JettyAppConfig config, HttpConfiguration httpConfig)
throws Exception {
boolean shouldStartHttpsPort = false;
SslContextFactory sslContextFactory = createJettySslContextFactory();
if (sslContextFactory != null) {
shouldStartHttpsPort = true;
try {
sslContextFactory.checkKeyStore(); //NEED REPLACEMENT in 9.4
} catch (IllegalStateException e) {
logger.debug("keystore check failed", e);
shouldStartHttpsPort = false;
}
}
if (shouldStartHttpsPort) {
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
ServerConnector httpsConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfig));
httpsConnector.setPort(httpsPort);
httpsConnector.setIdleTimeout(config.getConnectionIdleTimeout());
server.addConnector(httpsConnector);
} else {
logger.info("Keystore not configured, not starting HTTPS");
}
}