@Override public void setHttpsConfigurator(final HttpsConfigurator httpsConfigurator) { delegate.setHttpsConfigurator(httpsConfigurator); }
server.setHttpsConfigurator(new HttpsConfigurator(sslContext) { @Override public void configure(HttpsParameters params) {
httpsServer.setHttpsConfigurator ( new HttpsConfigurator( sslContext )
((HttpsServer) server).setHttpsConfigurator(httpsConfigurator);
httpsServer.setHttpsConfigurator(new HttpsConfigurator(sslContext) { public void configure(HttpsParameters params) { try {
/** * Internal method which creates and starts the server. * * @param httpsMode True if the server to be started is HTTPS, false otherwise. * @return Started server. */ private static GridEmbeddedHttpServer createAndStart(boolean httpsMode) throws Exception { HttpServer httpSrv; InetSocketAddress addrToBind = new InetSocketAddress(HOSTNAME_TO_BIND_SRV, getAvailablePort()); if (httpsMode) { HttpsServer httpsSrv = HttpsServer.create(addrToBind, 0); httpsSrv.setHttpsConfigurator(new HttpsConfigurator(GridTestUtils.sslContext())); httpSrv = httpsSrv; } else httpSrv = HttpServer.create(addrToBind, 0); GridEmbeddedHttpServer embeddedHttpSrv = new GridEmbeddedHttpServer(); embeddedHttpSrv.proto = httpsMode ? "https" : "http"; embeddedHttpSrv.httpSrv = httpSrv; embeddedHttpSrv.httpSrv.start(); return embeddedHttpSrv; }
SSLContext ssl = SSLContext.getInstance("TLS"); KeyManagerFactory keyFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); KeyStore store = KeyStore.getInstance("JKS"); store.load(new FileInputStream(keystoreFile),keyPass.toCharArray()); keyFactory.init(store, keyPass.toCharArray()); TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustFactory.init(store); ssl.init(keyFactory.getKeyManagers(), trustFactory.getTrustManagers(), new SecureRandom()); HttpsConfigurator configurator = new HttpsConfigurator(ssl); HttpsServer httpsServer = HttpsServer.create(new InetSocketAddress(hostname, port), port); httpsServer.setHttpsConfigurator(configurator); HttpContext httpContext = httpsServer.createContext(uri); httpsServer.start(); endpoint.publish(httpContext);
@Override public HttpServer createHttpServerInstance(int port) throws IOException { try { HttpsServer server = HttpsServer.create(new InetSocketAddress(port), 5); server.setHttpsConfigurator(new HttpsConfigurator(sslContext) { @Override public void configure(HttpsParameters params) { // get the remote address if needed InetSocketAddress remote = params.getClientAddress(); SSLContext c = getSSLContext(); // get the default parameters SSLParameters sslparams = c.getDefaultSSLParameters(); params.setSSLParameters(sslparams); params.setProtocols(SSLUtils.getRecommendedProtocols()); params.setCipherSuites(SSLUtils.getRecommendedCiphers()); // statement above could throw IAE if any params invalid. // eg. if app has a UI and parameters supplied by a user. } }); s_logger.info("create HTTPS server instance on port: " + port); return server; } catch (Exception ioe) { s_logger.error(ioe.toString(), ioe); } return null; }
private HttpServer createHttpsServer(InetSocketAddress pSocketAddress, JolokiaServerConfig pConfig) { // initialise the HTTPS server try { HttpsServer server = HttpsServer.create(pSocketAddress, pConfig.getBacklog()); SSLContext sslContext = SSLContext.getInstance(pConfig.getSecureSocketProtocol()); // initialise the keystore KeyStore ks = getKeyStore(pConfig); // setup the key manager factory KeyManagerFactory kmf = getKeyManagerFactory(pConfig); kmf.init(ks, pConfig.getKeystorePassword()); // setup the trust manager factory TrustManagerFactory tmf = getTrustManagerFactory(pConfig); tmf.init(ks); // setup the HTTPS context and parameters sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); // Update the config to filter out bad protocols or ciphers pConfig.updateHTTPSSettingsFromContext(sslContext); server.setHttpsConfigurator(new JolokiaHttpsConfigurator(sslContext, pConfig)); return server; } catch (GeneralSecurityException e) { throw new IllegalStateException("Cannot use keystore for https communication: " + e,e); } catch (IOException e) { throw new IllegalStateException("Cannot open keystore for https communication: " + e,e); } }
@Override public void setHttpsConfigurator(HttpsConfigurator httpsConfigurator) { httpsServer.setHttpsConfigurator(httpsConfigurator); }
@Override public void setHttpsConfigurator(final HttpsConfigurator httpsConfigurator) { delegate.setHttpsConfigurator(httpsConfigurator); }
server.setHttpsConfigurator(new HttpsConfigurator(sslContext) { @Override public void configure(HttpsParameters params) {
HttpsConfigurator cfg = new HttpsConfigurator(sslCtx){ public void configure(HttpsParameters params) { SSLParameters sslparams = getSSLContext().getDefaultSSLParameters(); // Modify the default params: // Using this, server will require client certs //sslparams.setNeedClientAuth(true); // Using this, server will request client certs. But if not available, // it will continue anyway. sslparams.setWantClientAuth(true); params.setSSLParameters(sslparams); } }; HttpsServer httpsS = HttpsServer.create(new InetSocketAddress(8081), 50); httpsS.setHttpsConfigurator(cfg);
private static HttpsServer createHttpsServer(int port) throws Exception { generateCertificate(); HttpsServer httpsServer = HttpsServer.create(new InetSocketAddress(port), 0); SSLContext sslContext = getSslContext(); httpsServer.setHttpsConfigurator(new HttpsConfigurator(sslContext)); return httpsServer; }
private HttpServer createHttpsServer(InetSocketAddress pSocketAddress, JolokiaServerConfig pConfig) { // initialise the HTTPS server try { HttpsServer server = HttpsServer.create(pSocketAddress, pConfig.getBacklog()); SSLContext sslContext = SSLContext.getInstance(pConfig.getSecureSocketProtocol()); // initialise the keystore KeyStore ks = getKeyStore(pConfig); // setup the key manager factory KeyManagerFactory kmf = getKeyManagerFactory(pConfig); kmf.init(ks, pConfig.getKeystorePassword()); // setup the trust manager factory TrustManagerFactory tmf = getTrustManagerFactory(pConfig); tmf.init(ks); // setup the HTTPS context and parameters sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); // Update the config to filter out bad protocols or ciphers pConfig.updateHTTPSSettingsFromContext(sslContext); server.setHttpsConfigurator(new JolokiaHttpsConfigurator(sslContext, pConfig)); return server; } catch (GeneralSecurityException e) { throw new IllegalStateException("Cannot use keystore for https communication: " + e,e); } catch (IOException e) { throw new IllegalStateException("Cannot open keystore for https communication: " + e,e); } }
((HttpsServer) httpServer).setHttpsConfigurator(httpsConfigurator); } else {
theSSLContext.init( theKeyManagerFactory.getKeyManagers(), theTrustManagerFactory.getTrustManagers(), null ); HttpsServer theHttpsServer = HttpsServer.create( theAddress, aMaxConnections ); theHttpsServer.setHttpsConfigurator( new HttpsRestConfigurator( theSSLContext ) );
httpsServer.setHttpsConfigurator( new HttpsConfigurator( sslContext )
((HttpsServer)server).setHttpsConfigurator(configurator); RequestLimiter limiter = getRequestLimiterOrNull(config); ErrorRequestLimiter errorLimiter = getErrorRequestLimiterOrNull(config);
SSLContext sslContext = sslContextFactory.createSslContext(); final SSLParameters sslParams = sslContext.getDefaultSSLParameters(); server.setHttpsConfigurator(new HttpsConfigurator(sslContext) { public void configure(HttpsParameters params) { params.setSSLParameters(sslParams);