ModIDynamicConfigurationAccordiParteComuneSicurezzaMessaggioUtilities.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.modipa.properties;

  21. import java.util.ArrayList;
  22. import java.util.List;

  23. import org.apache.commons.lang.StringUtils;
  24. import org.openspcoop2.pdd.core.dynamic.DynamicHelperCostanti;
  25. import org.openspcoop2.protocol.modipa.config.ModIAuditClaimConfig;
  26. import org.openspcoop2.protocol.modipa.config.ModIAuditConfig;
  27. import org.openspcoop2.protocol.modipa.config.ModIProperties;
  28. import org.openspcoop2.protocol.modipa.constants.ModIConsoleCostanti;
  29. import org.openspcoop2.protocol.modipa.constants.ModICostanti;
  30. import org.openspcoop2.protocol.sdk.ProtocolException;
  31. import org.openspcoop2.protocol.sdk.constants.ConsoleItemType;
  32. import org.openspcoop2.protocol.sdk.constants.ConsoleItemValueType;
  33. import org.openspcoop2.protocol.sdk.properties.AbstractConsoleItem;
  34. import org.openspcoop2.protocol.sdk.properties.BaseConsoleItem;
  35. import org.openspcoop2.protocol.sdk.properties.BooleanConsoleItem;
  36. import org.openspcoop2.protocol.sdk.properties.BooleanProperty;
  37. import org.openspcoop2.protocol.sdk.properties.ConsoleConfiguration;
  38. import org.openspcoop2.protocol.sdk.properties.ConsoleItemInfo;
  39. import org.openspcoop2.protocol.sdk.properties.IConsoleHelper;
  40. import org.openspcoop2.protocol.sdk.properties.ProtocolProperties;
  41. import org.openspcoop2.protocol.sdk.properties.ProtocolPropertiesFactory;
  42. import org.openspcoop2.protocol.sdk.properties.ProtocolPropertiesUtils;
  43. import org.openspcoop2.protocol.sdk.properties.StringConsoleItem;
  44. import org.openspcoop2.protocol.sdk.properties.StringProperty;
  45. import org.openspcoop2.utils.LoggerWrapperFactory;

  46. /**
  47.  * ModIDynamicConfigurationAccordiParteComuneUtilities
  48.  *
  49.  * @author Poli Andrea (apoli@link.it)
  50.  * @author $Author$
  51.  * @version $Rev$, $Date$
  52.  */
  53. public class ModIDynamicConfigurationAccordiParteComuneSicurezzaMessaggioUtilities {
  54.    
  55.     private ModIDynamicConfigurationAccordiParteComuneSicurezzaMessaggioUtilities() {}

  56.    
  57.     static void addProfiloSicurezzaMessaggio(ModIProperties modiProperties,
  58.             ConsoleConfiguration configuration, boolean rest, boolean action,
  59.             String schemaAuditImpostatoInAPIoAltreAzioni) throws ProtocolException {
  60.        
  61.         configuration.addConsoleItem(ProtocolPropertiesFactory.newSubTitleItem(ModIConsoleCostanti.MODIPA_API_PROFILO_SICUREZZA_MESSAGGIO_ID,
  62.                 ModIConsoleCostanti.MODIPA_API_PROFILO_SICUREZZA_MESSAGGIO_LABEL));
  63.        
  64.         String labelSelezione = ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL;
  65.        
  66.         boolean corniceSicurezza = modiProperties.isSicurezzaMessaggioCorniceSicurezzaEnabled();
  67.        
  68.         if(action) {
  69.            
  70.             labelSelezione = "";
  71.            
  72.             StringConsoleItem modeItem = (StringConsoleItem)
  73.                     ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  74.                     ConsoleItemType.SELECT,
  75.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ACTION_MODE_ID,
  76.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL);
  77.             modeItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ACTION_MODE_LABEL_DEFAULT,
  78.                     ModIConsoleCostanti.MODIPA_PROFILO_MODE_VALUE_DEFAULT);
  79.             modeItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ACTION_MODE_LABEL_RIDEFINISCI,
  80.                     ModIConsoleCostanti.MODIPA_PROFILO_MODE_VALUE_RIDEFINISCI);
  81.             modeItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ACTION_MODE_DEFAULT_VALUE);
  82.             modeItem.setReloadOnChange(true);
  83.             configuration.addConsoleItem(modeItem);
  84.         }
  85.        
  86.         StringConsoleItem profiloSicurezzaMessaggioItem = (StringConsoleItem)
  87.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  88.                 ConsoleItemType.SELECT,
  89.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID,
  90.                 labelSelezione);
  91.         if(action) {
  92.             profiloSicurezzaMessaggioItem.setType(ConsoleItemType.HIDDEN);
  93.         }
  94.         profiloSicurezzaMessaggioItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_UNDEFINED,
  95.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_UNDEFINED);
  96.         if(rest) {
  97.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_REST_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_REST_NEW,
  98.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01);
  99.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_REST_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_REST_NEW,
  100.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02);
  101.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_REST_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_REST_NEW,
  102.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301);
  103.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_REST_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_REST_NEW,
  104.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302);
  105.             profiloSicurezzaMessaggioItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0401_REST,
  106.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401);
  107.             profiloSicurezzaMessaggioItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0402_REST,
  108.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402);
  109.         }
  110.         else {
  111.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_SOAP_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_SOAP_NEW,
  112.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01);
  113.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_SOAP_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_SOAP_NEW,
  114.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02);
  115.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_SOAP_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_SOAP_NEW,
  116.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301);
  117.             profiloSicurezzaMessaggioItem.addLabelValue((modiProperties.isModIVersioneBozza()!=null && modiProperties.isModIVersioneBozza().booleanValue()) ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_SOAP_OLD : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_SOAP_NEW,
  118.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302);
  119.         }
  120.         profiloSicurezzaMessaggioItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE);
  121.         if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  122.             profiloSicurezzaMessaggioItem.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_SOAP_NOTE);
  123.         }
  124.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  125.             profiloSicurezzaMessaggioItem.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_SOAP_NOTE);
  126.         }
  127.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  128.             profiloSicurezzaMessaggioItem.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_SOAP_NOTE);
  129.         }
  130.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  131.             profiloSicurezzaMessaggioItem.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_SOAP_NOTE);
  132.         }
  133.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) && rest) {
  134.             profiloSicurezzaMessaggioItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0401_REST_NOTE);
  135.         }
  136.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) && rest) {
  137.             profiloSicurezzaMessaggioItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0402_REST_NOTE);
  138.         }
  139.         /**if(corniceSicurezza) {*/
  140.         profiloSicurezzaMessaggioItem.setReloadOnChange(true);
  141.         configuration.addConsoleItem(profiloSicurezzaMessaggioItem);
  142.        
  143.         StringConsoleItem profiloSicurezzaMessaggioSorgenteTokenIdAuthItem = (StringConsoleItem)
  144.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  145.                 ConsoleItemType.SELECT,
  146.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_ID,
  147.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL);
  148.         profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL_LOCALE,
  149.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_LOCALE);
  150.         profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL_PDND,
  151.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND);
  152.         profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL_OAUTH,
  153.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH);
  154.         profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_DEFAULT_VALUE);
  155.         if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_DEFAULT_VALUE.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_LOCALE)) {
  156.             profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_NOTE_LOCALE);
  157.         }
  158.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_DEFAULT_VALUE.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND)) {
  159.             profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_NOTE_PDND);
  160.         }
  161.         else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_DEFAULT_VALUE.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH)) {
  162.             profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_NOTE_OAUTH);
  163.         }
  164.         profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setType(ConsoleItemType.HIDDEN);
  165.         configuration.addConsoleItem(profiloSicurezzaMessaggioSorgenteTokenIdAuthItem);
  166.        
  167.         if(rest) {
  168.            
  169.             // !! Nel caso di 2 header, quello integrity viene prodotto solo se c'è un payload o uno degli header indicati da firmare.
  170.             StringConsoleItem profiloSicurezzaMessaggioHeaderItem = (StringConsoleItem)
  171.                     ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  172.                     ConsoleItemType.SELECT,
  173.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_ID,
  174.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL);
  175.             profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA.
  176.                     replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  177.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_MODIPA);
  178.             profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION,
  179.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION);
  180.             if(isProfiloSicurezza03or04(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  181.                 profiloSicurezzaMessaggioHeaderItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_IDAM03_DEFAULT_VALUE);
  182.                
  183.                 profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_MODIPA.
  184.                         replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  185.                         ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA);
  186.                 profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_MODIPA_AUTH_IN_RESPONSE.
  187.                         replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  188.                         ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA_AUTH_IN_RESPONSE);
  189.                
  190.                 profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_CUSTOM,
  191.                         ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_CUSTOM);
  192.                 profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_CUSTOM,
  193.                         ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM);
  194.                 profiloSicurezzaMessaggioHeaderItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE,
  195.                         ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE);
  196.                
  197.                 profiloSicurezzaMessaggioHeaderItem.setReloadOnChange(true);
  198.             }
  199.             else if(isProfiloSicurezza01(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) || isProfiloSicurezza02(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  200.                 profiloSicurezzaMessaggioHeaderItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_NOT_IDAM03_DEFAULT_VALUE);
  201.             }
  202.             else {
  203.                 profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.HIDDEN);
  204.             }
  205.             configuration.addConsoleItem(profiloSicurezzaMessaggioHeaderItem);
  206.            
  207.             StringConsoleItem profiloSicurezzaMessaggioHeaderCustomItem = (StringConsoleItem)
  208.                     ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  209.                     ConsoleItemType.TEXT_EDIT,
  210.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_ID,
  211.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_LABEL);
  212.             profiloSicurezzaMessaggioHeaderCustomItem.setDefaultValue(modiProperties.getRestSecurityTokenHeaderModI());
  213.             profiloSicurezzaMessaggioHeaderCustomItem.setType(ConsoleItemType.HIDDEN);
  214.             configuration.addConsoleItem(profiloSicurezzaMessaggioHeaderCustomItem);
  215.            
  216.            
  217.             StringConsoleItem profiloSicurezzaMessaggioHeaderCustomModeItem = (StringConsoleItem)
  218.                     ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  219.                     ConsoleItemType.SELECT,
  220.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_ID,
  221.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_LABEL);
  222.             profiloSicurezzaMessaggioHeaderCustomModeItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_LABEL_PAYLOAD_HTTP,
  223.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_VALUE_PAYLOAD_HTTP);
  224.             profiloSicurezzaMessaggioHeaderCustomModeItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_LABEL_ALWAYS,
  225.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_VALUE_ALWAYS);
  226.             profiloSicurezzaMessaggioHeaderCustomModeItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_DEFAULT_VALUE);
  227.             profiloSicurezzaMessaggioHeaderCustomModeItem.setType(ConsoleItemType.HIDDEN);
  228.             configuration.addConsoleItem(profiloSicurezzaMessaggioHeaderCustomModeItem);
  229.            
  230.         }
  231.        
  232.         StringConsoleItem profiloSicurezzaMessaggioConfigurazioneItem = (StringConsoleItem)
  233.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  234.                 ConsoleItemType.SELECT,
  235.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_ID,
  236.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL);
  237.         profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_ENTRAMBI,
  238.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI);
  239.         profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RICHIESTA,
  240.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA);
  241.         profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RISPOSTA,
  242.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA);
  243.         if(!rest && isProfiloSicurezza03(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  244.             profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_ENTRAMBI_CON_ATTACHMENTS,
  245.                     ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI_CON_ATTACHMENTS);
  246.             profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RICHIESTA_CON_ATTACHMENTS,
  247.                     ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA_CON_ATTACHMENTS);
  248.             profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RISPOSTA_CON_ATTACHMENTS,
  249.                     ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA_CON_ATTACHMENTS);
  250.         }
  251.         if(rest) {
  252.             profiloSicurezzaMessaggioConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_PERSONALIZZATO,
  253.                     ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_PERSONALIZZATO);
  254.             profiloSicurezzaMessaggioConfigurazioneItem.setReloadOnChange(true);
  255.         }
  256.         profiloSicurezzaMessaggioConfigurazioneItem.setDefaultValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_DEFAULT_VALUE);
  257.         if(!isProfiloSicurezza01(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) &&
  258.                 !isProfiloSicurezza02(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) &&
  259.                 !isProfiloSicurezza03(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) &&
  260.                 !isProfiloSicurezza04(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE) ) {
  261.             profiloSicurezzaMessaggioConfigurazioneItem.setType(ConsoleItemType.HIDDEN);
  262.         }
  263.         profiloSicurezzaMessaggioConfigurazioneItem.setReloadOnChange(true);
  264.         configuration.addConsoleItem(profiloSicurezzaMessaggioConfigurazioneItem);
  265.                
  266.         BooleanConsoleItem profiloSicurezzaMessaggioRequestDigest = (BooleanConsoleItem)
  267.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.BOOLEAN,
  268.                 ConsoleItemType.CHECKBOX,
  269.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_ID,
  270.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_LABEL);
  271.         if(!isProfiloSicurezza03or04(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  272.             profiloSicurezzaMessaggioRequestDigest.setType(ConsoleItemType.HIDDEN);
  273.         }
  274.         profiloSicurezzaMessaggioRequestDigest.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_DEFAULT);
  275.         ConsoleItemInfo cDigest = new ConsoleItemInfo(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_LABEL);
  276.         cDigest.setHeaderBody(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_REST_INFO_HEADER : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_SOAP_INFO_HEADER );
  277.         profiloSicurezzaMessaggioRequestDigest.setInfo(cDigest);
  278.         profiloSicurezzaMessaggioRequestDigest.setLabelRight(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_LABEL_RIGHT);
  279.         configuration.addConsoleItem(profiloSicurezzaMessaggioRequestDigest);
  280.        
  281.        
  282.         BooleanConsoleItem profiloSicurezzaMessaggioCorniceSicurezza = (BooleanConsoleItem)
  283.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.BOOLEAN,
  284.                 ConsoleItemType.CHECKBOX,
  285.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_ID,
  286.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_LABEL);
  287.         profiloSicurezzaMessaggioCorniceSicurezza.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_DEFAULT_VALUE);
  288.         profiloSicurezzaMessaggioCorniceSicurezza.setLabelRight(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_LABEL_RIGHT);
  289.         profiloSicurezzaMessaggioCorniceSicurezza.setReloadOnChange(true);
  290.         configuration.addConsoleItem(profiloSicurezzaMessaggioCorniceSicurezza);
  291.        
  292.        
  293.         // Configurazione
  294.        
  295.         boolean showConfigurazione = true;
  296.         if(!ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_PERSONALIZZATO.equals(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_DEFAULT_VALUE)) {
  297.             showConfigurazione = false;
  298.         }
  299.        
  300.         BaseConsoleItem subTitleRichiesta = ProtocolPropertiesFactory.newSubTitleItem(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_ID,
  301.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_LABEL);
  302.         if(!showConfigurazione) {
  303.             subTitleRichiesta.setType(ConsoleItemType.HIDDEN);
  304.         }
  305.         configuration.addConsoleItem(subTitleRichiesta);
  306.        
  307.         StringConsoleItem profiloSicurezzaRichiestaConfigurazioneItem = (StringConsoleItem)
  308.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  309.                 ConsoleItemType.SELECT,
  310.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_ID,
  311.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_LABEL);
  312.         profiloSicurezzaRichiestaConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_LABEL_ABILITATO,
  313.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_VALUE_ABILITATO);
  314.         profiloSicurezzaRichiestaConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_LABEL_DISABILITATO,
  315.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_VALUE_DISABILITATO);
  316.         profiloSicurezzaRichiestaConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_LABEL_PERSONALIZZATO,
  317.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_VALUE_PERSONALIZZATO);
  318.         profiloSicurezzaRichiestaConfigurazioneItem.setDefaultValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_DEFAULT_VALUE);
  319.         if(!showConfigurazione) {
  320.             profiloSicurezzaRichiestaConfigurazioneItem.setType(ConsoleItemType.HIDDEN);
  321.         }
  322.         profiloSicurezzaRichiestaConfigurazioneItem.setReloadOnChange(true);
  323.         configuration.addConsoleItem(profiloSicurezzaRichiestaConfigurazioneItem);
  324.            
  325.         StringConsoleItem profiloSicurezzaRichiestaConfigurazioneContentTypeItem = (StringConsoleItem)
  326.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  327.                 ConsoleItemType.TAGS,
  328.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_CONTENT_TYPE_MODE_ID,
  329.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_CONTENT_TYPE_MODE_LABEL);
  330.         profiloSicurezzaRichiestaConfigurazioneContentTypeItem.setInfo(buildConsoleItemInfoSicurezzaContentType(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_CONTENT_TYPE_MODE_LABEL));
  331.         if(!ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_LABEL_PERSONALIZZATO.equals(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_DEFAULT_VALUE)) {
  332.             profiloSicurezzaRichiestaConfigurazioneContentTypeItem.setType(ConsoleItemType.HIDDEN);
  333.         }
  334.         profiloSicurezzaRichiestaConfigurazioneContentTypeItem.setRequired(true);
  335.         configuration.addConsoleItem(profiloSicurezzaRichiestaConfigurazioneContentTypeItem);
  336.        
  337.         BaseConsoleItem subTitleRisposta = ProtocolPropertiesFactory.newSubTitleItem(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_ID,
  338.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_LABEL);
  339.         if(!showConfigurazione) {
  340.             subTitleRisposta.setType(ConsoleItemType.HIDDEN);
  341.         }
  342.         configuration.addConsoleItem(subTitleRisposta);
  343.        
  344.         StringConsoleItem profiloSicurezzaRispostaConfigurazioneItem = (StringConsoleItem)
  345.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  346.                 ConsoleItemType.SELECT,
  347.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_ID,
  348.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_LABEL);
  349.         profiloSicurezzaRispostaConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_LABEL_ABILITATO,
  350.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_VALUE_ABILITATO);
  351.         profiloSicurezzaRispostaConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_LABEL_DISABILITATO,
  352.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_VALUE_DISABILITATO);
  353.         profiloSicurezzaRispostaConfigurazioneItem.addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_LABEL_PERSONALIZZATO,
  354.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_VALUE_PERSONALIZZATO);
  355.         profiloSicurezzaRispostaConfigurazioneItem.setDefaultValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_DEFAULT_VALUE);
  356.         if(!showConfigurazione) {
  357.             profiloSicurezzaRispostaConfigurazioneItem.setType(ConsoleItemType.HIDDEN);
  358.         }
  359.         profiloSicurezzaRispostaConfigurazioneItem.setReloadOnChange(true);
  360.         configuration.addConsoleItem(profiloSicurezzaRispostaConfigurazioneItem);
  361.            
  362.         StringConsoleItem profiloSicurezzaRispostaConfigurazioneContentTypeItem = (StringConsoleItem)
  363.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  364.                 ConsoleItemType.TAGS,
  365.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_CONTENT_TYPE_MODE_ID,
  366.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_CONTENT_TYPE_MODE_LABEL);
  367.         profiloSicurezzaRispostaConfigurazioneContentTypeItem.setInfo(buildConsoleItemInfoSicurezzaContentType(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_CONTENT_TYPE_MODE_LABEL));
  368.         if(!ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_LABEL_PERSONALIZZATO.equals(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_DEFAULT_VALUE)) {
  369.             profiloSicurezzaRispostaConfigurazioneContentTypeItem.setType(ConsoleItemType.HIDDEN);
  370.         }
  371.         profiloSicurezzaRispostaConfigurazioneContentTypeItem.setRequired(true);
  372.         configuration.addConsoleItem(profiloSicurezzaRispostaConfigurazioneContentTypeItem);
  373.        
  374.         StringConsoleItem profiloSicurezzaRispostaConfigurazioneReturnCodeItem = (StringConsoleItem)
  375.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  376.                 ConsoleItemType.TAGS,
  377.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_ID,
  378.                 ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL);
  379.         ConsoleItemInfo cRT = new ConsoleItemInfo(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL);
  380.         cRT.setHeaderBody(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_ID_INFO);
  381.         profiloSicurezzaRispostaConfigurazioneReturnCodeItem.setInfo(cRT);
  382.         if(!ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_LABEL_PERSONALIZZATO.equals(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_DEFAULT_VALUE)) {
  383.             profiloSicurezzaRispostaConfigurazioneReturnCodeItem.setType(ConsoleItemType.HIDDEN);
  384.         }
  385.         profiloSicurezzaRispostaConfigurazioneReturnCodeItem.setRequired(true);
  386.         configuration.addConsoleItem(profiloSicurezzaRispostaConfigurazioneReturnCodeItem);
  387.        
  388.        
  389.        
  390.         // Informazioni Utente
  391.        
  392.         BaseConsoleItem subTitleCorniceSicurezza = ProtocolPropertiesFactory.newSubTitleItem(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SUBTITLE_ID,
  393.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SUBTITLE_LABEL);
  394.         if(!ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_DEFAULT_VALUE) {
  395.             subTitleCorniceSicurezza.setType(ConsoleItemType.HIDDEN);
  396.         }
  397.         configuration.addConsoleItem(subTitleCorniceSicurezza);
  398.        
  399.         StringConsoleItem profiloSicurezzaCorniceSicurezzaPatternItem = (StringConsoleItem)
  400.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  401.                 ConsoleItemType.SELECT,
  402.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_ID,
  403.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL);
  404.         profiloSicurezzaCorniceSicurezzaPatternItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_AUDIT_REST_01,
  405.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_AUDIT_REST_01);
  406.         profiloSicurezzaCorniceSicurezzaPatternItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_AUDIT_REST_02,
  407.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_AUDIT_REST_02);
  408.         if(corniceSicurezza && isProfiloSicurezza03(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_DEFAULT_VALUE)) {
  409.             profiloSicurezzaCorniceSicurezzaPatternItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_OLD,
  410.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD);
  411.         }
  412.         profiloSicurezzaCorniceSicurezzaPatternItem.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_DEFAULT_VALUE);
  413.         if(!ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_DEFAULT_VALUE) {
  414.             profiloSicurezzaCorniceSicurezzaPatternItem.setType(ConsoleItemType.HIDDEN);
  415.         }
  416.         profiloSicurezzaCorniceSicurezzaPatternItem.setReloadOnChange(true);
  417.         if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_DEFAULT_VALUE.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD)) {
  418.             ConsoleItemInfo consoleItemInfoCorniceSicurezza = new ConsoleItemInfo(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_LABEL);
  419.             consoleItemInfoCorniceSicurezza.setHeaderBody(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_REST_INFO_HEADER : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SOAP_INFO_HEADER );
  420.             consoleItemInfoCorniceSicurezza.setListBody(rest ? ModIConsoleCostanti.getModipaProfiloSicurezzaMessaggioCorniceSicurezzaRestInfoValori() : ModIConsoleCostanti.getModipaProfiloSicurezzaMessaggioCorniceSicurezzaSoapInfoValori() );
  421.             profiloSicurezzaMessaggioCorniceSicurezza.setInfo(consoleItemInfoCorniceSicurezza);
  422.         }
  423.         configuration.addConsoleItem(profiloSicurezzaCorniceSicurezzaPatternItem);
  424.        
  425.        
  426.         List<ModIAuditConfig> listConfig = modiProperties.getAuditConfig();
  427.         if(listConfig!=null && !listConfig.isEmpty()) {
  428.             StringConsoleItem profiloSicurezzaCorniceSicurezzaSchemaItem = (StringConsoleItem)
  429.                     ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.STRING,
  430.                     ConsoleItemType.SELECT,
  431.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SCHEMA_ID,
  432.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SCHEMA_LABEL);
  433.             for (ModIAuditConfig modIAuditConfig : listConfig) {
  434.                 if(schemaAuditImpostatoInAPIoAltreAzioni!=null && StringUtils.isNotEmpty(schemaAuditImpostatoInAPIoAltreAzioni)) {
  435.                     if(schemaAuditImpostatoInAPIoAltreAzioni.equals(modIAuditConfig.getNome())){
  436.                         profiloSicurezzaCorniceSicurezzaSchemaItem.addLabelValue(modIAuditConfig.getLabel(),
  437.                                 modIAuditConfig.getNome());
  438.                     }
  439.                 }
  440.                 else {
  441.                     profiloSicurezzaCorniceSicurezzaSchemaItem.addLabelValue(modIAuditConfig.getLabel(),
  442.                         modIAuditConfig.getNome());
  443.                 }
  444.             }
  445.             profiloSicurezzaCorniceSicurezzaSchemaItem.setDefaultValue(listConfig.get(0).getNome());
  446.             profiloSicurezzaCorniceSicurezzaSchemaItem.setReloadOnChange(true);
  447.             if(!ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_DEFAULT_VALUE) {
  448.                 profiloSicurezzaCorniceSicurezzaSchemaItem.setType(ConsoleItemType.HIDDEN);
  449.             }
  450.             configuration.addConsoleItem(profiloSicurezzaCorniceSicurezzaSchemaItem);
  451.         }
  452.        
  453.         BooleanConsoleItem profiloSicurezzaMessaggioCorniceSicurezzaOpzionale = (BooleanConsoleItem)
  454.                 ProtocolPropertiesFactory.newConsoleItem(ConsoleItemValueType.BOOLEAN,
  455.                 ConsoleItemType.CHECKBOX,
  456.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_OPZIONALE_ID,
  457.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_OPZIONALE_LABEL);
  458.         profiloSicurezzaMessaggioCorniceSicurezzaOpzionale.setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_OPZIONALE_DEFAULT_VALUE);
  459.         profiloSicurezzaMessaggioCorniceSicurezzaOpzionale.setReloadOnChange(false);
  460.         configuration.addConsoleItem(profiloSicurezzaMessaggioCorniceSicurezzaOpzionale);

  461.     }
  462.    
  463.     static boolean isProfiloSicurezza01(String value) {
  464.         return ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01.equals(value);
  465.     }
  466.    
  467.     static boolean isProfiloSicurezza02(String value) {
  468.         return ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02.equals(value);
  469.     }
  470.    
  471.     static boolean isProfiloSicurezza03or04(String value) {
  472.         return isProfiloSicurezza03(value) || isProfiloSicurezza04(value);
  473.     }
  474.    
  475.     static boolean isProfiloSicurezza03(String value) {
  476.         return ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(value)
  477.                 ||
  478.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(value);
  479.     }
  480.    
  481.     static boolean isProfiloSicurezza04(String value) {
  482.         return ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(value)
  483.                 ||
  484.                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(value);
  485.     }
  486.    
  487.     static ConsoleItemInfo buildConsoleItemInfoSicurezzaContentType(String label) {
  488.        
  489.         try {
  490.             ConsoleItemInfo c = new ConsoleItemInfo(label);
  491.            
  492.             c.setHeaderBody(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_O_RISPOSTA_CONTENT_TYPE_MODE_ID_INFO_CONTENT_TYPE);
  493.            
  494.             c.setListBody(DynamicHelperCostanti.LABEL_CONFIGURAZIONE_TRASFORMAZIONI_APPLICABILITA_INFO_CONTENT_TYPE_VALORI);
  495.            
  496.             return c;
  497.            
  498.         }catch(Exception t) {
  499.             try {
  500.                 LoggerWrapperFactory.getLogger("govwayConsole.core").error(t.getMessage(),t);
  501.             }catch(Exception tInternal) {
  502.                 /**System.err.println("ERRORE: "+t.getMessage());
  503.                 t.printStackTrace(System.err);*/
  504.             }
  505.             return null;
  506.         }
  507.        
  508.     }
  509.    
  510.     static void updateProfiloSicurezzaMessaggio(ModIProperties modiProperties,
  511.             ConsoleConfiguration consoleConfiguration, IConsoleHelper consoleHelper, ProtocolProperties properties,
  512.             boolean rest, boolean action) throws ProtocolException {
  513.        
  514.         String postBackElementName = null;
  515.         try {
  516.             postBackElementName = consoleHelper.getPostBackElementName();
  517.         }catch(Exception e) {
  518.             throw new ProtocolException(e.getMessage(),e);
  519.         }
  520.        
  521.         boolean corniceSicurezza = modiProperties.isSicurezzaMessaggioCorniceSicurezzaEnabled();
  522.         StringProperty profiloSicurezzaMessaggioItemValue = null;
  523.        
  524.         AbstractConsoleItem<?> profiloSicurezzaMessaggioItemModifyNote = null;
  525.         boolean ridefinito = false;
  526.        
  527.         if(action) {
  528.        
  529.             StringProperty modeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ACTION_MODE_ID);
  530.                        
  531.             AbstractConsoleItem<?> profiloSicurezzaMessaggioItem =  
  532.                     ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID);
  533.             profiloSicurezzaMessaggioItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID);
  534.            
  535.             if(modeItemValue!=null && ModICostanti.MODIPA_PROFILO_RIDEFINISCI.equals(modeItemValue.getValue())) {
  536.                 profiloSicurezzaMessaggioItem.setType(ConsoleItemType.SELECT);
  537.                
  538.                 profiloSicurezzaMessaggioItemModifyNote = profiloSicurezzaMessaggioItem;
  539.                
  540.                 ridefinito = true;
  541.             }
  542.             else {
  543.                 if(profiloSicurezzaMessaggioItem!=null) {
  544.                     profiloSicurezzaMessaggioItem.setType(ConsoleItemType.HIDDEN);
  545.                 }
  546.                 if(profiloSicurezzaMessaggioItemValue!=null) {
  547.                     profiloSicurezzaMessaggioItemValue.setValue(null);
  548.                 }
  549.             }
  550.            
  551.         }
  552.         else {
  553.        
  554.             profiloSicurezzaMessaggioItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID);
  555.                
  556.             profiloSicurezzaMessaggioItemModifyNote =  
  557.                     ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID);
  558.                        
  559.         }
  560.         String sicurezzaMessaggioPatternValue = profiloSicurezzaMessaggioItemValue!=null ? profiloSicurezzaMessaggioItemValue.getValue() : null;
  561.         if(profiloSicurezzaMessaggioItemModifyNote!=null) {
  562.             if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM01.equals(sicurezzaMessaggioPatternValue)) {
  563.                 profiloSicurezzaMessaggioItemModifyNote.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM01_SOAP_NOTE);
  564.             }
  565.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM02.equals(sicurezzaMessaggioPatternValue)) {
  566.                 profiloSicurezzaMessaggioItemModifyNote.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM02_SOAP_NOTE);
  567.             }
  568.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0301.equals(sicurezzaMessaggioPatternValue)) {
  569.                 profiloSicurezzaMessaggioItemModifyNote.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0301_SOAP_NOTE);
  570.             }
  571.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0302.equals(sicurezzaMessaggioPatternValue)) {
  572.                 profiloSicurezzaMessaggioItemModifyNote.setNote(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_REST_NOTE : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0302_SOAP_NOTE);
  573.             }
  574.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(sicurezzaMessaggioPatternValue) && rest) {
  575.                 profiloSicurezzaMessaggioItemModifyNote.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0401_REST_NOTE);
  576.             }
  577.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(sicurezzaMessaggioPatternValue) && rest) {
  578.                 profiloSicurezzaMessaggioItemModifyNote.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_LABEL_IDAM0402_REST_NOTE);
  579.             }
  580.         }
  581.        
  582.         boolean isSicurezza01 = false;
  583.         boolean isSicurezza02 = false;
  584.         boolean isSicurezza03 = false;
  585.         boolean isSicurezza04 = false;
  586.         if(profiloSicurezzaMessaggioItemValue!=null && profiloSicurezzaMessaggioItemValue.getValue()!=null) {
  587.             isSicurezza01 = isProfiloSicurezza01(profiloSicurezzaMessaggioItemValue.getValue());
  588.             isSicurezza02 = isProfiloSicurezza02(profiloSicurezzaMessaggioItemValue.getValue());
  589.             isSicurezza03 = isProfiloSicurezza03(profiloSicurezzaMessaggioItemValue.getValue());
  590.             isSicurezza04 = isProfiloSicurezza04(profiloSicurezzaMessaggioItemValue.getValue());
  591.         }
  592.         boolean isSicurezza03or04 = isSicurezza03 || isSicurezza04;
  593.        
  594.         boolean sicurezzaSoloSullaRispostaPerIdar04 = false;
  595.         if(isSicurezza04) {
  596.             StringProperty profiloSicurezzaMessaggioConfigurazioneItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_ID);
  597.             if(profiloSicurezzaMessaggioConfigurazioneItemValue!=null) {
  598.                 String secValue = profiloSicurezzaMessaggioConfigurazioneItemValue.getValue();
  599.                 if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA.equals(secValue) ||
  600.                         ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA_CON_ATTACHMENTS.equals(secValue)) {
  601.                     sicurezzaSoloSullaRispostaPerIdar04 = true;
  602.                 }
  603.             }
  604.         }
  605.        
  606.         StringConsoleItem profiloSicurezzaMessaggioSorgenteTokenIdAuthItem =    
  607.                 (StringConsoleItem) ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_ID);
  608.         boolean sorgenteTokenLocale = true;
  609.         if(profiloSicurezzaMessaggioSorgenteTokenIdAuthItem!=null) {
  610.            
  611.             StringProperty profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_ID);
  612.            
  613.             if(profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue!=null &&
  614.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID.equals(postBackElementName)) {
  615.                 // modificato il pattern
  616.                 if( ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0401.equals(sicurezzaMessaggioPatternValue)
  617.                         ||
  618.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_VALUE_IDAM0402.equals(sicurezzaMessaggioPatternValue)
  619.                 ){
  620.                     profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue.setValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND);
  621.                 }
  622.                 else {
  623.                     // altrimenti lascio quello impostato precedentemente che per gli altri profili va bene
  624.                     /** profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue.setValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_LOCALE); */
  625.                 }
  626.             }
  627.            
  628.             profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.clearMapLabelValues();
  629.             if(!isSicurezza04) {
  630.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL_LOCALE,
  631.                         ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_LOCALE);
  632.             }
  633.             profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL_PDND,
  634.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND);
  635.             profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_LABEL_OAUTH,
  636.                     ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH);
  637.            
  638.             String sorgenteTokenIdAuthValue = profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue!=null ? profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue.getValue() : null;
  639.             if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_LOCALE.equals(sorgenteTokenIdAuthValue)) {
  640.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_NOTE_LOCALE);
  641.             }
  642.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_PDND.equals(sorgenteTokenIdAuthValue)) {
  643.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_NOTE_PDND);
  644.                 sorgenteTokenLocale = false;
  645.             }
  646.             else if(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_VALUE_OAUTH.equals(sorgenteTokenIdAuthValue)) {
  647.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_SORGENTE_TOKEN_IDAUTH_NOTE_OAUTH);
  648.                 sorgenteTokenLocale = false;
  649.             }
  650.            
  651.             if(isSicurezza01 || isSicurezza02 || isSicurezza03 || (isSicurezza04 && !sicurezzaSoloSullaRispostaPerIdar04)) {
  652.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setType(ConsoleItemType.SELECT);
  653.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setReloadOnChange(true);
  654.             }
  655.             else {
  656.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setType(ConsoleItemType.HIDDEN);
  657.                 profiloSicurezzaMessaggioSorgenteTokenIdAuthItem.setReloadOnChange(false);
  658.                 if(profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue!=null) {
  659.                     profiloSicurezzaMessaggioSorgenteTokenIdAuthItemValue.setValue(null);
  660.                 }
  661.             }
  662.         }
  663.        
  664.        
  665.         if(rest) {
  666.             AbstractConsoleItem<?> profiloSicurezzaMessaggioHeaderItem =    
  667.                     ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_ID);
  668.             AbstractConsoleItem<?> profiloSicurezzaMessaggioHeaderCustomItem =  
  669.                     ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_ID);
  670.             AbstractConsoleItem<?> profiloSicurezzaMessaggioHeaderCustomModeItem =  
  671.                     ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_ID);
  672.             if(isSicurezza01 || isSicurezza02 || isSicurezza03 || isSicurezza04) {
  673.                 if(profiloSicurezzaMessaggioHeaderItem!=null) {
  674.                     profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.SELECT);
  675.                 }
  676.                
  677.                 StringProperty profiloSicurezzaMessaggioHeaderItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_ID);
  678.                 if(profiloSicurezzaMessaggioHeaderItemValue!=null && ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_ID.equals(postBackElementName)){
  679.                    
  680.                     String headerSelezionato = profiloSicurezzaMessaggioHeaderItemValue.getValue();
  681.                     boolean agidPresente = ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA.equals(headerSelezionato) ||
  682.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA_AUTH_IN_RESPONSE.equals(headerSelezionato)  ||
  683.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_MODIPA.equals(headerSelezionato) ||
  684.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM.equals(headerSelezionato) ||
  685.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE.equals(headerSelezionato)  ||
  686.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_CUSTOM.equals(headerSelezionato);
  687.                     boolean authorizationOnlyPresente = ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION.equals(headerSelezionato);
  688.                     if(isSicurezza01 || isSicurezza02) {
  689.                         // se è stato modificato (postback) in 01 o 02, e non c'e' l'header authorization imposto il null per forzare il default
  690.                         if(!authorizationOnlyPresente) {
  691.                             profiloSicurezzaMessaggioHeaderItemValue.setValue(null);
  692.                         }
  693.                     }
  694.                     else if(isSicurezza03or04 &&
  695.                         // se è stato modificato (postback) in 0301 o 0302, e non c'e' l'header agid imposto il null per forzare il default
  696.                         !agidPresente) {
  697.                         profiloSicurezzaMessaggioHeaderItemValue.setValue(null);
  698.                     }
  699.                    
  700.                 }
  701.                
  702.                 if(profiloSicurezzaMessaggioHeaderItem!=null) {
  703.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).clearMapLabelValues();
  704.                 }
  705.                
  706.                 if(sicurezzaSoloSullaRispostaPerIdar04) {
  707.                    
  708.                     profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.SELECT);    
  709.                    
  710.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA.
  711.                             replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  712.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_MODIPA);
  713.                    
  714.                     if(profiloSicurezzaMessaggioHeaderItemValue!=null &&
  715.                             (profiloSicurezzaMessaggioHeaderItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaMessaggioHeaderItemValue.getValue()))
  716.                         ) {
  717.                         profiloSicurezzaMessaggioHeaderItemValue.setValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_MODIPA);
  718.                     }

  719.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).setReloadOnChange(false);
  720.                 }
  721.                 else if(isSicurezza03or04) {
  722.                    
  723.                     profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.SELECT);    
  724.                    
  725.                     if(sorgenteTokenLocale) {
  726.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA.
  727.                                 replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  728.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_MODIPA);
  729.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION,
  730.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION);
  731.                     }
  732.                    
  733.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_MODIPA.
  734.                             replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  735.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA);
  736.                     if(sorgenteTokenLocale) {
  737.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_MODIPA_AUTH_IN_RESPONSE.
  738.                                 replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  739.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_MODIPA_AUTH_IN_RESPONSE);
  740.                     }
  741.                    
  742.                     if(sorgenteTokenLocale) {
  743.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_CUSTOM,
  744.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_CUSTOM);
  745.                     }
  746.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_CUSTOM,
  747.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM);
  748.                     if(sorgenteTokenLocale) {
  749.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE,
  750.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE);
  751.                     }
  752.                    
  753.                     if(profiloSicurezzaMessaggioHeaderItemValue!=null &&
  754.                             (profiloSicurezzaMessaggioHeaderItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaMessaggioHeaderItemValue.getValue()))
  755.                         ) {
  756.                         profiloSicurezzaMessaggioHeaderItemValue.setValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_IDAM03_DEFAULT_VALUE);
  757.                     }
  758.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_IDAM03_DEFAULT_VALUE);
  759.                    
  760.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).setReloadOnChange(true);
  761.                 }
  762.                 else if(isSicurezza01 || isSicurezza02) {

  763.                     if(sorgenteTokenLocale) {
  764.                        
  765.                         profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.SELECT);    
  766.                        
  767.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_AUTHORIZATION,
  768.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION);
  769.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA.
  770.                                 replace(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_LABEL_MODIPA, modiProperties.getRestSecurityTokenHeaderModI()),
  771.                                 ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_MODIPA);
  772.                     }
  773.                     else {
  774.                         profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.HIDDEN);    
  775.                     }
  776.                    
  777.                     if(profiloSicurezzaMessaggioHeaderItemValue!=null &&
  778.                             (profiloSicurezzaMessaggioHeaderItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaMessaggioHeaderItemValue.getValue()))
  779.                         ) {
  780.                         profiloSicurezzaMessaggioHeaderItemValue.setValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_NOT_IDAM03_DEFAULT_VALUE);
  781.                     }
  782.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).setDefaultValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_NOT_IDAM03_DEFAULT_VALUE);
  783.                    
  784.                     ((StringConsoleItem)profiloSicurezzaMessaggioHeaderItem).setReloadOnChange(false);
  785.                 }
  786.                
  787.                 boolean custom = false;
  788.                 if(isSicurezza03or04 &&
  789.                     profiloSicurezzaMessaggioHeaderItemValue!=null &&
  790.                     profiloSicurezzaMessaggioHeaderItemValue.getValue()!=null &&
  791.                     StringUtils.isNotEmpty(profiloSicurezzaMessaggioHeaderItemValue.getValue())
  792.                         ) {
  793.                     custom =
  794.                             (sorgenteTokenLocale && ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_CUSTOM.equals(profiloSicurezzaMessaggioHeaderItemValue.getValue()))
  795.                             ||
  796.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM.equals(profiloSicurezzaMessaggioHeaderItemValue.getValue())
  797.                             ||
  798.                             (sorgenteTokenLocale && ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_VALUE_AUTHORIZATION_CUSTOM_AUTH_IN_RESPONSE.equals(profiloSicurezzaMessaggioHeaderItemValue.getValue()));
  799.                 }
  800.                 if(custom) {
  801.                     if(profiloSicurezzaMessaggioHeaderCustomItem!=null) {
  802.                         profiloSicurezzaMessaggioHeaderCustomItem.setType(ConsoleItemType.TEXT_EDIT);
  803.                         profiloSicurezzaMessaggioHeaderCustomItem.setRequired(true);
  804.                         ((StringConsoleItem)profiloSicurezzaMessaggioHeaderCustomItem).setDefaultValue(modiProperties.getRestSecurityTokenHeaderModI());
  805.                         if(postBackElementName!=null && postBackElementName.equals(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_ID)) {
  806.                             StringProperty profiloSicurezzaMessaggioHeaderCustomItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_ID);
  807.                             if(profiloSicurezzaMessaggioHeaderCustomItemValue!=null &&
  808.                                 (profiloSicurezzaMessaggioHeaderCustomItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaMessaggioHeaderCustomItemValue.getValue()))
  809.                             ) {
  810.                                 profiloSicurezzaMessaggioHeaderCustomItemValue.setValue(modiProperties.getRestSecurityTokenHeaderModI());
  811.                             }
  812.                         }
  813.                     }
  814.                     if(profiloSicurezzaMessaggioHeaderCustomModeItem!=null) {
  815.                         profiloSicurezzaMessaggioHeaderCustomModeItem.setType(ConsoleItemType.SELECT);
  816.                     }
  817.                     if(profiloSicurezzaMessaggioHeaderItem!=null) {
  818.                         profiloSicurezzaMessaggioHeaderItem.setNote(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_NOTE);
  819.                     }
  820.                 }
  821.                 else {
  822.                     if(profiloSicurezzaMessaggioHeaderCustomItem!=null) {
  823.                         profiloSicurezzaMessaggioHeaderCustomItem.setType(ConsoleItemType.HIDDEN);
  824.                         profiloSicurezzaMessaggioHeaderCustomItem.setRequired(false);
  825.                         StringProperty profiloSicurezzaMessaggioHeaderCustomItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_ID);
  826.                         if(profiloSicurezzaMessaggioHeaderCustomItemValue!=null) {
  827.                             profiloSicurezzaMessaggioHeaderCustomItemValue.setValue(null);
  828.                         }
  829.                     }
  830.                     if(profiloSicurezzaMessaggioHeaderCustomModeItem!=null) {
  831.                         profiloSicurezzaMessaggioHeaderCustomModeItem.setType(ConsoleItemType.HIDDEN);
  832.                         StringProperty profiloSicurezzaMessaggioHeaderCustomModeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_ID);
  833.                         if(profiloSicurezzaMessaggioHeaderCustomModeItemValue!=null) {
  834.                             profiloSicurezzaMessaggioHeaderCustomModeItemValue.setValue(null);
  835.                         }
  836.                     }
  837.                     if(profiloSicurezzaMessaggioHeaderItem!=null) {
  838.                         profiloSicurezzaMessaggioHeaderItem.setNote(null);
  839.                     }
  840.                 }
  841.             }
  842.             else {
  843.                 profiloSicurezzaMessaggioHeaderItem.setType(ConsoleItemType.HIDDEN);
  844.                 if(!ridefinito) {
  845.                     StringProperty profiloSicurezzaMessaggioHeaderItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_ID);
  846.                     if(profiloSicurezzaMessaggioHeaderItemValue!=null) {
  847.                         profiloSicurezzaMessaggioHeaderItemValue.setValue(null);
  848.                     }
  849.                 }
  850.                
  851.                 if(profiloSicurezzaMessaggioHeaderCustomItem!=null) {
  852.                     profiloSicurezzaMessaggioHeaderCustomItem.setType(ConsoleItemType.HIDDEN);
  853.                     StringProperty profiloSicurezzaMessaggioHeaderCustomItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_ID);
  854.                     if(profiloSicurezzaMessaggioHeaderCustomItemValue!=null) {
  855.                         profiloSicurezzaMessaggioHeaderCustomItemValue.setValue(null);
  856.                     }
  857.                 }
  858.                
  859.                 if(profiloSicurezzaMessaggioHeaderCustomModeItem!=null) {
  860.                     profiloSicurezzaMessaggioHeaderCustomModeItem.setType(ConsoleItemType.HIDDEN);
  861.                     StringProperty profiloSicurezzaMessaggioHeaderCustomModeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_HEADER_CUSTOM_MODE_ID);
  862.                     if(profiloSicurezzaMessaggioHeaderCustomModeItemValue!=null) {
  863.                         profiloSicurezzaMessaggioHeaderCustomModeItemValue.setValue(null);
  864.                     }
  865.                 }
  866.             }
  867.         }
  868.        
  869.        
  870.        
  871.         // Configurazione
  872.        
  873.         AbstractConsoleItem<?> profiloSicurezzaConfigurazioneItem =    
  874.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_ID);
  875.        
  876.         StringProperty profiloSicurezzaMessaggioConfigurazioneItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_ID);
  877.        
  878.        
  879.         // personalizzo lista applicabilita'
  880.                
  881.         if(!rest) {
  882.            
  883.             // verifica soap attachments
  884.             if(isSicurezza03) {
  885.                 if(!((StringConsoleItem)profiloSicurezzaConfigurazioneItem).getMapLabelValues().containsKey(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_ENTRAMBI_CON_ATTACHMENTS)) {
  886.                     ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_ENTRAMBI_CON_ATTACHMENTS,
  887.                             ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI_CON_ATTACHMENTS);
  888.                 }
  889.                 if(!((StringConsoleItem)profiloSicurezzaConfigurazioneItem).getMapLabelValues().containsKey(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RICHIESTA_CON_ATTACHMENTS)) {
  890.                     ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RICHIESTA_CON_ATTACHMENTS,
  891.                             ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA_CON_ATTACHMENTS);
  892.                 }
  893.                 if(!((StringConsoleItem)profiloSicurezzaConfigurazioneItem).getMapLabelValues().containsKey(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RISPOSTA_CON_ATTACHMENTS)) {
  894.                     ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).addLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RISPOSTA_CON_ATTACHMENTS,
  895.                             ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA_CON_ATTACHMENTS);
  896.                 }
  897.             }
  898.             else {
  899.                 ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).removeLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_ENTRAMBI_CON_ATTACHMENTS);
  900.                 ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).removeLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RICHIESTA_CON_ATTACHMENTS);
  901.                 ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).removeLabelValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_LABEL_RISPOSTA_CON_ATTACHMENTS);
  902.                
  903.                 if(profiloSicurezzaMessaggioConfigurazioneItemValue!=null &&
  904.                     profiloSicurezzaMessaggioConfigurazioneItemValue.getValue()!=null && !StringUtils.isEmpty(profiloSicurezzaMessaggioConfigurazioneItemValue.getValue())) {
  905.                     String v = profiloSicurezzaMessaggioConfigurazioneItemValue.getValue();
  906.                     if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI_CON_ATTACHMENTS.equals(v) ||
  907.                             ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA_CON_ATTACHMENTS.equals(v) ||
  908.                             ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA_CON_ATTACHMENTS.equals(v) ) {
  909.                         profiloSicurezzaMessaggioConfigurazioneItemValue.setValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_DEFAULT_VALUE);
  910.                     }
  911.                 }
  912.             }
  913.         }
  914.        
  915.         // parametri che serviranno a nascondere requestDigest e infoUtente
  916.         boolean sicurezzaSullaRichiesta = false;
  917.         boolean sicurezzaSullaRisposta = false;
  918.        
  919.        
  920.         boolean configurazionePersonalizzata = false;
  921.         if(isSicurezza01 || isSicurezza02 || isSicurezza03 || isSicurezza04) {
  922.            
  923.             if(sorgenteTokenLocale || isSicurezza03 || isSicurezza04) {
  924.                
  925.                 profiloSicurezzaConfigurazioneItem.setType(ConsoleItemType.SELECT);
  926.                 profiloSicurezzaConfigurazioneItem.setReloadOnChange(true);
  927.            
  928.                 ((StringConsoleItem)profiloSicurezzaConfigurazioneItem).setDefaultValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_DEFAULT_VALUE);
  929.                 String secValue = ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_DEFAULT_VALUE;
  930.                 if(profiloSicurezzaMessaggioConfigurazioneItemValue!=null) {
  931.                     if(profiloSicurezzaMessaggioConfigurazioneItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaMessaggioConfigurazioneItemValue.getValue())) {
  932.                         profiloSicurezzaMessaggioConfigurazioneItemValue.setValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_DEFAULT_VALUE);
  933.                     }
  934.                     else {
  935.                         secValue = profiloSicurezzaMessaggioConfigurazioneItemValue.getValue();
  936.                     }
  937.                    
  938.                     if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_PERSONALIZZATO.equals(secValue)) {
  939.                         configurazionePersonalizzata = true;
  940.                     }
  941.                 }
  942.                
  943.                 if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI.equals(secValue) ||
  944.                         ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_ENTRAMBI_CON_ATTACHMENTS.equals(secValue)) {
  945.                     sicurezzaSullaRichiesta = true;
  946.                     sicurezzaSullaRisposta = true;
  947.                 }
  948.                 else if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA.equals(secValue) ||
  949.                         ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA_CON_ATTACHMENTS.equals(secValue)) {
  950.                     sicurezzaSullaRichiesta = true;
  951.                 }
  952.                 else if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA.equals(secValue) ||
  953.                         ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RISPOSTA_CON_ATTACHMENTS.equals(secValue)) {
  954.                     sicurezzaSullaRisposta = true;
  955.                 }
  956.             }
  957.             else {
  958.                 profiloSicurezzaConfigurazioneItem.setType(ConsoleItemType.HIDDEN);
  959.                 profiloSicurezzaConfigurazioneItem.setReloadOnChange(false);
  960.                
  961.                 if(profiloSicurezzaMessaggioConfigurazioneItemValue!=null) {
  962.                     profiloSicurezzaMessaggioConfigurazioneItemValue.setValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_MESSAGGIO_MODE_VALUE_RICHIESTA);
  963.                 }
  964.                
  965.                 sicurezzaSullaRichiesta = true;
  966.             }
  967.            
  968.         }
  969.         else {
  970.             profiloSicurezzaConfigurazioneItem.setType(ConsoleItemType.HIDDEN);
  971.             if(profiloSicurezzaMessaggioConfigurazioneItemValue!=null) {
  972.                 profiloSicurezzaMessaggioConfigurazioneItemValue.setValue(null);
  973.             }
  974.         }
  975.                
  976.         BaseConsoleItem subTitleRichiesta = ProtocolPropertiesUtils.getBaseConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_ID);
  977.         subTitleRichiesta.setType(configurazionePersonalizzata ? ConsoleItemType.SUBTITLE : ConsoleItemType.HIDDEN);
  978.                
  979.         AbstractConsoleItem<?> profiloSicurezzaRichiestaConfigurazioneItem =    
  980.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_ID);
  981.         profiloSicurezzaRichiestaConfigurazioneItem.setType(configurazionePersonalizzata ? ConsoleItemType.SELECT : ConsoleItemType.HIDDEN);
  982.         if(configurazionePersonalizzata) {
  983.             ((StringConsoleItem)profiloSicurezzaRichiestaConfigurazioneItem).setDefaultValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_DEFAULT_VALUE);
  984.         }
  985.        
  986.         StringProperty profiloSicurezzaRichiestaConfigurazioneItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_ID);
  987.         boolean richiestaPersonalizzata = false;
  988.         if(configurazionePersonalizzata) {
  989.             String secValue = ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_DEFAULT_VALUE;
  990.             if(profiloSicurezzaRichiestaConfigurazioneItemValue!=null) {
  991.                 if(profiloSicurezzaRichiestaConfigurazioneItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaRichiestaConfigurazioneItemValue.getValue())) {
  992.                     profiloSicurezzaRichiestaConfigurazioneItemValue.setValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_DEFAULT_VALUE);
  993.                 }
  994.                 else {
  995.                     secValue = profiloSicurezzaRichiestaConfigurazioneItemValue.getValue();
  996.                 }
  997.                
  998.                 if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_VALUE_PERSONALIZZATO.equals(secValue)) {
  999.                     richiestaPersonalizzata = true;
  1000.                 }
  1001.             }
  1002.             if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_VALUE_ABILITATO.equals(secValue) ||
  1003.                     ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_MODE_VALUE_PERSONALIZZATO.equals(secValue) // per una qualche richiesta sarà abilitato
  1004.                     ) {
  1005.                 sicurezzaSullaRichiesta = true;
  1006.             }
  1007.         }
  1008.         else {
  1009.             if(profiloSicurezzaRichiestaConfigurazioneItemValue!=null) {
  1010.                 profiloSicurezzaRichiestaConfigurazioneItemValue.setValue(null);
  1011.             }
  1012.         }

  1013.         AbstractConsoleItem<?> profiloSicurezzaRichiestaConfigurazioneContentTypeItem =    
  1014.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_CONTENT_TYPE_MODE_ID);
  1015.         profiloSicurezzaRichiestaConfigurazioneContentTypeItem.setType(richiestaPersonalizzata ? ConsoleItemType.TAGS : ConsoleItemType.HIDDEN);
  1016.        
  1017.         StringProperty profiloSicurezzaRichiestaConfigurazioneContentTypeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RICHIESTA_CONTENT_TYPE_MODE_ID);
  1018.         if(!richiestaPersonalizzata && profiloSicurezzaRichiestaConfigurazioneContentTypeItemValue!=null) {
  1019.             profiloSicurezzaRichiestaConfigurazioneContentTypeItemValue.setValue(null);
  1020.         }
  1021.        
  1022.         BaseConsoleItem subTitleRisposta = ProtocolPropertiesUtils.getBaseConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_ID);
  1023.         subTitleRisposta.setType(configurazionePersonalizzata ? ConsoleItemType.SUBTITLE : ConsoleItemType.HIDDEN);
  1024.                
  1025.         AbstractConsoleItem<?> profiloSicurezzaRispostaConfigurazioneItem =    
  1026.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_ID);
  1027.         profiloSicurezzaRispostaConfigurazioneItem.setType(configurazionePersonalizzata ? ConsoleItemType.SELECT : ConsoleItemType.HIDDEN);
  1028.         if(configurazionePersonalizzata) {
  1029.             ((StringConsoleItem)profiloSicurezzaRispostaConfigurazioneItem).setDefaultValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_DEFAULT_VALUE);
  1030.         }
  1031.        
  1032.         StringProperty profiloSicurezzaRispostaConfigurazioneItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_ID);
  1033.         boolean rispostaPersonalizzata = false;
  1034.         if(configurazionePersonalizzata) {
  1035.             String secValue = ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_DEFAULT_VALUE;
  1036.             if(profiloSicurezzaRispostaConfigurazioneItemValue!=null) {
  1037.                 if(profiloSicurezzaRispostaConfigurazioneItemValue.getValue()==null || StringUtils.isEmpty(profiloSicurezzaRispostaConfigurazioneItemValue.getValue())) {
  1038.                     profiloSicurezzaRispostaConfigurazioneItemValue.setValue(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_DEFAULT_VALUE);
  1039.                 }
  1040.                 else {
  1041.                     secValue = profiloSicurezzaRispostaConfigurazioneItemValue.getValue();
  1042.                 }
  1043.                
  1044.                 if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_VALUE_PERSONALIZZATO.equals(secValue)) {
  1045.                     rispostaPersonalizzata = true;
  1046.                 }
  1047.             }
  1048.             if(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_VALUE_ABILITATO.equals(secValue) ||
  1049.                     ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_MODE_VALUE_PERSONALIZZATO.equals(secValue) // per una qualche risposta sarà abilitato
  1050.                 ) {
  1051.                 sicurezzaSullaRisposta = true;
  1052.             }
  1053.         }
  1054.         else {
  1055.             if(profiloSicurezzaRispostaConfigurazioneItemValue!=null) {
  1056.                 profiloSicurezzaRispostaConfigurazioneItemValue.setValue(null);
  1057.             }
  1058.         }
  1059.            
  1060.         AbstractConsoleItem<?> profiloSicurezzaRispostaConfigurazioneContentTypeItem =  
  1061.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_CONTENT_TYPE_MODE_ID);
  1062.         profiloSicurezzaRispostaConfigurazioneContentTypeItem.setType(rispostaPersonalizzata ? ConsoleItemType.TAGS : ConsoleItemType.HIDDEN);
  1063.        
  1064.         StringProperty profiloSicurezzaRispostaConfigurazioneContentTypeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_CONTENT_TYPE_MODE_ID);
  1065.         if(!rispostaPersonalizzata && profiloSicurezzaRispostaConfigurazioneContentTypeItemValue!=null) {
  1066.             profiloSicurezzaRispostaConfigurazioneContentTypeItemValue.setValue(null);
  1067.         }
  1068.        
  1069.         AbstractConsoleItem<?> profiloSicurezzaRispostaConfigurazioneReturnCodeItem =  
  1070.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_ID);
  1071.         profiloSicurezzaRispostaConfigurazioneReturnCodeItem.setType(rispostaPersonalizzata ? ConsoleItemType.TAGS : ConsoleItemType.HIDDEN);
  1072.        
  1073.         StringProperty profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_ID);
  1074.         if(!rispostaPersonalizzata && profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue!=null) {
  1075.             profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue.setValue(null);
  1076.         }
  1077.        
  1078.        
  1079.         //  DigestRichiesta
  1080.                
  1081.         AbstractConsoleItem<?> profiloSicurezzaMessaggioRequestDigestItem =    
  1082.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_ID);
  1083.         BooleanProperty profiloSicurezzaMessaggioRequestDigestItemValue = (BooleanProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_REQUEST_DIGEST_ID);
  1084.        
  1085.         if(isSicurezza03or04 && sicurezzaSullaRichiesta && sicurezzaSullaRisposta) {
  1086.             profiloSicurezzaMessaggioRequestDigestItem.setType(ConsoleItemType.CHECKBOX);
  1087.         }
  1088.         else {
  1089.             if(profiloSicurezzaMessaggioRequestDigestItem!=null) {
  1090.                 profiloSicurezzaMessaggioRequestDigestItem.setType(ConsoleItemType.HIDDEN);
  1091.             }
  1092.             if(profiloSicurezzaMessaggioRequestDigestItemValue!=null) {
  1093.                 profiloSicurezzaMessaggioRequestDigestItemValue.setValue(null);
  1094.             }
  1095.         }
  1096.        
  1097.        
  1098.         // Informazioni Utente
  1099.        
  1100.         AbstractConsoleItem<?> profiloSicurezzaMessaggioCorniceSicurezzaItem =  
  1101.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_ID);
  1102.         BooleanProperty profiloSicurezzaMessaggioCorniceSicurezzaItemValue = (BooleanProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_ID);
  1103.            
  1104.         BaseConsoleItem profiloSicurezzaMessaggioCorniceSicurezzaSubTitle = ProtocolPropertiesUtils.getBaseConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SUBTITLE_ID);
  1105.        
  1106.         StringConsoleItem profiloSicurezzaMessaggioCorniceSicurezzaPatternItem = (StringConsoleItem)
  1107.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_ID);
  1108.         StringProperty profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_ID);
  1109.        
  1110.         StringConsoleItem profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem = (StringConsoleItem)
  1111.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SCHEMA_ID);
  1112.         StringProperty profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SCHEMA_ID);
  1113.        
  1114.         BooleanConsoleItem profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItem = (BooleanConsoleItem)
  1115.                 ProtocolPropertiesUtils.getAbstractConsoleItem(consoleConfiguration.getConsoleItem(), ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_OPZIONALE_ID);
  1116.         BooleanProperty profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItemValue = (BooleanProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_OPZIONALE_ID);
  1117.        
  1118.        
  1119.         boolean infoUtenteAbilitata = profiloSicurezzaMessaggioCorniceSicurezzaItemValue!=null && profiloSicurezzaMessaggioCorniceSicurezzaItemValue.getValue()!=null &&
  1120.                 profiloSicurezzaMessaggioCorniceSicurezzaItemValue.getValue().booleanValue();
  1121.        
  1122.         if(infoUtenteAbilitata && profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue!=null &&
  1123.                 profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue()==null) {
  1124.             // backward compatibility
  1125.             profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.setValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD);
  1126.         }
  1127.        
  1128.         if(sicurezzaSullaRichiesta && infoUtenteAbilitata) {
  1129.             if(profiloSicurezzaMessaggioCorniceSicurezzaItem!=null) {
  1130.                 profiloSicurezzaMessaggioCorniceSicurezzaItem.setType(ConsoleItemType.CHECKBOX);
  1131.             }
  1132.            
  1133.             if(profiloSicurezzaMessaggioCorniceSicurezzaSubTitle!=null) {
  1134.                 profiloSicurezzaMessaggioCorniceSicurezzaSubTitle.setType(ConsoleItemType.SUBTITLE);
  1135.             }
  1136.            
  1137.             if(profiloSicurezzaMessaggioCorniceSicurezzaPatternItem!=null) {
  1138.                
  1139.                 profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.setType(ConsoleItemType.SELECT);
  1140.                
  1141.                 if(sorgenteTokenLocale) {
  1142.                     profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.removeLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_AUDIT_REST_02);
  1143.                 }
  1144.                 else {
  1145.                     profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_AUDIT_REST_02,
  1146.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_AUDIT_REST_02);
  1147.                 }
  1148.                
  1149.                 if(corniceSicurezza && isSicurezza03or04) {
  1150.                     profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.addLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_OLD,
  1151.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD);
  1152.                    
  1153.                     if(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue!=null && profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue()!=null &&
  1154.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD.equals(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue())) {
  1155.                         ConsoleItemInfo consoleItemInfoCorniceSicurezza = new ConsoleItemInfo(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_LABEL);
  1156.                         consoleItemInfoCorniceSicurezza.setHeaderBody(rest ? ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_REST_INFO_HEADER : ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SOAP_INFO_HEADER );
  1157.                         consoleItemInfoCorniceSicurezza.setListBody(rest ? ModIConsoleCostanti.getModipaProfiloSicurezzaMessaggioCorniceSicurezzaRestInfoValori() : ModIConsoleCostanti.getModipaProfiloSicurezzaMessaggioCorniceSicurezzaSoapInfoValori() );
  1158.                         profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.setInfo(consoleItemInfoCorniceSicurezza);
  1159.                     }
  1160.                     else {
  1161.                         profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.setInfo(null);
  1162.                     }
  1163.                 }
  1164.                 else {
  1165.                     profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.removeLabelValue(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_LABEL_OLD);
  1166.                     profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.setInfo(null);
  1167.                    
  1168.                     if(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue!=null && profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue()!=null &&
  1169.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD.equals(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue())) {
  1170.                         profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.setValue(null);
  1171.                     }
  1172.                 }
  1173.             }
  1174.            
  1175.             if(profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem!=null) {
  1176.                
  1177.                 List<ModIAuditConfig> listConfig = modiProperties.getAuditConfig();
  1178.                 if(listConfig!=null && !listConfig.isEmpty()) {
  1179.                
  1180.                     if(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue!=null && profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue()!=null &&
  1181.                             ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD.equals(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue())) {
  1182.                         profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem.setType(ConsoleItemType.HIDDEN);
  1183.                         profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem.setInfo(null);
  1184.                         if(profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue!=null) {
  1185.                             profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue.setValue(null);
  1186.                         }
  1187.                     }
  1188.                     else {
  1189.                        
  1190.                         profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem.setType(ConsoleItemType.SELECT);
  1191.                        
  1192.                         String schemaSelected = profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue!=null ? profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue.getValue() : null;
  1193.                         if( (schemaSelected==null || StringUtils.isEmpty(schemaSelected)) && profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue!=null) {
  1194.                             schemaSelected = listConfig.get(0).getNome();
  1195.                             profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue.setValue(schemaSelected);
  1196.                         }
  1197.                        
  1198.                         if(schemaSelected!=null && StringUtils.isNotEmpty(schemaSelected)) {
  1199.                             for (ModIAuditConfig modIAuditConfig : listConfig) {
  1200.                                 if(modIAuditConfig.getNome().equals(schemaSelected)) {
  1201.                                    
  1202.                                     if(modIAuditConfig.getClaims()!=null && !modIAuditConfig.getClaims().isEmpty()) {
  1203.                                         ConsoleItemInfo consoleItemInfoCorniceSicurezza = new ConsoleItemInfo(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_LABEL);
  1204.                                         consoleItemInfoCorniceSicurezza.setHeaderBody(ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_SCHEMA_INFO_HEADER);
  1205.                                         List<String> body = new ArrayList<>();
  1206.                                         for (ModIAuditClaimConfig claim : modIAuditConfig.getClaims()) {
  1207.                                             StringBuilder sb = new StringBuilder();
  1208.                                             sb.append("<b>");
  1209.                                             sb.append(claim.getNome());
  1210.                                             sb.append("</b>: ");
  1211.                                             sb.append(claim.getInfo());
  1212.                                             body.add(sb.toString());
  1213.                                         }
  1214.                                         consoleItemInfoCorniceSicurezza.setListBody(body);
  1215.                                         profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem.setInfo(consoleItemInfoCorniceSicurezza);
  1216.                                     }
  1217.                                    
  1218.                                     break;
  1219.                                 }
  1220.                             }
  1221.                         }
  1222.                     }
  1223.                    
  1224.                 }
  1225.                
  1226.             }
  1227.            
  1228.             if(profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItem!=null) {
  1229.                
  1230.                 String pattern = profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue!=null ? profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue() : null;
  1231.                 if(pattern==null || ModIConsoleCostanti.MODIPA_PROFILO_SICUREZZA_MESSAGGIO_CORNICE_SICUREZZA_PATTERN_VALUE_OLD.equals(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.getValue())) {
  1232.                     profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItem.setType(ConsoleItemType.HIDDEN);
  1233.                     if(profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItemValue!=null) {
  1234.                         profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItemValue.setValue(null);
  1235.                     }
  1236.                 }
  1237.                 else {
  1238.                     profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItem.setType(ConsoleItemType.CHECKBOX);
  1239.                 }
  1240.             }
  1241.         }
  1242.         else {
  1243.             if(!sicurezzaSullaRichiesta) {
  1244.                 if(profiloSicurezzaMessaggioCorniceSicurezzaItem!=null) {
  1245.                     profiloSicurezzaMessaggioCorniceSicurezzaItem.setType(ConsoleItemType.HIDDEN);
  1246.                 }
  1247.                 if(profiloSicurezzaMessaggioCorniceSicurezzaItemValue!=null) {
  1248.                     profiloSicurezzaMessaggioCorniceSicurezzaItemValue.setValue(null);
  1249.                 }
  1250.             }
  1251.             else {
  1252.                 if(profiloSicurezzaMessaggioCorniceSicurezzaItem!=null) {
  1253.                     profiloSicurezzaMessaggioCorniceSicurezzaItem.setType(ConsoleItemType.CHECKBOX);
  1254.                 }
  1255.             }
  1256.            
  1257.             if(profiloSicurezzaMessaggioCorniceSicurezzaSubTitle!=null) {
  1258.                 profiloSicurezzaMessaggioCorniceSicurezzaSubTitle.setType(ConsoleItemType.HIDDEN);
  1259.             }
  1260.            
  1261.             if(profiloSicurezzaMessaggioCorniceSicurezzaPatternItem!=null) {
  1262.                 profiloSicurezzaMessaggioCorniceSicurezzaPatternItem.setType(ConsoleItemType.HIDDEN);
  1263.             }
  1264.             if(profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue!=null) {
  1265.                 profiloSicurezzaMessaggioCorniceSicurezzaPatternItemValue.setValue(null);
  1266.             }
  1267.            
  1268.             if(profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem!=null) {
  1269.                 profiloSicurezzaMessaggioCorniceSicurezzaSchemaItem.setType(ConsoleItemType.HIDDEN);
  1270.             }
  1271.             if(profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue!=null) {
  1272.                 profiloSicurezzaMessaggioCorniceSicurezzaSchemaItemValue.setValue(null);
  1273.             }
  1274.            
  1275.             if(profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItem!=null) {
  1276.                 profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItem.setType(ConsoleItemType.HIDDEN);
  1277.             }
  1278.             if(profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItemValue!=null) {
  1279.                 profiloSicurezzaMessaggioCorniceSicurezzaOpzionaleItemValue.setValue(null);
  1280.             }
  1281.         }

  1282.     }
  1283.    
  1284.     static void validateProfiloSicurezzaMessaggio(ProtocolProperties properties,
  1285.             boolean rest) throws ProtocolException {
  1286.        
  1287.         if(rest) {
  1288.             StringProperty profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue = (StringProperty) ProtocolPropertiesUtils.getAbstractPropertyById(properties, ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_ID);
  1289.             if(profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue!=null && profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue.getValue()!=null &&
  1290.                     StringUtils.isNotEmpty(profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue.getValue())) {
  1291.                 String v = profiloSicurezzaRispostaConfigurazioneReturnCodeItemValue.getValue();
  1292.                 List<String> codici = new ArrayList<>();
  1293.                 if(v.contains(",")) {
  1294.                     String [] tmp = v.split(",");
  1295.                     for (int i = 0; i < tmp.length; i++) {
  1296.                         codici.add(tmp[i].trim());
  1297.                     }
  1298.                 }
  1299.                 else {
  1300.                     codici.add(v.trim());
  1301.                 }
  1302.                 if(!codici.isEmpty()) {
  1303.                     for (String codice : codici) {
  1304.                         if(codice.contains("-")) {
  1305.                             String [] tmp = codice.split("-");
  1306.                             if(tmp==null || tmp.length!=2) {
  1307.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1308.                                         " '"+codice+"' possiede un formato errato; atteso: codiceMin-codiceMax");
  1309.                             }
  1310.                             String codiceMin = tmp[0];
  1311.                             String codiceMax = tmp[1];
  1312.                             if(codiceMin==null || StringUtils.isEmpty(codiceMin.trim())) {
  1313.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1314.                                         " '"+codice+"' possiede un formato errato (intervallo minimo non definito); atteso: codiceMin-codiceMax");
  1315.                             }
  1316.                             if(codiceMax==null || StringUtils.isEmpty(codiceMax.trim())) {
  1317.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1318.                                         " '"+codice+"' possiede un formato errato (intervallo massimo non definito); atteso: codiceMin-codiceMax");
  1319.                             }
  1320.                             codiceMin = codiceMin.trim();
  1321.                             codiceMax = codiceMax.trim();
  1322.                             int codiceMinInt = -1;
  1323.                             try {
  1324.                                 codiceMinInt = Integer.valueOf(codiceMin);
  1325.                             }catch(Exception e) {
  1326.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1327.                                         " '"+codice+"' contiene un intervallo minimo '"+codiceMin+"' che non è un numero intero");
  1328.                             }
  1329.                             int codiceMaxInt = -1;
  1330.                             try {
  1331.                                 codiceMaxInt = Integer.valueOf(codiceMax);
  1332.                             }catch(Exception e) {
  1333.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1334.                                         " '"+codice+"' contiene un intervallo massimo '"+codiceMax+"' che non è un numero intero");
  1335.                             }
  1336.                             if(codiceMaxInt<=codiceMinInt) {
  1337.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1338.                                         " '"+codice+"' contiene un intervallo massimo '"+codiceMax+"' minore o uguale all'intervallo minimo '"+codiceMin+"'");
  1339.                             }
  1340.                         }
  1341.                         else {
  1342.                             try {
  1343.                                 @SuppressWarnings("unused")
  1344.                                 int codiceInt = Integer.parseInt(codice);
  1345.                             }catch(Exception e) {
  1346.                                 throw new ProtocolException(ModIConsoleCostanti.MODIPA_API_CONFIGURAZIONE_SICUREZZA_RISPOSTA_RETURN_CODE_MODE_LABEL+
  1347.                                         " '"+codice+"' non è un numero intero");
  1348.                             }
  1349.                         }
  1350.                     }
  1351.                 }
  1352.             }
  1353.         }
  1354.        
  1355.     }
  1356.    
  1357. }