MessageSecurityDigestReader_impl.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.security.message.engine;

  21. import org.slf4j.Logger;
  22. import org.openspcoop2.message.OpenSPCoop2MessageFactory;
  23. import org.openspcoop2.message.xml.MessageXMLUtils;
  24. import org.openspcoop2.message.xml.XPathExpressionEngine;
  25. import org.openspcoop2.security.message.MessageSecurityDigestReader;
  26. import org.openspcoop2.security.message.constants.SecurityType;
  27. import org.openspcoop2.utils.digest.IDigestReader;
  28. import org.openspcoop2.utils.digest.WSSecurityDigestReader;
  29. import org.openspcoop2.utils.digest.XMLSecurityDigestReader;

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

  38.     public MessageSecurityDigestReader_impl(Logger log) {
  39.         super(log);
  40.     }

  41.     @Override
  42.     public IDigestReader getDigestReader(OpenSPCoop2MessageFactory messageFactory, SecurityType securityType) {
  43.         switch (securityType) {
  44.         case WSSecurity:
  45.             return new WSSecurityDigestReader(this.log,MessageXMLUtils.getInstance(messageFactory),new XPathExpressionEngine(messageFactory));
  46.         case XMLSecurity:
  47.             return new XMLSecurityDigestReader(this.log,MessageXMLUtils.getInstance(messageFactory),new XPathExpressionEngine(messageFactory));
  48.         default:
  49.             return null;
  50.         }
  51.     }

  52. }