From 6dc58fd625279f8ffe1060170418686034db0af4 Mon Sep 17 00:00:00 2001 From: vasraz Date: Wed, 2 Oct 2019 12:08:49 +0100 Subject: Fix name convention issue Rename modules: workflow-designer-init to sdc-workflow-designer-init workflow-designer-be to sdc-workflow-designer-be workflow-designer-ui to sdc-workflow-designer-ui Rename docker images: onap/workflow-init to onap/sdc-workflow-init onap/workflow-backend to onap/sdc-workflow-backend onap/workflow-frontend to onap/sdc-workflow-frontend List of changed files: modified: README.md modified: docker-compose/debug.yml modified: docker-compose/docker-compose.yml modified: pom.xml modified: sdc-workflow-bdd/pom.xml modified: sdc-workflow-designer-be/pom.xml modified: sdc-workflow-designer-init/pom.xml modified: sdc-workflow-designer-ui/pom.xml modified: sdc-workflow-designer-ui/src/main/frontend/yarn.lock modified: version.properties All others changes are relaited to rename/move. Change-Id: Ic989b6347b815f85e77e23fc8d7884c05b650a27 Issue-ID: SDC-2334 Issue-ID: SDC-2335 Signed-off-by: Vasyl Razinkov --- .../org/onap/workflow/web/SSLProxyServlet.java | 211 --------------------- 1 file changed, 211 deletions(-) delete mode 100644 workflow-designer-ui/src/main/java/org/onap/workflow/web/SSLProxyServlet.java (limited to 'workflow-designer-ui/src/main/java/org') diff --git a/workflow-designer-ui/src/main/java/org/onap/workflow/web/SSLProxyServlet.java b/workflow-designer-ui/src/main/java/org/onap/workflow/web/SSLProxyServlet.java deleted file mode 100644 index 775706d2..00000000 --- a/workflow-designer-ui/src/main/java/org/onap/workflow/web/SSLProxyServlet.java +++ /dev/null @@ -1,211 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - - -package org.onap.workflow.web; - - -import org.eclipse.jetty.client.HttpClient; -import org.eclipse.jetty.client.api.Request; -import org.eclipse.jetty.http.HttpHeader; -import org.eclipse.jetty.http.HttpScheme; -import org.eclipse.jetty.proxy.ProxyServlet; -import org.eclipse.jetty.util.URIUtil; -import org.eclipse.jetty.util.ssl.SslContextFactory; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; - - -/*** - * Class that provides the proxy implementation for both secured and unsecured backend connections. - * - * The following nevironment value is mandatory: - * proxyTo - the full URL to the backend server (including protocol and context path if relevant) - * - * In case of a secured connection (proxyTo starting with https) the following may be set: - * sslTrustAll - set to true if all secure connection are accepted - * maxPoolConnections - number of connection in the pool, only when overriding the jetty default - * - * In case of SSL and nto trusting all certificates: - * keystorePath - path to the keystore - * keystoreType - type of the keystore - * keystorePassword - keystore password - * - * truststorePath - path to the truststore - * truststoreType - type of the truststore - * truststorePassword - truststore password - - */ - -public class SSLProxyServlet extends ProxyServlet { - - - public static final int TIMEOUT = 600000; - protected static final String PROXY_TO = "proxyTo"; - protected static final String TRUST_ALL = "sslTrustAll"; - protected static final String MAX_POOL_CONNECTIONS = "maxPoolConnections"; - protected static final String KEYSTORE_PATH = "keystorePath"; - protected static final String KEYSTORE_TYPE = "keystoreType"; - protected static final String KEYSTORE_P = "keystorePassword"; - protected static final String KEYMANAGER_P = "keyManagerPassword"; - protected static final String KEYSTORE_CYPHER = "keystoreCypher"; - protected static final String TRUSTSTORE_PATH = "truststorePath"; - protected static final String TRUSTSTORE_TYPE = "truststoreType"; - protected static final String TRUSTSTORE_P = "truststorePassword"; - protected static final String ENDPOINT_IDENTIFICATION_ALGORITHM = "endpointIdentificationAlgorithm"; - private static final long serialVersionUID = 1L; - private static URL proxyUrl = null; - - - private static void setProxyUrl(URL proxy) { - SSLProxyServlet.proxyUrl = proxy; - } - - private void initProxyUrl() throws ServletException, MalformedURLException { - - if (SSLProxyServlet.proxyUrl != null) - return; - String proxyUrlStr = System.getProperty(PROXY_TO); - if (proxyUrlStr == null) { - throw new ServletException("-D" + PROXY_TO + " must be specified"); - } - setProxyUrl(new URL(proxyUrlStr)); - } - - - @Override - public void init() throws ServletException { - super.init(); - try { - initProxyUrl(); - } catch (MalformedURLException e) { - throw new ServletException(e); - } - } - - - @Override - public void sendProxyRequest(HttpServletRequest request, HttpServletResponse response, Request proxyRequest) { - - @SuppressWarnings("unchecked") - Enumeration headerNames = request.getHeaderNames(); - while (headerNames.hasMoreElements()) { - String headerName = headerNames.nextElement(); - if (!proxyRequest.getHeaders().containsKey(headerName)) { - String headerVal = request.getHeader(headerName); - proxyRequest.header(headerName, headerVal); - } - } - proxyRequest.getHeaders().remove(HttpHeader.HOST); - super.sendProxyRequest(request, response, proxyRequest); - - } - - @Override - protected HttpClient newHttpClient() { - // ioverride parent method to be able to create a secured client as well. - boolean isSecureClient = ( - proxyUrl.getProtocol() != null && - proxyUrl.getProtocol().equalsIgnoreCase(HttpScheme.HTTPS.toString())); - if ((isSecureClient)) { - String trustAll = System.getProperty(TRUST_ALL); - SslContextFactory sslContextFactory = null; - if (trustAll != null && Boolean.parseBoolean(trustAll) == Boolean.TRUE) { - sslContextFactory = new SslContextFactory.Client(true); - } else { - sslContextFactory = new SslContextFactory.Client(false); - // setting up truststore - sslContextFactory.setTrustStorePath(System.getProperty(TRUSTSTORE_PATH)); - sslContextFactory.setTrustStorePassword(System.getProperty(TRUSTSTORE_P)); - sslContextFactory.setTrustStoreType(System.getProperty(TRUSTSTORE_TYPE)); - // setting up keystore - sslContextFactory.setKeyStorePath(System.getProperty(KEYSTORE_PATH)); - sslContextFactory.setKeyStorePassword(System.getProperty(KEYSTORE_P)); - sslContextFactory.setKeyStoreType(System.getProperty(KEYSTORE_TYPE)); - sslContextFactory.setKeyManagerPassword(System.getProperty(KEYMANAGER_P)); - - if (System.getProperty(ENDPOINT_IDENTIFICATION_ALGORITHM) != null && - !System.getProperty(ENDPOINT_IDENTIFICATION_ALGORITHM).equals("")) { - sslContextFactory - .setEndpointIdentificationAlgorithm(System.getProperty(ENDPOINT_IDENTIFICATION_ALGORITHM)); - } - - if (System.getProperty(KEYSTORE_CYPHER) != null && - !System.getProperty(KEYSTORE_CYPHER).equals("")) { - sslContextFactory.setIncludeCipherSuites(System.getProperty(KEYSTORE_CYPHER)); - } - } - - return new HttpClient(sslContextFactory); - - } else { - return super.newHttpClient(); - } - - } - - @Override - protected HttpClient createHttpClient() throws ServletException { - - try { - initProxyUrl(); - } catch (MalformedURLException e) { - throw new ServletException(e); - } - // calling the parent and setting the configuration for our implementation - HttpClient client = super.createHttpClient(); - setTimeout(TIMEOUT); - client.setIdleTimeout(TIMEOUT); - client.setStopTimeout(TIMEOUT); - if (System.getProperty(MAX_POOL_CONNECTIONS) != null) { - client.setMaxConnectionsPerDestination( - Integer.valueOf(System.getProperty(MAX_POOL_CONNECTIONS))); - } - return client; - - } - - - - @Override - protected String rewriteTarget(HttpServletRequest request) { - - String path = proxyUrl.getPath(); - if (request.getServletPath() != null) { - path += request.getServletPath(); - } - if (request.getPathInfo() != null) { - path += request.getPathInfo(); - } - - return URIUtil.newURI( - proxyUrl.getProtocol(), - proxyUrl.getHost(), - proxyUrl.getPort(), - path, - request.getQueryString()); - } - -} -- cgit 1.2.3-korg