m2u-upass-core / src / my / com / upass / ConfigBean.java @ 9:16125cca68e4
History | View | Annotate | Download (13.9 KB)
1 | 0:02300db8682b | hadi | /**
|
---|---|---|---|
2 | * Copyright (c) 2012 Penril Datability (M) Sdn Bhd All rights reserved.
|
||
3 | *
|
||
4 | * This software is copyrighted. Under the copyright laws, this software
|
||
5 | * may not be copied, in whole or in part, without prior written consent
|
||
6 | * of Penril Datability (MS) Sdn Bhd or its assignees. This software is
|
||
7 | * provided under the terms of a license between Penril Datability (M)
|
||
8 | * Sdn Bhd and the recipient, and its use is subject to the terms of that
|
||
9 | * license.
|
||
10 | */
|
||
11 | |||
12 | package my.com.upass; |
||
13 | |||
14 | 2:dcd717e1bcae | hadi | import org.apache.commons.lang.StringUtils; |
15 | |||
16 | 0:02300db8682b | hadi | /**
|
17 | * @author penril
|
||
18 | *
|
||
19 | */
|
||
20 | public class ConfigBean { |
||
21 | //password controller
|
||
22 | int passwordMaxTryError = 3; //maximum allowable password error encountered per user |
||
23 | int passwordMaxReuse = 6; //number of password non repeatable |
||
24 | int passwordExpiry = 0; //zero mean never expire, value is in number of day |
||
25 | String passwordValidPattern = "(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+<>?]).{8,}"; |
||
26 | String userNameValidPattern = "^[a-zA-Z0-9_-]{6,16}$"; |
||
27 | int userDormantPeriod = 0; //zero mean never dormant, value is in number of days |
||
28 | int passwordMinLength = 0; |
||
29 | int notifAlert = 0; |
||
30 | int changePasswordInterval = 0; |
||
31 | String passwordAcceptPattern= "^[a-zA-Z0-9!@#$%^&*()_+<>?]{0,}$"; |
||
32 | int autoLogoff = 0; |
||
33 | int userDeactivatePeriod = 0; |
||
34 | int singleSingon = 0; |
||
35 | int passwordComplexity= 0; |
||
36 | int passwordComplexityLowerAlpha = 0; |
||
37 | int passwordComplexityNumeric = 0; |
||
38 | int passwordComplexitySymbol=0; |
||
39 | int passwordComplexityUpperAlpha=0; |
||
40 | |||
41 | |||
42 | static String PASSWORD_MAX_ERROR = "PASSWORD_MAX_ERROR"; |
||
43 | static String PASSWORD_GENERATION = "PASSWORD_GENERATION"; |
||
44 | static String PASSWORD_EXPIRY_DAY = "PASSWORD_EXPIRY_DAY"; |
||
45 | static String PASSWORD_PATTERN = "PASSWORD_PATTERN"; |
||
46 | static String USERNAME_PATTERN = "USERNAME_PATTERN"; |
||
47 | static String USER_DORMANT_PERIOD = "USER_DORMANT_PERIOD"; |
||
48 | static String PASSWORD_MIN_LENGTH="PASSWORD_MIN_LENGTH"; |
||
49 | static String NOTIF_ALERT = "NOTIF_ALERT"; |
||
50 | static String CHANGE_PASSWORD_INTERVAL="CHANGE_PASSWORD_INTERVAL"; |
||
51 | static String PASSWORD_ACCEPT_PATTERN = "PASSWORD_ACCEPT_PATTERN"; |
||
52 | static String PASSWORD_COMPLEXITY = "PASSWORD_COMPLEXITY"; |
||
53 | static String PASSWORD_COMPLEXITY_LOWER_ALPHA = "PASSWORD_COMPLEXITY_LOWER_ALPHA"; |
||
54 | static String PASSWORD_COMPLEXITY_NUMERIC="PASSWORD_COMPLEXITY_NUMERIC"; |
||
55 | static String PASSWORD_COMPLEXITY_SYMBOL="PASSWORD_COMPLEXITY_SYMBOL"; |
||
56 | static String PASSWORD_COMPLEXITY_UPPER_ALPHA="PASSWORD_COMPLEXITY_UPPER_ALPHA"; |
||
57 | static String AUTO_LOGOFF = "AUTO_LOGOFF"; |
||
58 | static String USER_DEACTIVATE_PERIOD = "USER_DEACTIVATE_PERIOD"; |
||
59 | static String SINGLE_SIGNON = "SINGLE_SIGNON"; |
||
60 | |||
61 | |||
62 | //TAC Controller
|
||
63 | int TACMaxTryError = 3; |
||
64 | int TACMaxUse = 3; |
||
65 | int TACTTimeOut = 60000; //in minutes |
||
66 | int TACRepeatTimeOut = 180; //in minutes |
||
67 | int TACLifeSpanTimeOut = 3600; //in minutes |
||
68 | |||
69 | static String TAC_TIME_OUT = "TAC_DEFAULT_TIMEOUT"; |
||
70 | static String TAC_MAX_ERROR = "TAC_MAX_ERROR"; |
||
71 | static String TAC_MAX_USE = "TAC_MAX_USE"; |
||
72 | static String TAC_LIFTSPAN_TIMEOUT = "TAC_LIFTSPAN_TIMEOUT"; |
||
73 | static String TAC_REPEAT_TIMEOUT = "TAC_REPEAT_TIMEOUT"; |
||
74 | |||
75 | private int SCTimeOut; |
||
76 | private int SCMaxError; |
||
77 | private int SCMaxUse; |
||
78 | private int SCLifeSpanTimeOut; |
||
79 | private int SCRepeatTimeOut; |
||
80 | |||
81 | static String SC_TIME_OUT = "SC_TIME_OUT"; |
||
82 | static String SC_MAX_ERROR = "SC_MAX_ERROR"; |
||
83 | static String SC_MAX_USE = "SC_MAX_USE"; |
||
84 | static String SC_LIFTSPAN_TIMEOUT = "SC_LIFTSPAN_TIMEOUT"; |
||
85 | static String SC_REPEAT_TIMEOUT = "SC_REPEAT_TIMEOUT"; |
||
86 | |||
87 | public void setConfigBean(String paramName, String paramValue) |
||
88 | { |
||
89 | if (PASSWORD_MAX_ERROR.equalsIgnoreCase(paramName)) {
|
||
90 | this.setPasswordMaxTryError(Integer.valueOf(paramValue)); |
||
91 | } |
||
92 | else if (PASSWORD_GENERATION.equalsIgnoreCase(paramName)) { |
||
93 | this.setPasswordMaxReuse(Integer.valueOf(paramValue)); |
||
94 | } |
||
95 | else if (PASSWORD_EXPIRY_DAY.equalsIgnoreCase(paramName)) { |
||
96 | this.setPasswordExpiry(Integer.valueOf(paramValue)); |
||
97 | } |
||
98 | else if (PASSWORD_PATTERN.equalsIgnoreCase(paramName)) { |
||
99 | this.setPasswordValidPattern(paramValue);
|
||
100 | } |
||
101 | else if (USERNAME_PATTERN.equalsIgnoreCase(paramName)) { |
||
102 | this.setUserNameValidPattern(paramValue);
|
||
103 | } |
||
104 | else if (USER_DORMANT_PERIOD.equalsIgnoreCase(paramName)) { |
||
105 | this.setUserDormantPeriod(Integer.valueOf(paramValue)); |
||
106 | } |
||
107 | else if (PASSWORD_MIN_LENGTH.equalsIgnoreCase(paramName)) { |
||
108 | this.setPasswordMinLength(Integer.valueOf(paramValue)); |
||
109 | } |
||
110 | else if (NOTIF_ALERT.equalsIgnoreCase(paramName)){ |
||
111 | this.setNotifAlert(Integer.valueOf(paramValue)); |
||
112 | } |
||
113 | else if (CHANGE_PASSWORD_INTERVAL.equalsIgnoreCase(paramName)){ |
||
114 | this.setChangePasswordInterval(Integer.valueOf(paramValue)); |
||
115 | } |
||
116 | else if (PASSWORD_ACCEPT_PATTERN.equalsIgnoreCase(paramName)){ |
||
117 | this.setPasswordAcceptPattern(paramValue);
|
||
118 | } |
||
119 | else if (PASSWORD_COMPLEXITY.equalsIgnoreCase(paramName)){ |
||
120 | this.setPasswordComplexity(Integer.valueOf(paramValue)); |
||
121 | } |
||
122 | else if (PASSWORD_COMPLEXITY_LOWER_ALPHA.equalsIgnoreCase(paramName)){ |
||
123 | this.setPasswordComplexityLowerAlpha(Integer.valueOf(paramValue)); |
||
124 | } |
||
125 | else if (PASSWORD_COMPLEXITY_NUMERIC.equalsIgnoreCase(paramName)){ |
||
126 | this.setPasswordComplexityNumeric(Integer.valueOf(paramValue)); |
||
127 | } |
||
128 | else if (PASSWORD_COMPLEXITY_SYMBOL.equalsIgnoreCase(paramName)){ |
||
129 | this.setPasswordComplexitySymbol(Integer.valueOf(paramValue)); |
||
130 | } |
||
131 | else if (PASSWORD_COMPLEXITY_UPPER_ALPHA.equalsIgnoreCase(paramName)){ |
||
132 | this.setPasswordComplexityUpperAlpha(Integer.valueOf(paramValue)); |
||
133 | } |
||
134 | else if (AUTO_LOGOFF.equalsIgnoreCase(paramName)){ |
||
135 | this.setAutoLogoff(Integer.valueOf(paramValue)); |
||
136 | } |
||
137 | else if (USER_DEACTIVATE_PERIOD.equalsIgnoreCase(paramName)){ |
||
138 | this.setUserDeactivatePeriod(Integer.valueOf(paramValue)); |
||
139 | } |
||
140 | else if (SINGLE_SIGNON.equalsIgnoreCase(paramName)){ |
||
141 | this.setSingleSingon(Integer.valueOf(paramValue)); |
||
142 | } |
||
143 | |||
144 | else if (TAC_TIME_OUT.equalsIgnoreCase(paramName)) { |
||
145 | this.setTACTTimeOut (Integer.valueOf(paramValue)); |
||
146 | } |
||
147 | else if (TAC_MAX_ERROR.equalsIgnoreCase(paramName)) { |
||
148 | this.setTACMaxTryError (Integer.valueOf(paramValue)); |
||
149 | } |
||
150 | else if (TAC_MAX_USE.equalsIgnoreCase(paramName)) { |
||
151 | this.setTACMaxUse (Integer.valueOf(paramValue)); |
||
152 | } |
||
153 | else if (TAC_LIFTSPAN_TIMEOUT.equalsIgnoreCase(paramName)) { |
||
154 | this.setTACLifeSpanTimeOut (Integer.valueOf(paramValue)); |
||
155 | } |
||
156 | else if (TAC_REPEAT_TIMEOUT.equalsIgnoreCase(paramName)) { |
||
157 | this.setTACRepeatTimeOut (Integer.valueOf(paramValue)); |
||
158 | } |
||
159 | |||
160 | else if (SC_TIME_OUT.equalsIgnoreCase(paramName)) { |
||
161 | this.setSCTimeOut (Integer.valueOf(paramValue)); |
||
162 | } |
||
163 | else if (SC_MAX_ERROR.equalsIgnoreCase(paramName)) { |
||
164 | this.setSCMaxError (Integer.valueOf(paramValue)); |
||
165 | } |
||
166 | else if (SC_MAX_USE.equalsIgnoreCase(paramName)) { |
||
167 | this.setSCMaxUse (Integer.valueOf(paramValue)); |
||
168 | } |
||
169 | else if (SC_LIFTSPAN_TIMEOUT.equalsIgnoreCase(paramName)) { |
||
170 | this.setSCLifeSpanTimeOut (Integer.valueOf(paramValue)); |
||
171 | } |
||
172 | else if (SC_REPEAT_TIMEOUT.equalsIgnoreCase(paramName)) { |
||
173 | this.setSCRepeatTimeOut (Integer.valueOf(paramValue)); |
||
174 | } |
||
175 | } |
||
176 | |||
177 | |||
178 | |||
179 | /*======================getter setter for TAC Controller=======================*/
|
||
180 | public int getTACMaxTryError() { |
||
181 | return TACMaxTryError;
|
||
182 | } |
||
183 | |||
184 | /**
|
||
185 | * @param tACMaxTryError the tACMaxTryError to set
|
||
186 | */
|
||
187 | public void setTACMaxTryError(int tACMaxTryError) { |
||
188 | TACMaxTryError = tACMaxTryError; |
||
189 | } |
||
190 | |||
191 | public int getTACMaxUse() { |
||
192 | return TACMaxUse;
|
||
193 | } |
||
194 | |||
195 | /**
|
||
196 | * @param setTACMaxUse the setTACMaxUse to set
|
||
197 | */
|
||
198 | public void setTACMaxUse(int tACMaxUse) { |
||
199 | TACMaxUse = tACMaxUse; |
||
200 | } |
||
201 | |||
202 | /**
|
||
203 | *
|
||
204 | * @return In minutes
|
||
205 | */
|
||
206 | public int getTACTTimeOut() { |
||
207 | return TACTTimeOut;
|
||
208 | } |
||
209 | |||
210 | /**
|
||
211 | *
|
||
212 | * @param tacTTimeOut In minutes
|
||
213 | */
|
||
214 | public void setTACTTimeOut(int tacTTimeOut) { |
||
215 | TACTTimeOut = tacTTimeOut; |
||
216 | } |
||
217 | |||
218 | /**
|
||
219 | *
|
||
220 | * @return In minutes
|
||
221 | */
|
||
222 | public int getTACRepeatTimeOut() { |
||
223 | return TACRepeatTimeOut;
|
||
224 | } |
||
225 | |||
226 | /**
|
||
227 | *
|
||
228 | * @param tacRepeatTimeOut In minutes
|
||
229 | */
|
||
230 | public void setTACRepeatTimeOut(int tacRepeatTimeOut) { |
||
231 | TACRepeatTimeOut = tacRepeatTimeOut; |
||
232 | } |
||
233 | |||
234 | /**
|
||
235 | *
|
||
236 | * @return In minutes
|
||
237 | */
|
||
238 | public int getTACLifeSpanTimeOut() { |
||
239 | return TACLifeSpanTimeOut;
|
||
240 | } |
||
241 | |||
242 | /**
|
||
243 | *
|
||
244 | * @param tacLifeSpanTimeOut In minutes
|
||
245 | */
|
||
246 | public void setTACLifeSpanTimeOut(int tacLifeSpanTimeOut) { |
||
247 | TACLifeSpanTimeOut = tacLifeSpanTimeOut; |
||
248 | } |
||
249 | |||
250 | |||
251 | /*======================getter setter for password Controller=======================*/
|
||
252 | public int getPasswordMaxTryError() { |
||
253 | return passwordMaxTryError;
|
||
254 | } |
||
255 | |||
256 | public void setPasswordMaxTryError(int maxError) { |
||
257 | this.passwordMaxTryError = maxError;
|
||
258 | } |
||
259 | |||
260 | public int getPasswordMaxReuse() { |
||
261 | return passwordMaxReuse;
|
||
262 | } |
||
263 | |||
264 | public void setPasswordMaxReuse(int mxPasswordReuse) { |
||
265 | this.passwordMaxReuse = mxPasswordReuse;
|
||
266 | } |
||
267 | /**
|
||
268 | *
|
||
269 | * @return In number of day
|
||
270 | */
|
||
271 | public int getPasswordExpiry() { |
||
272 | return passwordExpiry;
|
||
273 | } |
||
274 | /**
|
||
275 | *
|
||
276 | * @param passwordExpiryInDay In number of day
|
||
277 | */
|
||
278 | public void setPasswordExpiry(int passwordExpiryInDay) { |
||
279 | this.passwordExpiry = passwordExpiryInDay;
|
||
280 | } |
||
281 | public String getPasswordValidPattern() { |
||
282 | return passwordValidPattern;
|
||
283 | } |
||
284 | public void setPasswordValidPattern(String passwordValidPattern) { |
||
285 | //this will ensure that if the pattern is empty string, it is always set to null to represent no value is set
|
||
286 | 2:dcd717e1bcae | hadi | if (StringUtils.isEmpty(passwordValidPattern)) {
|
287 | 0:02300db8682b | hadi | passwordValidPattern = null;
|
288 | } |
||
289 | this.passwordValidPattern = passwordValidPattern;
|
||
290 | } |
||
291 | public String getUserNameValidPattern() { |
||
292 | return userNameValidPattern;
|
||
293 | } |
||
294 | public void setUserNameValidPattern(String userNameValidPattern) { |
||
295 | this.userNameValidPattern = userNameValidPattern;
|
||
296 | } |
||
297 | /**
|
||
298 | *
|
||
299 | * @return In number of days
|
||
300 | */
|
||
301 | public int getUserDormantPeriod() { |
||
302 | return userDormantPeriod;
|
||
303 | } |
||
304 | /**
|
||
305 | *
|
||
306 | * @param dormantPeriodInDay In number of day
|
||
307 | */
|
||
308 | public void setUserDormantPeriod(int dormantPeriodInDay) { |
||
309 | this.userDormantPeriod = dormantPeriodInDay;
|
||
310 | } |
||
311 | |||
312 | |||
313 | public int getPasswordMinLength() { |
||
314 | return passwordMinLength;
|
||
315 | } |
||
316 | |||
317 | public void setPasswordMinLength(int passwordMinLength) { |
||
318 | this.passwordMinLength = passwordMinLength;
|
||
319 | } |
||
320 | |||
321 | public int getNotifAlert() { |
||
322 | return notifAlert;
|
||
323 | } |
||
324 | |||
325 | |||
326 | public void setNotifAlert(int notifAlert) { |
||
327 | this.notifAlert = notifAlert;
|
||
328 | } |
||
329 | |||
330 | |||
331 | public int getChangePasswordInterval() { |
||
332 | return changePasswordInterval;
|
||
333 | } |
||
334 | |||
335 | |||
336 | public void setChangePasswordInterval(int changePasswordInterval) { |
||
337 | this.changePasswordInterval = changePasswordInterval;
|
||
338 | } |
||
339 | |||
340 | public String getPasswordAcceptPattern() { |
||
341 | return passwordAcceptPattern;
|
||
342 | } |
||
343 | |||
344 | public void setPasswordAcceptPattern(String passwordAcceptPattern) { |
||
345 | |||
346 | //this will ensure that if the pattern is empty string, it is always set to null to represent no value is set
|
||
347 | 2:dcd717e1bcae | hadi | if (StringUtils.isEmpty(passwordAcceptPattern)) {
|
348 | 0:02300db8682b | hadi | passwordAcceptPattern = null;
|
349 | } |
||
350 | |||
351 | this.passwordAcceptPattern = passwordAcceptPattern;
|
||
352 | } |
||
353 | |||
354 | public int getPasswordComplexity() { |
||
355 | return passwordComplexity;
|
||
356 | } |
||
357 | |||
358 | public void setPasswordComplexity(int passwordComplexity) { |
||
359 | this.passwordComplexity = passwordComplexity;
|
||
360 | } |
||
361 | |||
362 | public int getPasswordComplexityLowerAlpha() { |
||
363 | return passwordComplexityLowerAlpha;
|
||
364 | } |
||
365 | |||
366 | public void setPasswordComplexityLowerAlpha(int passwordComplexityLowerAlpha) { |
||
367 | this.passwordComplexityLowerAlpha = passwordComplexityLowerAlpha;
|
||
368 | } |
||
369 | |||
370 | public int getPasswordComplexityNumeric() { |
||
371 | return passwordComplexityNumeric;
|
||
372 | } |
||
373 | |||
374 | public void setPasswordComplexityNumeric(int passwordComplexityNumeric) { |
||
375 | this.passwordComplexityNumeric = passwordComplexityNumeric;
|
||
376 | } |
||
377 | |||
378 | public int getPasswordComplexitySymbol() { |
||
379 | return passwordComplexitySymbol;
|
||
380 | } |
||
381 | |||
382 | public void setPasswordComplexitySymbol(int passwordComplexitySymbol) { |
||
383 | this.passwordComplexitySymbol = passwordComplexitySymbol;
|
||
384 | } |
||
385 | |||
386 | public int getPasswordComplexityUpperAlpha() { |
||
387 | return passwordComplexityUpperAlpha;
|
||
388 | } |
||
389 | |||
390 | public void setPasswordComplexityUpperAlpha(int passwordComplexityUpperAlpha) { |
||
391 | this.passwordComplexityUpperAlpha = passwordComplexityUpperAlpha;
|
||
392 | } |
||
393 | |||
394 | |||
395 | /*======================getter setter for password Controller=======================*/
|
||
396 | |||
397 | public int getAutoLogoff() { |
||
398 | return autoLogoff;
|
||
399 | } |
||
400 | |||
401 | public void setAutoLogoff(int autoLogoff) { |
||
402 | this.autoLogoff = autoLogoff;
|
||
403 | } |
||
404 | |||
405 | public int getUserDeactivatePeriod() { |
||
406 | return userDeactivatePeriod;
|
||
407 | } |
||
408 | |||
409 | public void setUserDeactivatePeriod(int userDeactivatePeriod) { |
||
410 | this.userDeactivatePeriod = userDeactivatePeriod;
|
||
411 | } |
||
412 | |||
413 | public int getSingleSingon() { |
||
414 | return singleSingon;
|
||
415 | } |
||
416 | |||
417 | public void setSingleSingon(int singleSingon) { |
||
418 | this.singleSingon = singleSingon;
|
||
419 | } |
||
420 | |||
421 | /*======================getter setter for SC Controller=======================*/
|
||
422 | /**
|
||
423 | * @return the sCTimeOut
|
||
424 | */
|
||
425 | public int getSCTimeOut () |
||
426 | { |
||
427 | return SCTimeOut;
|
||
428 | } |
||
429 | |||
430 | /**
|
||
431 | * @param sCTimeOut the sCTimeOut to set
|
||
432 | */
|
||
433 | public void setSCTimeOut (int sCTimeOut) |
||
434 | { |
||
435 | SCTimeOut = sCTimeOut; |
||
436 | } |
||
437 | |||
438 | /**
|
||
439 | * @return the sCMaxError
|
||
440 | */
|
||
441 | public int getSCMaxError () |
||
442 | { |
||
443 | return SCMaxError;
|
||
444 | } |
||
445 | |||
446 | /**
|
||
447 | * @param sCMaxError the sCMaxError to set
|
||
448 | */
|
||
449 | public void setSCMaxError (int sCMaxError) |
||
450 | { |
||
451 | SCMaxError = sCMaxError; |
||
452 | } |
||
453 | |||
454 | /**
|
||
455 | * @return the sCMaxUser
|
||
456 | */
|
||
457 | public int getSCMaxUse () |
||
458 | { |
||
459 | return SCMaxUse;
|
||
460 | } |
||
461 | |||
462 | /**
|
||
463 | * @param sCMaxUse the sCMaxUse to set
|
||
464 | */
|
||
465 | public void setSCMaxUse (int sCMaxUse) |
||
466 | { |
||
467 | SCMaxUse = sCMaxUse; |
||
468 | } |
||
469 | |||
470 | /**
|
||
471 | * @return the sCLifeSpanTimeOut
|
||
472 | */
|
||
473 | public int getSCLifeSpanTimeOut () |
||
474 | { |
||
475 | return SCLifeSpanTimeOut;
|
||
476 | } |
||
477 | |||
478 | /**
|
||
479 | * @param sCLifeSpanTimeOut the sCLifeSpanTimeOut to set
|
||
480 | */
|
||
481 | public void setSCLifeSpanTimeOut (int sCLifeSpanTimeOut) |
||
482 | { |
||
483 | SCLifeSpanTimeOut = sCLifeSpanTimeOut; |
||
484 | } |
||
485 | |||
486 | /**
|
||
487 | * @return the sCRepeatTimeOut
|
||
488 | */
|
||
489 | public int getSCRepeatTimeOut () |
||
490 | { |
||
491 | return SCRepeatTimeOut;
|
||
492 | } |
||
493 | |||
494 | /**
|
||
495 | * @param sCRepeatTimeOut the sCRepeatTimeOut to set
|
||
496 | */
|
||
497 | public void setSCRepeatTimeOut (int sCRepeatTimeOut) |
||
498 | { |
||
499 | SCRepeatTimeOut = sCRepeatTimeOut; |
||
500 | } |
||
501 | } |