CertificateChecker.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.web.ctrlstat.core;

  21. import java.util.List;

  22. import org.openspcoop2.core.commons.CoreException;
  23. import org.openspcoop2.pdd.config.ConfigurazioneNodiRuntime;
  24. import org.openspcoop2.pdd.config.InvokerNodiRuntime;
  25. import org.openspcoop2.pdd.core.jmx.AbstractConfigChecker;
  26. import org.openspcoop2.web.ctrlstat.config.ConsoleProperties;
  27. import org.slf4j.Logger;

  28. /**
  29.  * CertificateChecker
  30.  *
  31.  * @author Andrea Poli (apoli@link.it)
  32.  * @author $Author$
  33.  * @version $Rev$, $Date$
  34.  *
  35.  */
  36. public class CertificateChecker extends AbstractConfigChecker {

  37.     private Logger logger;
  38.     private ConsoleProperties consoleProperties;
  39.     private String aliasDefault;
  40.    
  41.     public CertificateChecker(Logger logger, InvokerNodiRuntime invoker, ConfigurazioneNodiRuntime config, List<String> nodiRuntime,
  42.             ConsoleProperties consoleProperties) {
  43.         super(invoker, config, nodiRuntime);
  44.         this.logger = logger;
  45.         this.consoleProperties = consoleProperties;
  46.         this.aliasDefault = nodiRuntime.get(0); // prendo il primo
  47.     }
  48.    
  49.     @Override
  50.     protected String getMultipleNodeSeparator() {
  51.         return org.openspcoop2.core.constants.Costanti.WEB_NEW_LINE;
  52.     }
  53.    
  54.     @Override
  55.     public void error(String msg) {
  56.         this.logger.error(msg);
  57.     }
  58.     @Override
  59.     public void error(String msg, Throwable t) {
  60.         this.logger.error(msg, t);
  61.     }
  62.     @Override
  63.     public Logger getInternalLogger() {
  64.         return this.logger;
  65.     }
  66.    
  67.     @Override
  68.     public boolean isUseApiCertificatoApplicativoById() throws CoreException{
  69.         try {
  70.             return this.consoleProperties.isApplicativiVerificaCertificatiCheckCertificatoApplicativoByIdUseApi();
  71.         }catch(Exception e) {
  72.             throw new CoreException(e.getMessage(),e);
  73.         }
  74.     }
  75.     @Override
  76.     public boolean isUseApiCertificatoSoggettoById() throws CoreException{
  77.         try {
  78.             return this.consoleProperties.isSoggettiVerificaCertificatiCheckCertificatoSoggettoByIdUseApi();
  79.         }catch(Exception e) {
  80.             throw new CoreException(e.getMessage(),e);
  81.         }
  82.     }
  83.    
  84.     @Override
  85.     public String getJmxResourceType() throws CoreException{
  86.         try {
  87.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaType(this.aliasDefault);
  88.         }catch(Exception e) {
  89.             throw new CoreException(e.getMessage(),e);
  90.         }
  91.     }
  92.     @Override
  93.     public String getJmxResourceNomeRisorsaConfigurazionePdD() throws CoreException{
  94.         try {
  95.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeRisorsaConfigurazionePdD(this.aliasDefault);
  96.         }catch(Exception e) {
  97.             throw new CoreException(e.getMessage(),e);
  98.         }
  99.     }
  100.     @Override
  101.     public String getJmxResourceNomeRisorsaAccessoRegistroServizi() throws CoreException{
  102.         try {
  103.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeRisorsaAccessoRegistroServizi(this.aliasDefault);
  104.         }catch(Exception e) {
  105.             throw new CoreException(e.getMessage(),e);
  106.         }
  107.     }
  108.    
  109.     @Override
  110.     public String getJmxResourceNomeMetodoCheckConnettoreById() throws CoreException{
  111.         try {
  112.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckConnettoreById(this.aliasDefault);
  113.         }catch(Exception e) {
  114.             throw new CoreException(e.getMessage(),e);
  115.         }
  116.     }
  117.     @Override
  118.     public String getJmxResourceNomeMetodoCheckCertificatoApplicativoById() throws CoreException{
  119.         try {
  120.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatoApplicativoById(this.aliasDefault);
  121.         }catch(Exception e) {
  122.             throw new CoreException(e.getMessage(),e);
  123.         }
  124.     }
  125.     @Override
  126.     public String getJmxResourceNomeMetodoCheckCertificatoModIApplicativoById() throws CoreException{
  127.         try {
  128.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatoModIApplicativoById(this.aliasDefault);
  129.         }catch(Exception e) {
  130.             throw new CoreException(e.getMessage(),e);
  131.         }
  132.     }
  133.     @Override
  134.     public String getJmxResourceNomeMetodoCheckCertificatoSoggettoById() throws CoreException{
  135.         try {
  136.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatoSoggettoById(this.aliasDefault);
  137.         }catch(Exception e) {
  138.             throw new CoreException(e.getMessage(),e);
  139.         }
  140.     }
  141.     @Override
  142.     public String getJmxResourceNomeMetodoCheckCertificatiConnettoreHttpsById() throws CoreException{
  143.         try {
  144.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiConnettoreHttpsById(this.aliasDefault);
  145.         }catch(Exception e) {
  146.             throw new CoreException(e.getMessage(),e);
  147.         }
  148.     }
  149.     @Override
  150.     public String getJmxResourceNomeMetodoCheckCertificatiModIErogazioneById() throws CoreException{
  151.         try {
  152.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiModIErogazioneById(this.aliasDefault);
  153.         }catch(Exception e) {
  154.             throw new CoreException(e.getMessage(),e);
  155.         }
  156.     }
  157.     @Override
  158.     public String getJmxResourceNomeMetodoCheckCertificatiModIFruizioneById() throws CoreException{
  159.         try {
  160.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiModIFruizioneById(this.aliasDefault);
  161.         }catch(Exception e) {
  162.             throw new CoreException(e.getMessage(),e);
  163.         }
  164.     }
  165.     @Override
  166.     public String getJmxResourceNomeMetodoCheckCertificatiMessageSecurityErogazioneById() throws CoreException {
  167.         try {
  168.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiMessageSecurityErogazioneById(this.aliasDefault);
  169.         }catch(Exception e) {
  170.             throw new CoreException(e.getMessage(),e);
  171.         }
  172.     }

  173.     @Override
  174.     public String getJmxResourceNomeMetodoCheckCertificatiMessageSecurityFruizioneById() throws CoreException {
  175.         try {
  176.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiMessageSecurityFruizioneById(this.aliasDefault);
  177.         }catch(Exception e) {
  178.             throw new CoreException(e.getMessage(),e);
  179.         }
  180.     }
  181.     @Override
  182.     public String getJmxResourceNomeMetodoCheckCertificatiJvm() throws CoreException{
  183.         try {
  184.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiJvm(this.aliasDefault);
  185.         }catch(Exception e) {
  186.             throw new CoreException(e.getMessage(),e);
  187.         }
  188.     }
  189.     @Override
  190.     public String getJmxResourceNomeMetodoCheckCertificatiConnettoreHttpsTokenPolicyValidazione() throws CoreException{
  191.         try {
  192.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiConnettoreHttpsTokenPolicyValidazione(this.aliasDefault);
  193.         }catch(Exception e) {
  194.             throw new CoreException(e.getMessage(),e);
  195.         }
  196.     }
  197.     @Override
  198.     public String getJmxResourceNomeMetodoCheckCertificatiValidazioneJwtTokenPolicyValidazione() throws CoreException{
  199.         try {
  200.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiValidazioneJwtTokenPolicyValidazione(this.aliasDefault);
  201.         }catch(Exception e) {
  202.             throw new CoreException(e.getMessage(),e);
  203.         }
  204.     }
  205.     @Override
  206.     public String getJmxResourceNomeMetodoCheckCertificatiForwardToJwtTokenPolicyValidazione() throws CoreException{
  207.         try {
  208.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiForwardToJwtTokenPolicyValidazione(this.aliasDefault);
  209.         }catch(Exception e) {
  210.             throw new CoreException(e.getMessage(),e);
  211.         }
  212.     }
  213.     @Override
  214.     public String getJmxResourceNomeMetodoCheckCertificatiConnettoreHttpsTokenPolicyNegoziazione() throws CoreException{
  215.         try {
  216.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiConnettoreHttpsTokenPolicyNegoziazione(this.aliasDefault);
  217.         }catch(Exception e) {
  218.             throw new CoreException(e.getMessage(),e);
  219.         }
  220.     }
  221.     @Override
  222.     public String getJmxResourceNomeMetodoCheckCertificatiSignedJwtTokenPolicyNegoziazione() throws CoreException{
  223.         try {
  224.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiSignedJwtTokenPolicyNegoziazione(this.aliasDefault);
  225.         }catch(Exception e) {
  226.             throw new CoreException(e.getMessage(),e);
  227.         }
  228.     }
  229.     @Override
  230.     public String getJmxResourceNomeMetodoCheckCertificatiConnettoreHttpsAttributeAuthority() throws CoreException{
  231.         try {
  232.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiConnettoreHttpsAttributeAuthority(this.aliasDefault);
  233.         }catch(Exception e) {
  234.             throw new CoreException(e.getMessage(),e);
  235.         }
  236.     }
  237.     @Override
  238.     public String getJmxResourceNomeMetodoCheckCertificatiAttributeAuthorityJwtRichiesta() throws CoreException{
  239.         try {
  240.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiAttributeAuthorityJwtRichiesta(this.aliasDefault);
  241.         }catch(Exception e) {
  242.             throw new CoreException(e.getMessage(),e);
  243.         }
  244.     }
  245.     @Override
  246.     public String getJmxResourceNomeMetodoCheckCertificatiAttributeAuthorityJwtRisposta() throws CoreException{
  247.         try {
  248.             return this.consoleProperties.getJmxPdDConfigurazioneSistemaNomeMetodoCheckCertificatiAttributeAuthorityJwtRisposta(this.aliasDefault);
  249.         }catch(Exception e) {
  250.             throw new CoreException(e.getMessage(),e);
  251.         }
  252.     }
  253.    
  254. }