GestoreIntegrazionePAAutenticazione.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.pdd.core.integrazione;

  21. import org.openspcoop2.message.constants.ServiceBinding;
  22. import org.openspcoop2.pdd.core.AbstractCore;
  23. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;



  24. /**
  25.  * Classe utilizzata per avere un'autenticazione basata su header
  26.  *
  27.  * @author Poli Andrea (apoli@link.it)
  28.  * @author $Author$
  29.  * @version $Rev$, $Date$
  30.  */
  31. public class GestoreIntegrazionePAAutenticazione extends AbstractCore implements IGestoreIntegrazionePA{


  32.     private boolean rest = true;
  33.     private boolean soap = true;
  34.    
  35.     protected GestoreIntegrazionePAAutenticazione( boolean rest, boolean soap ){
  36.         this.rest = rest;
  37.         this.soap = soap;
  38.     }
  39.     public GestoreIntegrazionePAAutenticazione(){
  40.     }
  41.    
  42.    
  43.     // IN - Request
  44.    
  45.     @Override
  46.     public void readInRequestHeader(HeaderIntegrazione integrazione,
  47.             InRequestPAMessage inRequestPAMessage) throws HeaderIntegrazioneException {
  48.         // nop
  49.     }
  50.    
  51.     // OUT - Request
  52.    
  53.     @Override
  54.     public void setOutRequestHeader(HeaderIntegrazione integrazione,
  55.             OutRequestPAMessage outRequestPAMessage) throws HeaderIntegrazioneException{
  56.        
  57.         boolean process = false;
  58.         if(outRequestPAMessage!=null && outRequestPAMessage.getMessage()!=null && outRequestPAMessage.getMessage().getServiceBinding()!=null) {
  59.             if(ServiceBinding.REST.equals(outRequestPAMessage.getMessage().getServiceBinding())) {
  60.                 process = this.rest;
  61.             }
  62.             else {
  63.                 process = this.soap;
  64.             }
  65.         }
  66.        
  67.         if(process) {
  68.             UtilitiesAutenticazione utilities = new UtilitiesAutenticazione(integrazione, outRequestPAMessage,
  69.                     this.getPddContext(), OpenSPCoop2Logger.getLoggerOpenSPCoopCore());
  70.             utilities.process();
  71.         }
  72.     }
  73.    
  74.     // IN - Response
  75.    
  76.     @Override
  77.     public void readInResponseHeader(HeaderIntegrazione integrazione,
  78.             InResponsePAMessage inResponsePAMessage) throws HeaderIntegrazioneException{
  79.         // nop
  80.     }
  81.        
  82.     // OUT - Response

  83.     @Override
  84.     public void setOutResponseHeader(HeaderIntegrazione integrazione,
  85.             OutResponsePAMessage outResponsePAMessage) throws HeaderIntegrazioneException{
  86.         // nop
  87.     }
  88. }