View Javadoc
1   package fr.paris.lutece.portal.business.securityheader;
2   
3   import javax.validation.constraints.NotEmpty;
4   import javax.validation.constraints.Size;
5   
6   /**
7    * This class represents a HTTP security header. It is mainly defined by a name and a value. The type is the resource on which the security 
8    * is added to the HTTP request (html page or rest api). When the type is equals to page, it is mandatory to specify on which page (category)
9    * the header must be applied. The different categories are all pages, Back Office admin authenticated pages, Back Office logout page, Front 
10   * Office admin authenticated pages and Front Office logout page 
11   */
12  public class SecurityHeader 
13  {
14  	// Variables declarations
15  	private int _nId;
16  	
17  	@NotEmpty( message = "portal.securityheader.validation.securityheader.Name.notEmpty" )
18  	@Size( max = 60 , message = "portal.securityheader.validation.securityheader.Name.size" )
19  	private String _strName;
20  	
21  	@NotEmpty( message = "portal.securityheader.validation.securityheader.Value.notEmpty" )
22  	@Size( max = 1024 , message = "portal.securityheader.validation.securityheader.Value.size" )
23  	private String _strValue;
24  	
25  	@Size( max = 1024 , message = "portal.securityheader.validation.securityheader.Description.size" )
26  	private String _strDescription;
27  	
28  	@NotEmpty( message = "portal.securityheader.validation.securityheader.Type.notEmpty" )
29  	@Size( max = 10 , message = "portal.securityheader.validation.securityheader.Type.size" )
30  	private String _strType;
31  	
32  	@Size( max = 25 , message = "portal.securityheader.validation.securityheader.PageCategory.size" )
33  	private String _strPageCategory;	
34  	
35  	private boolean _bIsActive;
36  
37  	/**
38       * Returns the Id
39       *
40       * @return The Id
41       */
42  	public int getId( ) 
43  	{
44  		return _nId;
45  	}
46  
47  	/**
48       * Sets the Id
49       *
50       * @param nId
51       *            The Id
52       */
53  	public void setId( int nId ) 
54  	{
55  		this._nId = nId;
56  	}
57  	
58  	/**
59       * Returns the name of the security header
60       *
61       * @return the security header name as a String
62       */
63      public String getName( )
64      {
65          return _strName;
66      }
67  
68      /**
69       * Sets the name of the security header
70       *
71       * @param strName
72       *            The security header name
73       */
74      public void setName( String strName )
75      {
76          _strName = strName;
77      }
78      
79      /**
80       * Returns the value of the security header
81       *
82       * @return the security header value as a String
83       */
84      public String getValue( )
85      {
86          return _strValue;
87      }
88  
89      /**
90       * Sets the value of the security header
91       *
92       * @param strValue
93       *            The security header value
94       */
95      public void setValue( String strValue )
96      {
97          _strValue = strValue;
98      }
99      
100     /**
101      * Returns the description of the security header
102      *
103      * @return the security header description as a String
104      */
105     public String getDescription( ) 
106     {
107 		return _strDescription;
108 	}
109 
110     /**
111      * Sets the description of the security header
112      *
113      * @param strDescription
114      *            The security header description
115      */
116 	public void setDescription( String strDescription ) 
117 	{
118 		this._strDescription = strDescription;
119 	}
120     
121 	/**
122      * Returns the type of the security header
123      *
124      * @return the security header type as a String
125      */
126     public String getType( ) 
127     {
128 		return _strType;
129 	}
130 
131     /**
132      * Sets the type of the security header
133      *
134      * @param strType
135      *            The security header type
136      */
137 	public void setType( String strType ) 
138 	{
139 		this._strType = strType;
140 	}
141 
142 	/**
143      * Returns the page category of the security header
144      *
145      * @return the security header page category as a String
146      */
147 	public String getPageCategory( ) 
148 	{
149 		return _strPageCategory;
150 	}
151 
152 	/**
153      * Sets the page category of the security header
154      *
155      * @param strPageCategory
156      *            The security header page category
157      */
158 	public void setPageCategory( String strPageCategory ) 
159 	{
160 		this._strPageCategory = strPageCategory;
161 	}
162 	
163 	/**
164      * Indicates if the security is active or not
165      *
166      * @return true if the security header is active, false otherwise
167      */
168 	public boolean isActive( )
169 	{
170 		return _bIsActive;
171 	}
172 
173 	/**
174      * Activate or deactivate the security header
175      *
176      * @param isActive
177      *            true if the security header is active, false otherwise
178      */
179 	public void setActive( boolean isActive )
180 	{
181 		this._bIsActive = isActive;
182 	}
183 }