checkArgument(this.sslKeyStorePath != null,
"https configuration missing SSL key store path");
checkArgument(this.sslKeyStorePassword != null,
"https configuration missing SSL key store password");
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreType(this.sslKeyStoreType.name());
sslContextFactory.setKeyStorePath(this.sslKeyStorePath);
sslContextFactory.setKeyStorePassword(this.sslKeyStorePassword);
if (this.sslKeyPassword != null) {
sslContextFactory.setKeyManagerPassword(this.sslKeyPassword);
} else {
sslContextFactory
.setKeyManagerPassword(this.sslKeyStorePassword);
}
if (this.sslTrustStorePath != null) {
checkArgument(this.sslTrustStoreType != null,
"missing trust store type for trust store");
checkArgument(this.sslTrustStorePassword != null,
"missing password for trust store");
sslContextFactory.setTrustStoreType(this.sslTrustStoreType
.name());
sslContextFactory.setTrustStorePath(this.sslTrustStorePath);
sslContextFactory
.setTrustStorePassword(this.sslTrustStorePassword);
}
if (this.sslRequireClientCert) {
checkArgument(this.sslTrustStorePath != null,
"Client certificate authentication specified without "
+ "specifying a trust store");
checkArgument(this.sslTrustStorePassword != null,
"Client certificate authentication specified without "
+ "specifying a trust store password");
}
// if true: requires client to authenticate with certificate
sslContextFactory.setNeedClientAuth(this.sslRequireClientCert);
// if true: authenticates client certificate if provided
sslContextFactory.setWantClientAuth(false);
// HTTPS config
HttpConfiguration httpsConfig = new HttpConfiguration();
httpsConfig.addCustomizer(new SecureRequestCustomizer());
httpsConfig.setOutputBufferSize(32768);