SSLConfigPropsCache.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.keystore.cache;

  21. import org.openspcoop2.security.SecurityException;
  22. import org.openspcoop2.security.keystore.SSLConfigProps;

  23. /**
  24.  * SSLConfigPropsCache
  25.  *
  26.  * @author Andrea Poli (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class SSLConfigPropsCache extends AbstractKeystoreCache<SSLConfigProps> {    

  31.     @Override
  32.     public SSLConfigProps createKeystore(String key, Object... params) throws SecurityException{
  33.         if(params==null){
  34.             throw new SecurityException("Params is null");
  35.         }
  36.         if(params.length==1){
  37.             if( ! (params[0] instanceof Boolean) ){
  38.                 throw new SecurityException("Param[0] must be Boolean");
  39.             }
  40.             boolean sslConfigRequired = (Boolean) params[0];
  41.             return new SSLConfigProps(key, sslConfigRequired);
  42.         }
  43.         else{
  44.             throw new SecurityException("Params [lenght:"+params.length+"] not supported");
  45.         }
  46.     }

  47.     @Override
  48.     public String getPrefixKey() {
  49.         return "SSLConfigProps ";
  50.     }
  51. }