ExternalResourceConfig.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.utils.transport.http;

  21. import java.security.KeyStore;
  22. import java.security.cert.CertStore;
  23. import java.util.ArrayList;
  24. import java.util.List;
  25. import java.util.Map;

  26. /**
  27.  * ExternalResourceConfig
  28.  *
  29.  * @author Andrea Poli (apoli@link.it)
  30.  * @author $Author$
  31.  * @version $Rev$, $Date$
  32.  */
  33. public class ExternalResourceConfig {

  34.     // !! NOTA !!: se si aggiunge un field, bisogna gestirlo nel metodo in org.openspcoop2.utils.certificate.remote.RemoteStoreConfig.newInstanceMultitenant()
  35.    
  36.     protected int readTimeout = HttpUtilities.HTTP_READ_CONNECTION_TIMEOUT;
  37.     protected int connectTimeout = HttpUtilities.HTTP_CONNECTION_TIMEOUT;
  38.    
  39.     protected List<Integer> returnCode = new ArrayList<>();
  40.     public ExternalResourceConfig (){
  41.         this.returnCode.add(200);
  42.     }

  43.     protected String basicUsername;
  44.     protected String basicPassword;
  45.    
  46.     protected boolean hostnameVerifier = true;
  47.    
  48.     protected boolean trustAllCerts = false;

  49.     protected KeyStore trustStore;
  50.    
  51.     protected CertStore crlStore;
  52.    
  53.     protected KeyStore keyStore;
  54.     protected String keyAlias;
  55.     protected String keyPassword;
  56.    
  57.     protected String forwardProxyUrl;
  58.     protected String forwardProxyHeader;
  59.     protected String forwardProxyQueryParameter;
  60.     protected boolean forwardProxyBase64;

  61.     protected Map<String, String> headers;
  62.     protected Map<String, String> queryParameters;
  63.    
  64.     // multi-tenant
  65.     protected Map<String, String> multiTenantBaseUrl;
  66.     protected Map<String, String> multiTenantBasicUsername;
  67.     protected Map<String, String> multiTenantBasicPassword;
  68.     protected Map<String, Map<String, String>> multiTenantHeaders;
  69.     protected Map<String, Map<String, String>> multiTenantQueryParameters;
  70.    
  71.     // !! NOTA !!: se si aggiunge un field, bisogna gestirlo nel metodo in org.openspcoop2.utils.certificate.remote.RemoteStoreConfig.newInstanceMultitenant()
  72.    
  73.     public int getReadTimeout() {
  74.         return this.readTimeout;
  75.     }

  76.     public void setReadTimeout(int readTimeout) {
  77.         this.readTimeout = readTimeout;
  78.     }

  79.     public int getConnectTimeout() {
  80.         return this.connectTimeout;
  81.     }

  82.     public void setConnectTimeout(int connectTimeout) {
  83.         this.connectTimeout = connectTimeout;
  84.     }
  85.    
  86.     public List<Integer> getReturnCode() {
  87.         return this.returnCode;
  88.     }

  89.     public void setReturnCode(List<Integer> returnCode) {
  90.         this.returnCode = returnCode;
  91.     }
  92.    
  93.     public String getBasicUsername() {
  94.         return this.basicUsername;
  95.     }

  96.     public void setBasicUsername(String basicUsername) {
  97.         this.basicUsername = basicUsername;
  98.     }

  99.     public String getBasicPassword() {
  100.         return this.basicPassword;
  101.     }

  102.     public void setBasicPassword(String basicPassword) {
  103.         this.basicPassword = basicPassword;
  104.     }
  105.    
  106.     public boolean isHostnameVerifier() {
  107.         return this.hostnameVerifier;
  108.     }

  109.     public void setHostnameVerifier(boolean hostnameVerifier) {
  110.         this.hostnameVerifier = hostnameVerifier;
  111.     }

  112.    
  113.     public boolean isTrustAllCerts() {
  114.         return this.trustAllCerts;
  115.     }

  116.     public void setTrustAllCerts(boolean trustAllCerts) {
  117.         this.trustAllCerts = trustAllCerts;
  118.     }

  119.     public KeyStore getTrustStore() {
  120.         return this.trustStore;
  121.     }

  122.     public void setTrustStore(KeyStore trustStore) {
  123.         this.trustStore = trustStore;
  124.     }

  125.     public CertStore getCrlStore() {
  126.         return this.crlStore;
  127.     }

  128.     public void setCrlStore(CertStore crlStore) {
  129.         this.crlStore = crlStore;
  130.     }

  131.     public KeyStore getKeyStore() {
  132.         return this.keyStore;
  133.     }

  134.     public void setKeyStore(KeyStore keyStore) {
  135.         this.keyStore = keyStore;
  136.     }
  137.    
  138.     public String getKeyAlias() {
  139.         return this.keyAlias;
  140.     }

  141.     public void setKeyAlias(String keyAlias) {
  142.         this.keyAlias = keyAlias;
  143.     }

  144.     public String getKeyPassword() {
  145.         return this.keyPassword;
  146.     }

  147.     public void setKeyPassword(String keyPassword) {
  148.         this.keyPassword = keyPassword;
  149.     }
  150.    
  151.     public String getForwardProxyUrl() {
  152.         return this.forwardProxyUrl;
  153.     }

  154.     public void setForwardProxyUrl(String forwardProxyUrl) {
  155.         this.forwardProxyUrl = forwardProxyUrl;
  156.     }

  157.     public String getForwardProxyHeader() {
  158.         return this.forwardProxyHeader;
  159.     }

  160.     public void setForwardProxyHeader(String forwardProxyHeader) {
  161.         this.forwardProxyHeader = forwardProxyHeader;
  162.     }

  163.     public String getForwardProxyQueryParameter() {
  164.         return this.forwardProxyQueryParameter;
  165.     }

  166.     public void setForwardProxyQueryParameter(String forwardProxyQueryParameter) {
  167.         this.forwardProxyQueryParameter = forwardProxyQueryParameter;
  168.     }

  169.     public boolean isForwardProxyBase64() {
  170.         return this.forwardProxyBase64;
  171.     }

  172.     public void setForwardProxyBase64(boolean forwardProxyBase64) {
  173.         this.forwardProxyBase64 = forwardProxyBase64;
  174.     }
  175.    
  176.     public Map<String, String> getHeaders() {
  177.         return this.headers;
  178.     }

  179.     public void setHeaders(Map<String, String> headers) {
  180.         this.headers = headers;
  181.     }

  182.     public Map<String, String> getQueryParameters() {
  183.         return this.queryParameters;
  184.     }

  185.     public void setQueryParameters(Map<String, String> queryParameters) {
  186.         this.queryParameters = queryParameters;
  187.     }

  188.     public Map<String, String> getMultiTenantBaseUrl() {
  189.         return this.multiTenantBaseUrl;
  190.     }

  191.     public void setMultiTenantBaseUrl(Map<String, String> multiTenantBaseUrl) {
  192.         this.multiTenantBaseUrl = multiTenantBaseUrl;
  193.     }
  194.    
  195.     public Map<String, String> getMultiTenantBasicUsername() {
  196.         return this.multiTenantBasicUsername;
  197.     }

  198.     public void setMultiTenantBasicUsername(Map<String, String> multiTenantBasicUsername) {
  199.         this.multiTenantBasicUsername = multiTenantBasicUsername;
  200.     }

  201.     public Map<String, String> getMultiTenantBasicPassword() {
  202.         return this.multiTenantBasicPassword;
  203.     }

  204.     public void setMultiTenantBasicPassword(Map<String, String> multiTenantBasicPassword) {
  205.         this.multiTenantBasicPassword = multiTenantBasicPassword;
  206.     }

  207.     public Map<String, Map<String, String>> getMultiTenantHeaders() {
  208.         return this.multiTenantHeaders;
  209.     }

  210.     public void setMultiTenantHeaders(Map<String, Map<String, String>> multiTenantHeaders) {
  211.         this.multiTenantHeaders = multiTenantHeaders;
  212.     }

  213.     public Map<String, Map<String, String>> getMultiTenantQueryParameters() {
  214.         return this.multiTenantQueryParameters;
  215.     }

  216.     public void setMultiTenantQueryParameters(Map<String, Map<String, String>> multiTenantQueryParameters) {
  217.         this.multiTenantQueryParameters = multiTenantQueryParameters;
  218.     }
  219. }