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