SecurityInfo.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.protocol.sdk;

  21. import java.util.ArrayList;
  22. import java.util.HashMap;
  23. import java.util.List;
  24. import java.util.Map;

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

  33.     private String subject;
  34.     private String digestHeader;
  35.     private List<Allegato> listaAllegati = null;
  36.     private Map<String, String> properties = null;
  37.    
  38.     public SecurityInfo(){
  39.         this.listaAllegati = new ArrayList<Allegato>();
  40.         this.properties = new HashMap<>();
  41.     }
  42.    
  43.     public List<Allegato> getListaAllegati() {
  44.         if (this.listaAllegati == null) {
  45.             this.listaAllegati = new ArrayList<Allegato>();
  46.         }
  47.         return this.listaAllegati;
  48.     }
  49.     public int sizeListaAllegati() {
  50.         return this.listaAllegati.size();
  51.     }
  52.     public void addAllegato(Allegato a) {
  53.         this.listaAllegati.add(a);
  54.     }
  55.     public Allegato getAllegato(int index) {
  56.         return this.listaAllegati.get( index );
  57.     }
  58.     public Allegato removeAllegato(int index) {
  59.         return this.listaAllegati.remove(index);
  60.     }

  61.     public String getSubject() {
  62.         return this.subject;
  63.     }

  64.     public void setSubject(String subject) {
  65.         this.subject = subject;
  66.     }

  67.     public String getDigestHeader() {
  68.         return this.digestHeader;
  69.     }

  70.     public void setDigestHeader(String digestHeader) {
  71.         this.digestHeader = digestHeader;
  72.     }

  73.     public void setListaAllegati(List<Allegato> listaAllegati) {
  74.         this.listaAllegati = listaAllegati;
  75.     }
  76.    
  77.     public void addProperty(String key,String value){
  78.         this.properties.put(key,value);
  79.     }
  80.    
  81.     public int sizeProperties(){
  82.         return this.properties.size();
  83.     }

  84.     public String getProperty(String key){
  85.         return this.properties.get(key);
  86.     }
  87.    
  88.     public String removeProperty(String key){
  89.         return this.properties.remove(key);
  90.     }
  91.    
  92.     public String[] getPropertiesValues() {
  93.         return this.properties.values().toArray(new String[this.properties.size()]);
  94.     }
  95.    
  96.     public String[] getPropertiesNames() {
  97.         return this.properties.keySet().toArray(new String[this.properties.size()]);
  98.     }
  99.    
  100.     public void setProperties(Map<String, String> params) {
  101.         this.properties = params;
  102.     }
  103.    
  104.     public Map<String, String> getProperties() {
  105.         return this.properties;
  106.     }
  107. }