ModISecurityUtils.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.protocol.utils;

  21. import java.util.List;

  22. import org.openspcoop2.core.constants.CostantiDB;
  23. import org.openspcoop2.core.registry.AccordoServizioParteComune;
  24. import org.openspcoop2.core.registry.utils.RegistroServiziUtils;

  25. /**
  26.  * ModISecurityUtils
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class ModISecurityUtils {
  33.    
  34.     private ModISecurityUtils() {
  35.     }
  36.    
  37.     public static List<String> getProfiloSicurezzaMessaggio(AccordoServizioParteComune api, String portType) {
  38.         return getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO, api, portType, false);
  39.     }
  40.     public static List<String> getProfiloSicurezzaMessaggioConSorgenteToken(AccordoServizioParteComune api, String portType) {
  41.         return getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO,
  42.                 CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH,
  43.                 api, portType, false);
  44.     }
  45.     public static boolean isProfiloSicurezzaMessaggioConIntegrita(AccordoServizioParteComune api, String portType) {
  46.         List<String> tmp = getProfiloSicurezzaMessaggio(api, portType);
  47.         if(tmp!=null && !tmp.isEmpty()) {
  48.             for (String profiloSicurezzaMessaggio : tmp) {
  49.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(profiloSicurezzaMessaggio) ||
  50.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(profiloSicurezzaMessaggio) ||
  51.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(profiloSicurezzaMessaggio) ||
  52.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(profiloSicurezzaMessaggio)) {
  53.                     return true;
  54.                 }      
  55.             }
  56.         }
  57.         return false;
  58.     }
  59.     public static boolean isProfiloSicurezzaMessaggioCorniceSicurezza(AccordoServizioParteComune api, String portType) {
  60.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA, api, portType, true);
  61.         if(tmp!=null && !tmp.isEmpty()) {
  62.             for (String v : tmp) {
  63.                 if(v!=null && "true".equals(v)) {
  64.                     return true;
  65.                 }
  66.             }
  67.         }
  68.         return false;
  69.     }
  70.     public static String getProfiloSicurezzaMessaggioCorniceSicurezzaPattern(AccordoServizioParteComune api, String portType) {
  71.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN, api, portType, false);
  72.         if(tmp!=null && !tmp.isEmpty()) {
  73.             return tmp.get(0);
  74.         }
  75.         return null;
  76.     }
  77.     public static String getProfiloSicurezzaMessaggioCorniceSicurezzaSchema(AccordoServizioParteComune api, String portType) {
  78.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SCHEMA, api, portType, false);
  79.         if(tmp!=null && !tmp.isEmpty()) {
  80.             return tmp.get(0);
  81.         }
  82.         return null;
  83.     }
  84.     public static boolean isProfiloSicurezzaMessaggioConHeaderDuplicati(AccordoServizioParteComune api, String portType) {
  85.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER,
  86.                 CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH,
  87.                 api, portType, false);
  88.         if(tmp!=null && !tmp.isEmpty()) {
  89.             for (String headerSorgenteToken : tmp) {
  90.                
  91.                 List<String> splitValues = RegistroServiziUtils.splitPropertyProtocolloResult(headerSorgenteToken);
  92.                 String header = splitValues.get(0);
  93.                 String sorgenteToken = splitValues.get(1);
  94.                
  95.                 if(
  96.                         (CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA.equals(header) ||
  97.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA_AUTH_IN_RESPONSE.equals(header) ||
  98.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM.equals(header) ||
  99.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE.equals(header))
  100.                         &&
  101.                     (isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken))
  102.                     ){
  103.                     return true;
  104.                 }      
  105.             }
  106.         }
  107.         return false;
  108.     }
  109.     public static boolean isProfiloSicurezzaMessaggioConSorgenteTokenNonLocale(AccordoServizioParteComune api, String portType, boolean rest) {
  110.         if(rest) {
  111.             return isProfiloSicurezzaMessaggioRestConSorgenteTokenNonLocale(api, portType);
  112.         }
  113.         else {
  114.             return isProfiloSicurezzaMessaggioSoapConSorgenteTokenNonLocale(api, portType);
  115.         }
  116.     }
  117.     public static boolean isProfiloSicurezzaMessaggioRestConSorgenteTokenNonLocale(AccordoServizioParteComune api, String portType) {
  118.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER,
  119.                 CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH,
  120.                 api, portType, false);
  121.         if(tmp!=null && !tmp.isEmpty()) {
  122.             for (String headerSorgenteToken : tmp) {
  123.                
  124.                 List<String> splitValues = RegistroServiziUtils.splitPropertyProtocolloResult(headerSorgenteToken);
  125.                 String sorgenteToken = splitValues.get(1);
  126.                
  127.                 if(!isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken) ) {
  128.                     return true;
  129.                 }      
  130.             }
  131.         }
  132.         return false;
  133.     }
  134.     public static boolean isProfiloSicurezzaMessaggioSoapConSorgenteTokenNonLocale(AccordoServizioParteComune api, String portType) {
  135.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH,
  136.                 api, portType, false);
  137.         if(tmp!=null && !tmp.isEmpty()) {
  138.             String sorgenteToken = tmp.get(0);
  139.             if(!isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken) ) {
  140.                 return true;
  141.             }      
  142.         }
  143.         return false;
  144.     }
  145.     private static List<String> getPropertySicurezzaMessaggioEngine(String propertyName, AccordoServizioParteComune api, String portType, boolean booleanValue) {
  146.         return RegistroServiziUtils.fillPropertyProtocollo(propertyName, api, portType, booleanValue);
  147.     }
  148.     private static List<String> getPropertySicurezzaMessaggioEngine(String propertyName, String propertyName2, AccordoServizioParteComune api, String portType, boolean booleanValue) {
  149.         return RegistroServiziUtils.fillPropertyProtocollo(propertyName, propertyName2, api, portType, booleanValue);
  150.     }
  151.    
  152.     public static boolean isSicurezzaMessaggioRequired(AccordoServizioParteComune api, String portType) {
  153.        
  154.         List<String> apiValues = getProfiloSicurezzaMessaggioConSorgenteToken(api, portType);
  155.         if(apiValues!=null && !apiValues.isEmpty()) {
  156.             for (String sicurezzaMessaggioSorgenteToken : apiValues) {
  157.                
  158.                 List<String> splitValues = RegistroServiziUtils.splitPropertyProtocolloResult(sicurezzaMessaggioSorgenteToken);
  159.                 String sicurezzaMessaggio = splitValues.get(0);
  160.                 String sorgenteToken = splitValues.get(1);
  161.                
  162.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01.equals(sicurezzaMessaggio) ||
  163.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02.equals(sicurezzaMessaggio)) {
  164.                     if(isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken)) {
  165.                         return true;
  166.                     }
  167.                 }
  168.                 else if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(sicurezzaMessaggio) ||
  169.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(sicurezzaMessaggio) ||
  170.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(sicurezzaMessaggio) ||
  171.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(sicurezzaMessaggio)) {
  172.                     return true;
  173.                 }
  174.             }
  175.         }
  176.        
  177.         return false;
  178.     }
  179.    
  180.     // NOTA: riferito dalla classe org.openspcoop2.web.ctrlstat.servlet.pa.PorteApplicativeServizioApplicativoAutorizzatoUtilities tramite reflection
  181.     public static boolean isSicurezzaMessaggioRiferimentoX509Required(AccordoServizioParteComune api, String portType) {
  182.        
  183.         // ne basta uno presente
  184.        
  185.         List<String> apiValues = getProfiloSicurezzaMessaggioConSorgenteToken(api, portType);
  186.         if(apiValues!=null && !apiValues.isEmpty()) {
  187.             for (String sicurezzaMessaggioSorgenteToken : apiValues) {
  188.                
  189.                 List<String> splitValues = RegistroServiziUtils.splitPropertyProtocolloResult(sicurezzaMessaggioSorgenteToken);
  190.                 String sicurezzaMessaggio = splitValues.get(0);
  191.                 String sorgenteToken = splitValues.get(1);
  192.                
  193.                 boolean x509 = false;
  194.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01.equals(sicurezzaMessaggio) ||
  195.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02.equals(sicurezzaMessaggio)) {
  196.                     x509 = isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken);
  197.                 }
  198.                 else if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(sicurezzaMessaggio) ||
  199.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(sicurezzaMessaggio)) {
  200.                     x509 = true;
  201.                 }
  202.                 else if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(sicurezzaMessaggio) ||
  203.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(sicurezzaMessaggio)) {
  204.                     // (per token id-auth)
  205.                     x509 =isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken);
  206.                 }
  207.                 if(x509) {
  208.                     return true;
  209.                 }
  210.             }
  211.         }
  212.        
  213.         return false;
  214.     }
  215.    
  216.     public static boolean isSicurezzaMessaggioKidModeSupported(AccordoServizioParteComune api, String portType) {
  217.        
  218.         List<String> apiValues = getProfiloSicurezzaMessaggioConSorgenteToken(api, portType);
  219.         if(apiValues!=null && !apiValues.isEmpty()) {
  220.             for (String sicurezzaMessaggioSorgenteToken : apiValues) {
  221.                
  222.                 List<String> splitValues = RegistroServiziUtils.splitPropertyProtocolloResult(sicurezzaMessaggioSorgenteToken);
  223.                 String sicurezzaMessaggio = splitValues.get(0);
  224.                 String sorgenteToken = splitValues.get(1);
  225.                
  226.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01.equals(sicurezzaMessaggio) ||
  227.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02.equals(sicurezzaMessaggio)) {
  228.                     if(!isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(sorgenteToken)) {
  229.                         return true;
  230.                     }
  231.                 }
  232.                 /**else if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(sicurezzaMessaggio) ||
  233.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(sicurezzaMessaggio)) {
  234.                     // kidMode non permesso
  235.                 }*/
  236.                 else if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(sicurezzaMessaggio) ||
  237.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(sicurezzaMessaggio)) {
  238.                     return true;
  239.                 }
  240.                
  241.             }
  242.         }
  243.        
  244.         return false;
  245.     }
  246.    
  247.     public static boolean existsAlmostOneProfiloSicurezzaMessaggioGenerazioneTokenIdAuthRemoto(AccordoServizioParteComune api, String portType) {
  248.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH, api, portType, false);
  249.         if(tmp!=null && !tmp.isEmpty()) {
  250.             for (String sorgenteToken : tmp) {
  251.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND.equals(sorgenteToken) ||
  252.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH.equals(sorgenteToken)) {
  253.                     return true;
  254.                 }
  255.             }
  256.         }
  257.         return false; // default
  258.     }
  259.     public static boolean existsAlmostOneProfiloSicurezzaMessaggioGenerazioneTokenIdAuthLocale(AccordoServizioParteComune api, String portType) {
  260.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH, api, portType, false);
  261.         if(tmp!=null && !tmp.isEmpty()) {
  262.             for (String sorgenteToken : tmp) {
  263.                 if(! (CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND.equals(sorgenteToken) ||
  264.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH.equals(sorgenteToken)) ) {
  265.                     return true;
  266.                 }
  267.             }
  268.         }
  269.         return false;
  270.     }
  271.     private static boolean isSicurezzaMessaggioGenerazioneTokenIdAuthLocale(String sorgenteToken) {
  272.         return !(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND.equals(sorgenteToken) ||
  273.                  CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH.equals(sorgenteToken));
  274.     }
  275.    
  276.     public static boolean isSicurezzaMessaggioGenerazioneTokenIdAuthPDND(AccordoServizioParteComune api, String portType) {
  277.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH, api, portType, false);
  278.         if(tmp!=null && !tmp.isEmpty()) {
  279.             for (String sorgenteToken : tmp) {
  280.                 if(isSicurezzaMessaggioGenerazioneTokenIdAuthPDND(sorgenteToken) ) {
  281.                     return true;
  282.                 }
  283.             }
  284.         }
  285.         return false;
  286.     }
  287.     private static boolean isSicurezzaMessaggioGenerazioneTokenIdAuthPDND(String sorgenteToken) {
  288.         return CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND.equals(sorgenteToken);
  289.     }
  290.    
  291.     public static boolean isProfiloSicurezzaMessaggioApplicabileRichiesta(AccordoServizioParteComune api, String portType, boolean sicurezzaRequired) {
  292.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE, api, portType, false);
  293.         if(tmp!=null && !tmp.isEmpty()) {
  294.             for (String applicabilita : tmp) {
  295.                 if(isProfiloSicurezzaMessaggioApplicabile(applicabilita, true) ) {
  296.                     return true;
  297.                 }
  298.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_PERSONALIZZATO.equals(applicabilita) &&
  299.                     isProfiloSicurezzaMessaggioApplicabileRichiestaCustom(api, portType)) {
  300.                     return true;
  301.                 }
  302.             }
  303.             return false;
  304.         }
  305.         return sicurezzaRequired; // per backward compatibility con le configurazioni dove l'applicabilità non esisteva ancora
  306.     }
  307.     public static boolean isProfiloSicurezzaMessaggioApplicabileRisposta(AccordoServizioParteComune api, String portType, boolean sicurezzaRequired) {
  308.         List<String> tmp = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE, api, portType, false);
  309.         if(tmp!=null && !tmp.isEmpty()) {
  310.             for (String applicabilita : tmp) {
  311.                 if(isProfiloSicurezzaMessaggioApplicabile(applicabilita, false) ) {
  312.                     return true;
  313.                 }
  314.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_PERSONALIZZATO.equals(applicabilita) &&
  315.                     isProfiloSicurezzaMessaggioApplicabileRispostaCustom(api, portType)) {
  316.                     return true;
  317.                 }
  318.             }
  319.             return false;
  320.         }
  321.         return sicurezzaRequired; // per backward compatibility con le configurazioni dove l'applicabilità non esisteva ancora
  322.     }
  323.     private static boolean isProfiloSicurezzaMessaggioApplicabile(String applicabilita, boolean richiesta) {
  324.         if(richiesta) {
  325.             return CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI.equals(applicabilita) ||
  326.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA.equals(applicabilita) ||
  327.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI_CON_ATTACHMENTS.equals(applicabilita) ||
  328.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA_CON_ATTACHMENTS.equals(applicabilita);
  329.         }  
  330.         else {
  331.             return CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI.equals(applicabilita) ||
  332.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA.equals(applicabilita) ||
  333.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI_CON_ATTACHMENTS.equals(applicabilita) ||
  334.                     CostantiDB.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA_CON_ATTACHMENTS.equals(applicabilita);
  335.         }
  336.     }
  337.     private static boolean isProfiloSicurezzaMessaggioApplicabileRichiestaCustom(AccordoServizioParteComune api, String portType) {
  338.         List<String> tmpCustom = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_RICHIESTA_MODE, api, portType, false);
  339.         if(tmpCustom!=null && !tmpCustom.isEmpty()) {
  340.             for (String profiloSicurezzaMessaggioCustom : tmpCustom) {
  341.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_RICHIESTA_MODE_VALUE_ABILITATO.equals(profiloSicurezzaMessaggioCustom) ||
  342.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_RICHIESTA_MODE_VALUE_PERSONALIZZATO.equals(profiloSicurezzaMessaggioCustom) ) {
  343.                     return true;
  344.                 }  
  345.             }
  346.         }
  347.         return false;
  348.     }
  349.     private static boolean isProfiloSicurezzaMessaggioApplicabileRispostaCustom(AccordoServizioParteComune api, String portType) {
  350.         List<String> tmpCustom = getPropertySicurezzaMessaggioEngine(CostantiDB.MODIPA_PROFILO_SICUREZZA_RISPOSTA_MODE, api, portType, false);
  351.         if(tmpCustom!=null && !tmpCustom.isEmpty()) {
  352.             for (String profiloSicurezzaMessaggioCustom : tmpCustom) {
  353.                 if(CostantiDB.MODIPA_PROFILO_SICUREZZA_RISPOSTA_MODE_VALUE_ABILITATO.equals(profiloSicurezzaMessaggioCustom) ||
  354.                         CostantiDB.MODIPA_PROFILO_SICUREZZA_RISPOSTA_MODE_VALUE_PERSONALIZZATO.equals(profiloSicurezzaMessaggioCustom) ) {
  355.                     return true;
  356.                 }  
  357.             }
  358.         }
  359.         return false;
  360.     }
  361. }