@Override public HttpTermOptions setTrustStoreOptions(JksOptions options) { return (HttpTermOptions) super.setTrustStoreOptions(options); }
assertEquals(options, options.setTrustStoreOptions(trustStoreOptions)); assertEquals(trustStoreOptions, options.getTrustOptions());
options.setTrustStoreOptions(new JksOptions() .setPath(httpServerConfiguration.getTrustStorePath()) .setPassword(httpServerConfiguration.getTrustStorePassword()));
@Override public void start(Future<Void> startFuture) { int port = NumberUtils.toInt(System.getProperty("io.apiman.test.common.echo.port"), 9998); HttpServerOptions httpServerOptions = getHttpServerOptions(); HttpServerOptions httpsServerOptions = getHttpsServerOptions() .setSsl(true) .setKeyStoreOptions(getKeystore()) .setTrustStoreOptions(getTrustStore()); // Plain HTTP server vertx.createHttpServer(httpServerOptions) .requestHandler(new EchoHandler()) .listen(port, result -> { if (result.succeeded()) { checkSuccess(startFuture, result); } else { startFuture.fail(result.cause()); } }); // HTTPS server vertx.createHttpServer(httpsServerOptions) .requestHandler(new EchoHandler()) .listen(port+1, result -> { if (result.succeeded()) { checkSuccess(startFuture, result); } else { startFuture.fail(result.cause()); } }); log.info("*** Starting EchoServerVertx on HTTP: {0} HTTPS: {1}", port, port+1); }
if (ssl) { options.setSsl(true); options.setTrustStoreOptions(SSLServerContext.getTrustStoreOption(accessor)); options.setKeyStoreOptions(SSLServerContext.getKeyStoreOption(accessor)); if (authentication) {
@Override public void start(Future<Void> startFuture) { super.start(startFuture); HttpApiFactory.init(engine.getApiRequestPathParser()); InheritingHttpServerOptions httpsServerOptions = new InheritingHttpServerOptions(); httpsServerOptions .setSsl(true) .setKeyStoreOptions( new JksOptions() .setPath(apimanConfig.getKeyStore()) .setPassword(apimanConfig.getKeyStorePassword()) ) .setTrustStoreOptions( new JksOptions() .setPath(apimanConfig.getTrustStore()) .setPassword(apimanConfig.getTrustStorePassword()) ); if (JdkSSLEngineOptions.isAlpnAvailable()) { httpsServerOptions.setUseAlpn(true); } // Load any provided configuration into the HttpServerOptions. JsonObject httpServerOptionsJson = apimanConfig.getVerticleConfig(verticleType().name()) .getJsonObject("httpServerOptions", new JsonObject()); //$NON-NLS-1$ InheritingHttpServerOptionsConverter.fromJson(httpServerOptionsJson, httpsServerOptions); vertx.createHttpServer(httpsServerOptions) .requestHandler(this::requestHandler) .listen(apimanConfig.getPort(VERTICLE_TYPE), apimanConfig.getHostname()); }
.setPassword(apimanConfig.getKeyStorePassword()) .setTrustStoreOptions( new JksOptions() .setPath(apimanConfig.getTrustStore())
@Override public HttpServer getObject() throws Exception { HttpServerOptions options = new HttpServerOptions(); // Binding port options.setPort(httpServerConfiguration.getPort()); // Netty pool buffers must be enabled by default options.setUsePooledBuffers(true); if (httpServerConfiguration.isSecured()) { options.setSsl(httpServerConfiguration.isSecured()); options.setClientAuthRequired(httpServerConfiguration.isClientAuth()); options.setTrustStoreOptions(new JksOptions() .setPath(httpServerConfiguration.getKeyStorePath()) .setPassword(httpServerConfiguration.getKeyStorePassword())); options.setKeyStoreOptions(new JksOptions() .setPath(httpServerConfiguration.getTrustStorePath()) .setPassword(httpServerConfiguration.getKeyStorePassword())); } // Customizable configuration options.setCompressionSupported(httpServerConfiguration.isCompressionSupported()); options.setIdleTimeout(httpServerConfiguration.getIdleTimeout()); options.setTcpKeepAlive(httpServerConfiguration.isTcpKeepAlive()); return vertx.createHttpServer(options); }
assertEquals(options, options.setTrustStoreOptions(trustStoreOptions)); assertEquals(trustStoreOptions, options.getTrustOptions());
options.setTrustStoreOptions(new JksOptions() .setPath(httpServerConfiguration.getTrustStorePath()) .setPassword(httpServerConfiguration.getTrustStorePassword()));
@Test public void testClientAuthFail(TestContext ctx) throws Exception { testSimple(options -> options .setTrustAll(true) .setSsl(true) .setUseAlpn(true), options -> options .setSsl(true) .setUseAlpn(true) .setKeyStoreOptions(new JksOptions() .setPath("tls/server-keystore.jks") .setPassword("wibble")) .setClientAuth(ClientAuth.REQUIRED) .setTrustStoreOptions(new JksOptions() .setPath("tls/client-truststore.jks") .setPassword("wibble")), ctx, false); }
options.setTrustStoreOptions(new JksOptions() .setPath(httpServerConfiguration.getTrustStorePath()) .setPassword(httpServerConfiguration.getTrustStorePassword()));
@Test public void testClientAuth(TestContext ctx) throws Exception { testSimple(options -> options .setTrustAll(true) .setSsl(true) .setUseAlpn(true) .setKeyStoreOptions(new JksOptions() .setPath("tls/server-keystore.jks") .setPassword("wibble")) , options -> options .setSsl(true) .setUseAlpn(true) .setKeyStoreOptions(new JksOptions() .setPath("tls/server-keystore.jks") .setPassword("wibble")) .setClientAuth(ClientAuth.REQUIRED) .setTrustStoreOptions(new JksOptions() .setPath("tls/client-truststore.jks") .setPassword("wibble")), ctx, true); }