RemoteStoreClientInfo.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;

  21. import java.io.Serializable;

  22. import org.openspcoop2.security.SecurityException;
  23. import org.openspcoop2.utils.certificate.remote.IRemoteStoreProvider;
  24. import org.openspcoop2.utils.certificate.remote.RemoteStoreConfig;

  25. /**
  26.  * RemoteStoreClientInfo
  27.  *
  28.  * @author Poli Andrea (apoli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class RemoteStoreClientInfo implements Serializable {

  33.     private static final long serialVersionUID = 1L;
  34.    
  35.     private String remoteStoreName;
  36.     private String keyId;
  37.     private String clientId;
  38.    
  39.     private org.openspcoop2.utils.certificate.remote.RemoteStoreClientInfo clientInfo;
  40.    
  41.     public RemoteStoreClientInfo(String keyId, String clientId, RemoteStoreConfig remoteStoreConfig, IRemoteStoreProvider provider, org.openspcoop2.utils.Map<Object> context) throws SecurityException {
  42.         try {
  43.             this.keyId = keyId;
  44.             if(keyId==null) {
  45.                 throw new SecurityException("KeyId undefined");
  46.             }
  47.             this.clientId = clientId;
  48.             if(clientId==null) {
  49.                 throw new SecurityException("ClientId undefined");
  50.             }
  51.             if(remoteStoreConfig==null) {
  52.                 throw new SecurityException("RemoteStoreConfig undefined");
  53.             }
  54.             this.remoteStoreName = remoteStoreConfig.getStoreName();
  55.             if(this.remoteStoreName==null) {
  56.                 throw new SecurityException("RemoteStoreConfig name undefined");
  57.             }
  58.             this.clientInfo = provider.readClientInfo(this.keyId, this.clientId, remoteStoreConfig, context);
  59.         }catch(Exception e) {
  60.             throw new SecurityException(e.getMessage(),e);
  61.         }
  62.     }
  63.    
  64.     public String getRemoteStoreName() {
  65.         return this.remoteStoreName;
  66.     }
  67.     public void setRemoteStoreName(String remoteStoreName) {
  68.         this.remoteStoreName = remoteStoreName;
  69.     }

  70.     public String getKeyId() {
  71.         return this.keyId;
  72.     }
  73.     public void setKeyId(String keyId) {
  74.         this.keyId = keyId;
  75.     }

  76.     public String getClientId() {
  77.         return this.clientId;
  78.     }
  79.     public void setClientId(String clientId) {
  80.         this.clientId = clientId;
  81.     }

  82.     public org.openspcoop2.utils.certificate.remote.RemoteStoreClientInfo getClientInfo() {
  83.         return this.clientInfo;
  84.     }
  85.     public void setClientInfo(org.openspcoop2.utils.certificate.remote.RemoteStoreClientInfo clientInfo) {
  86.         this.clientInfo = clientInfo;
  87.     }
  88.    
  89.    
  90. }