Revision 49:21c91e3e9ce0
src/main/java/my/com/upass/MinimalUPassControllerV2.java | ||
---|---|---|
188 | 188 |
} else { |
189 | 189 |
user.setUserType(MinimalConstants.UTYPE_STATE_USER); |
190 | 190 |
user.setPstate(MinimalConstants.UID_STATE_ACTIVE); |
191 |
rc = createUserService.addUser(
|
|
191 |
rc = createUserAndGrantAccessToApp(
|
|
192 | 192 |
user, appId.intValue(), accessType, txSession, checkPassword); |
193 | 193 |
} |
194 | 194 |
|
... | ... | |
204 | 204 |
return rc; |
205 | 205 |
} |
206 | 206 |
|
207 |
private int createUserAndGrantAccessToApp( |
|
208 |
MinimalUserBean user, int appId, char accessType, |
|
209 |
Session txSession, boolean checkPassword) { |
|
210 |
|
|
211 |
int rc; |
|
212 |
CreateUserService.ReturnBundle creationResult = |
|
213 |
createUserService.addUser(user, txSession, checkPassword); |
|
214 |
|
|
215 |
rc = creationResult.getCode(); |
|
216 |
if (rc == MinimalConstants.ERR_SUCCESS) { |
|
217 |
final long userId = creationResult.getUserId().longValue(); |
|
218 |
boolean granted = appAccessMgtService.grantAppAccessToUser( |
|
219 |
userId, appId, accessType, txSession); |
|
220 |
|
|
221 |
rc = granted ? |
|
222 |
MinimalConstants.ERR_SUCCESS |
|
223 |
: MinimalConstants.ERR_SYSTEM_NOT_READY; |
|
224 |
} |
|
225 |
return rc; |
|
226 |
} |
|
227 |
|
|
207 | 228 |
/** |
208 | 229 |
* Because of the ability to choose the target app, |
209 | 230 |
* this method is meant for USS only. |
... | ... | |
231 | 252 |
else { |
232 | 253 |
user.setUserType(MinimalConstants.UTYPE_STATE_USER); |
233 | 254 |
user.setPstate(MinimalConstants.UID_STATE_ACTIVE); |
234 |
rc = createUserService.addUser(
|
|
255 |
rc = createUserAndGrantAccessToApp(
|
|
235 | 256 |
user, targetAppId, accessType, txSession, checkPassword); |
236 | 257 |
} |
237 |
|
|
238 | 258 |
} catch (MultipleAppAccessesFound e) { |
239 | 259 |
rc = MinimalConstants.ERR_APP_SERV_NOT_PERMITTED; |
240 | 260 |
e.printStackTrace(); |
... | ... | |
342 | 362 |
|
343 | 363 |
public int updateProfileShallowly( |
344 | 364 |
String appAccessId, String hashedSecretKey, |
345 |
UserProfile profile, Session txSession) { |
|
365 |
UserProfile profile, Session txSession) |
|
366 |
throws UPassException { |
|
346 | 367 |
|
347 | 368 |
MinimalUserBean user = profile.getMinUser(); |
348 | 369 |
final String userAlias = user.getUserAlias(); |
349 | 370 |
|
350 |
// // check if password is similar to user alias |
|
351 |
// if (userAlias.equalsIgnoreCase(doubleHashedPassword)) { |
|
352 |
// return MinimalConstants.ERR_PASSWORD_SAMEAS_USERALIAS; |
|
353 |
// } |
|
354 |
|
|
355 | 371 |
int rc; |
356 | 372 |
try { |
357 | 373 |
AccessCheckResult checkResult = checkAppAccess(appAccessId, hashedSecretKey, txSession); |
358 | 374 |
|
359 |
Integer appId = checkResult.invokerAppId; |
|
360 |
Integer userType = checkResult.invokerUserType; |
|
375 |
final Integer invokingAppId = checkResult.invokerAppId; |
|
361 | 376 |
|
362 | 377 |
final Object appIdObj = AppAccessMgtService.profileToAppMap.get(profile.getClass()); |
363 | 378 |
final int appIdForProfile = ((Integer) appIdObj).intValue(); |
364 | 379 |
|
365 |
if ((appId == null && !checkResult.hasUPassAdminAccess())
|
|
366 |
|| appId.intValue() != appIdForProfile) {
|
|
380 |
if ((invokingAppId == null && !checkResult.hasUPassAdminAccess())
|
|
381 |
|| invokingAppId.intValue() != appIdForProfile) {
|
|
367 | 382 |
|
368 | 383 |
rc = MinimalConstants.ERR_APP_SERV_NOT_PERMITTED; |
369 | 384 |
|
... | ... | |
373 | 388 |
} catch (MultipleAppAccessesFound e) { |
374 | 389 |
rc = MinimalConstants.ERR_APP_SERV_NOT_PERMITTED; |
375 | 390 |
e.printStackTrace(); |
376 |
|
|
377 |
} catch (UPassException e) { |
|
378 |
rc = e.getErrorCode(); |
|
379 |
e.printStackTrace(); |
|
380 | 391 |
} |
381 | 392 |
logger.info("updateProfileShallowly - user alias: [" + userAlias + "] Return: " + rc); |
382 | 393 |
return rc; |
... | ... | |
453 | 464 |
|
454 | 465 |
public class AccessCheckResult { |
455 | 466 |
|
456 |
private Integer invokerAppId;
|
|
457 |
private Integer invokerUserType;
|
|
467 |
protected Integer invokerAppId;
|
|
468 |
protected Integer invokerUserType;
|
|
458 | 469 |
|
459 | 470 |
public Integer getInvokerAppId() { |
460 | 471 |
return invokerAppId; |
... | ... | |
480 | 491 |
return checkResult; |
481 | 492 |
|
482 | 493 |
List appIdsForUser = appAccessMgtService.listAppIdsForUser(username, txSession); |
483 |
int retCode = appIdsForUser.contains(checkResult.invokerAppId) ? |
|
484 |
MinimalConstants.ERR_SUCCESS |
|
485 |
: MinimalConstants.ERR_APP_SERV_NOT_PERMITTED; |
|
494 |
int retCode = |
|
495 |
!appIdsForUser.isEmpty() ? |
|
496 |
appIdsForUser.contains(checkResult.invokerAppId) ? |
|
497 |
MinimalConstants.ERR_SUCCESS |
|
498 |
: MinimalConstants.ERR_APP_SERV_NOT_PERMITTED |
|
499 |
: MinimalConstants.ERR_USERALIAS_NOT_FOUND; |
|
486 | 500 |
|
487 | 501 |
if (retCode != MinimalConstants.ERR_SUCCESS) |
488 | 502 |
throw new UPassException(retCode); |
src/main/java/my/com/upass/dao/UserDAO.java | ||
---|---|---|
36 | 36 |
*/ |
37 | 37 |
public interface UserDAO extends GenericDAO { |
38 | 38 |
|
39 |
boolean addUserAppAccess(UserAppAccess access, Session txSession) throws Exception; |
|
40 |
|
|
41 | 39 |
void deleteTbAmUser(Integer tUserId, final Session txSession) throws Exception; |
42 | 40 |
|
43 | 41 |
boolean deleteUser(MinimalUserBean userBean, final Session txSession) throws Exception; |
44 | 42 |
|
43 |
boolean deleteProfile(String username, Class/* <UserProfile> */profileClass, Session txSession) throws Exception; |
|
44 |
|
|
45 | 45 |
MinimalUserBean getTbAmUserByUserAlias(String userAlias, final Session txSession) throws Exception; |
46 | 46 |
|
47 | 47 |
MinimalUserBean getTbAmUserByUserId(Long userId, final Session txSession) throws Exception; |
... | ... | |
56 | 56 |
|
57 | 57 |
boolean insertUserToStore(MinimalUserBean userBean, final Session txSession) throws Exception; |
58 | 58 |
|
59 |
boolean addUserAppAccess(UserAppAccess access, Session txSession) throws Exception; |
|
60 |
|
|
61 |
boolean removeUserAppAccess(String username, int appId, Session txSession) throws Exception; |
|
62 |
|
|
59 | 63 |
/** |
60 | 64 |
* @param appAccessId |
61 | 65 |
* @param accessType |
... | ... | |
81 | 85 |
List/* <UserProfile> */listProfilesByExamples( |
82 | 86 |
List/* <UserProfile> */exampleProfiles, final Session txSession) |
83 | 87 |
throws Exception; |
88 |
|
|
84 | 89 |
} |
src/main/java/my/com/upass/dao/hibernate/UserDAOHibernate.java | ||
---|---|---|
407 | 407 |
} |
408 | 408 |
|
409 | 409 |
public boolean addUserAppAccess(UserAppAccess access, Session txSession) throws Exception { |
410 |
|
|
410 | 411 |
boolean successful = false; |
411 |
; |
|
412 | 412 |
Session session = null; |
413 | 413 |
try { |
414 | 414 |
session = txSession != null ? txSession : getSession(); |
... | ... | |
518 | 518 |
} |
519 | 519 |
return profiles; |
520 | 520 |
} |
521 |
|
|
522 |
public boolean deleteProfile(String username, Class profileClass, Session txSession) throws Exception { |
|
523 |
|
|
524 |
boolean isSuccessful = false; |
|
525 |
Session session = null; |
|
526 |
try { |
|
527 |
session = txSession != null ? txSession : getSession(); |
|
528 |
if (txSession == null) |
|
529 |
session.beginTransaction(); |
|
530 |
|
|
531 |
MinimalUserBean user = getUserFromStore(username, txSession); |
|
532 |
final Long userId = new Long(user.getUserID()); |
|
533 |
UserProfile profile = (UserProfile) session.get(profileClass, userId); |
|
534 |
session.delete(profile); |
|
535 |
|
|
536 |
if (txSession == null) |
|
537 |
session.getTransaction().commit(); |
|
538 |
|
|
539 |
isSuccessful = true; |
|
540 |
|
|
541 |
} catch (Exception e) { |
|
542 |
if (txSession == null) { |
|
543 |
rollbackTransactionIfAny(session); |
|
544 |
logger.error(e, e); |
|
545 |
|
|
546 |
} else |
|
547 |
throw e; |
|
548 |
|
|
549 |
} finally { |
|
550 |
if (txSession == null) |
|
551 |
closeSessionIfAny(session); |
|
552 |
} |
|
553 |
return isSuccessful; |
|
554 |
} |
|
555 |
|
|
556 |
public boolean removeUserAppAccess( |
|
557 |
String username, int appId, Session txSession) |
|
558 |
throws Exception { |
|
559 |
|
|
560 |
boolean isSuccessful = false; |
|
561 |
Session session = null; |
|
562 |
try { |
|
563 |
session = txSession != null ? txSession : getSession(); |
|
564 |
if (txSession == null) |
|
565 |
session.beginTransaction(); |
|
566 |
|
|
567 |
final Query query = session.createQuery( |
|
568 |
"FROM UserAppAccess" |
|
569 |
+ " WHERE user.userAlias = :username" |
|
570 |
+ " AND appId = :appId"); |
|
571 |
|
|
572 |
UserAppAccess access = (UserAppAccess) query |
|
573 |
.setString("username", username) |
|
574 |
.setInteger("appId", appId) |
|
575 |
.uniqueResult(); |
|
576 |
|
|
577 |
session.delete(access); |
|
578 |
|
|
579 |
if (txSession == null) |
|
580 |
session.getTransaction().commit(); |
|
581 |
|
|
582 |
isSuccessful = true; |
|
583 |
|
|
584 |
} catch (Exception e) { |
|
585 |
if (txSession == null) { |
|
586 |
rollbackTransactionIfAny(session); |
|
587 |
logger.error(e, e); |
|
588 |
|
|
589 |
} else |
|
590 |
throw e; |
|
591 |
|
|
592 |
} finally { |
|
593 |
if (txSession == null) |
|
594 |
closeSessionIfAny(session); |
|
595 |
} |
|
596 |
return isSuccessful; |
|
597 |
} |
|
521 | 598 |
} |
src/main/java/my/com/upass/maybank/MinimalMaybankFacadeImpl.java | ||
---|---|---|
184 | 184 |
|
185 | 185 |
if (rc == MinimalConstants.ERR_SUCCESS) { |
186 | 186 |
rc = minUpcV2.updateProfileShallowly(appAccessId, hashedSecretKey, profile, session); |
187 |
session.getTransaction().commit(); |
|
187 |
|
|
188 |
if (rc == MinimalConstants.ERR_SUCCESS) |
|
189 |
session.getTransaction().commit(); |
|
190 |
else |
|
191 |
GenericDAOHibernate.rollbackTransactionIfAny(session); |
|
188 | 192 |
|
189 | 193 |
} else |
190 | 194 |
GenericDAOHibernate.rollbackTransactionIfAny(session); |
191 | 195 |
|
196 |
} catch (UPassException e) { |
|
197 |
rc = e.getErrorCode(); |
|
198 |
LOGGER.error(e, e); |
|
199 |
GenericDAOHibernate.rollbackTransactionIfAny(session); |
|
200 |
|
|
192 | 201 |
} catch (Exception e) { |
202 |
LOGGER.error(e, e); |
|
193 | 203 |
GenericDAOHibernate.rollbackTransactionIfAny(session); |
194 |
LOGGER.error(e, e); |
|
195 | 204 |
|
196 | 205 |
} finally { |
197 | 206 |
GenericDAOHibernate.closeSessionIfAny(session); |
... | ... | |
227 | 236 |
int rc = minUpcV2.updateProfileShallowly( |
228 | 237 |
appAccessId, hashedSecretKey, m2uUser, session); |
229 | 238 |
|
230 |
session.getTransaction().commit(); |
|
239 |
if (rc == MinimalConstants.ERR_SUCCESS) |
|
240 |
session.getTransaction().commit(); |
|
241 |
else |
|
242 |
GenericDAOHibernate.rollbackTransactionIfAny(session); |
|
243 |
|
|
231 | 244 |
return rc; |
232 | 245 |
|
233 | 246 |
} else { |
src/main/java/my/com/upass/services/AppAccessMgtService.java | ||
---|---|---|
12 | 12 |
package my.com.upass.services; |
13 | 13 |
|
14 | 14 |
import java.util.ArrayList; |
15 |
import java.util.Date; |
|
15 | 16 |
import java.util.HashMap; |
16 | 17 |
import java.util.Iterator; |
17 | 18 |
import java.util.List; |
... | ... | |
72 | 73 |
public Integer getAppIdForAdmin(String appAccessId, Session txSession) throws MultipleAppAccessesFound { |
73 | 74 |
|
74 | 75 |
Integer appId = null; |
75 |
UserDAO userDao; |
|
76 | 76 |
try { |
77 |
userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
|
77 |
UserDAO userDao = MinimalDAOFactory.minimalInstance().getUserDAO();
|
|
78 | 78 |
List accessList = userDao.listUserAppAccesses(appAccessId, UserAppAccess.TYPE_ADMIN, txSession); |
79 | 79 |
|
80 | 80 |
if (accessList.size() > 1) |
... | ... | |
94 | 94 |
throws MultipleAppAccessesFound { |
95 | 95 |
|
96 | 96 |
List appIds = new ArrayList(5); |
97 |
UserDAO userDao; |
|
98 | 97 |
try { |
99 |
userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
|
98 |
UserDAO userDao = MinimalDAOFactory.minimalInstance().getUserDAO();
|
|
100 | 99 |
List accessList = userDao.listUserAppAccesses(username, txSession); |
101 | 100 |
Iterator iterator = accessList.iterator(); |
102 | 101 |
while (iterator.hasNext()) { |
... | ... | |
109 | 108 |
return appIds; |
110 | 109 |
} |
111 | 110 |
|
111 |
public boolean grantAppAccessToUser( |
|
112 |
long userId, int applicationId, char accessType, Session txSession) { |
|
113 |
|
|
114 |
boolean granted = false; |
|
115 |
try { |
|
116 |
UserDAO userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
|
117 |
|
|
118 |
UserAppAccess access = new UserAppAccess(); |
|
119 |
access.setUserId(userId); |
|
120 |
access.setAppId(applicationId); |
|
121 |
access.setAccessType(accessType); |
|
122 |
access.setRegistrationTime(new Date()); |
|
123 |
|
|
124 |
granted = userDao.addUserAppAccess(access, txSession); |
|
125 |
|
|
126 |
} catch (Exception e) { |
|
127 |
e.printStackTrace(); |
|
128 |
} |
|
129 |
return granted; |
|
130 |
} |
|
131 |
|
|
132 |
public boolean revokeAppAccessForUser( |
|
133 |
String username, int appId, Session txSession) { |
|
134 |
|
|
135 |
boolean removed = false; |
|
136 |
try { |
|
137 |
UserDAO userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
|
138 |
removed = userDao.removeUserAppAccess(username, appId, txSession); |
|
139 |
|
|
140 |
} catch (Exception e) { |
|
141 |
e.printStackTrace(); |
|
142 |
} |
|
143 |
return removed; |
|
144 |
} |
|
145 |
|
|
112 | 146 |
// |
113 | 147 |
|
114 | 148 |
public class MultipleAppAccessesFound extends Exception { |
115 | 149 |
private static final long serialVersionUID = 1L; |
116 | 150 |
} |
151 |
|
|
117 | 152 |
} |
src/main/java/my/com/upass/services/CreateUserService.java | ||
---|---|---|
39 | 39 |
*/ |
40 | 40 |
public class CreateUserService { |
41 | 41 |
|
42 |
public class ReturnBundle { |
|
43 |
|
|
44 |
private int code; |
|
45 |
public Long userId; |
|
46 |
|
|
47 |
public int getCode() { |
|
48 |
return code; |
|
49 |
} |
|
50 |
|
|
51 |
public Long getUserId() { |
|
52 |
return userId; |
|
53 |
} |
|
54 |
} |
|
55 |
|
|
42 | 56 |
private MinimalUPassControllerV2 upc; |
43 | 57 |
|
44 | 58 |
public CreateUserService(MinimalUPassControllerV2 upc) { |
45 | 59 |
this.upc = upc; |
46 | 60 |
} |
47 | 61 |
|
48 |
public int addUser(
|
|
62 |
public ReturnBundle addUser(
|
|
49 | 63 |
String userAlias, int userType, String userDesc, |
50 |
String userPassword, int userState, int applicationId, |
|
51 |
char accessType, Session txSession, boolean checkPassword) { |
|
64 |
String userPassword, int userState, Session txSession, boolean checkPassword) { |
|
52 | 65 |
|
53 |
int rc = MinimalConstants.ERR_SYSTEM_NOT_READY; |
|
66 |
final ReturnBundle ret = new ReturnBundle(); |
|
67 |
ret.code = MinimalConstants.ERR_SYSTEM_NOT_READY; |
|
54 | 68 |
|
55 | 69 |
if (userAlias == null) { |
56 |
return MinimalConstants.ERR_INVALID_INPUT; |
|
70 |
ret.code = MinimalConstants.ERR_INVALID_INPUT; |
|
71 |
return ret; |
|
57 | 72 |
} |
58 |
|
|
59 | 73 |
if (checkPassword && userPassword == null) { |
60 |
return MinimalConstants.ERR_INVALID_INPUT; |
|
74 |
ret.code = MinimalConstants.ERR_INVALID_INPUT; |
|
75 |
return ret; |
|
61 | 76 |
} |
62 |
|
|
63 |
UserDAO userDao; |
|
64 | 77 |
try { |
65 |
userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
|
66 |
|
|
78 |
UserDAO userDao = MinimalDAOFactory.minimalInstance().getUserDAO(); |
|
67 | 79 |
MinimalUserBean ub = userDao.getUserFromStore(userAlias, txSession); |
68 | 80 |
|
69 | 81 |
if (ub == null) { |
... | ... | |
81 | 93 |
|
82 | 94 |
PasswordController pc = MinimalUPassFactory.getPasswordController(ub, |
83 | 95 |
upc.getConfigurationsMap()); |
84 |
rc = pc.VerifyUserAlias(userAlias);
|
|
96 |
ret.code = pc.VerifyUserAlias(userAlias);
|
|
85 | 97 |
|
86 |
if (rc != MinimalConstants.ERR_SUCCESS) {
|
|
87 |
return rc;
|
|
98 |
if (ret.code != MinimalConstants.ERR_SUCCESS) {
|
|
99 |
return ret;
|
|
88 | 100 |
} |
101 |
if (checkPassword) { |
|
102 |
ret.code = pc.GeneratePassword(userPassword, true); |
|
89 | 103 |
|
90 |
if (checkPassword) { |
|
91 |
rc = pc.GeneratePassword(userPassword, true); |
|
92 |
|
|
93 |
if (rc != MinimalConstants.ERR_SUCCESS) { |
|
94 |
return rc; |
|
104 |
if (ret.code != MinimalConstants.ERR_SUCCESS) { |
|
105 |
return ret; |
|
95 | 106 |
} |
96 | 107 |
} |
97 |
|
|
98 | 108 |
ub = (MinimalUserBean) pc.getUpdatedObject(); |
99 | 109 |
|
100 | 110 |
// UserMasterBean master = new UserMasterBean (); |
... | ... | |
106 | 116 |
// tac.setUpassUser (ub); |
107 | 117 |
// ub.setTacbean (tac); |
108 | 118 |
|
109 |
if (userDao.insertUserToStore(ub, txSession)) { |
|
119 |
final boolean inserted = userDao.insertUserToStore(ub, txSession); |
|
120 |
if (inserted) { |
|
121 |
ret.code = MinimalConstants.ERR_SUCCESS; |
|
122 |
ret.userId = new Long(nextVal); |
|
110 | 123 |
|
111 |
UserAppAccess access = new UserAppAccess(); |
|
112 |
access.setUserId(nextVal); |
|
113 |
access.setAppId(applicationId); |
|
114 |
access.setAccessType(accessType); |
|
115 |
access.setRegistrationTime(new Date()); |
|
124 |
} else |
|
125 |
ret.code = MinimalConstants.ERR_SYSTEM_NOT_READY; |
|
116 | 126 |
|
117 |
userDao.addUserAppAccess(access, txSession); |
|
118 |
|
|
119 |
rc = MinimalConstants.ERR_SUCCESS; |
|
120 |
|
|
121 |
} else { |
|
122 |
rc = MinimalConstants.ERR_SYSTEM_NOT_READY; |
|
123 |
} |
|
124 | 127 |
} else { |
125 |
rc = MinimalConstants.ERR_ALREADY_EXIST;
|
|
128 |
ret.code = MinimalConstants.ERR_ALREADY_EXIST;
|
|
126 | 129 |
} |
127 | 130 |
} catch (Exception e) { |
128 | 131 |
e.printStackTrace(); |
129 | 132 |
} |
130 |
return rc; |
|
133 |
return ret; |
|
134 |
} |
|
135 |
|
|
136 |
public ReturnBundle addUser( |
|
137 |
String userAlias, int userType, String userDesc, |
|
138 |
String userPassword, int userState, Session txSession) { |
|
139 |
|
|
140 |
return addUser( |
|
141 |
userAlias, userType, userDesc, userPassword, userState, txSession, true); |
|
131 | 142 |
} |
132 | 143 |
|
133 | 144 |
public int addUser( |
134 | 145 |
String userAlias, int userType, String userDesc, |
135 |
String userPassword, int userState, int applicationId, Session txSession) {
|
|
146 |
String userPassword, int userState, int appId) {
|
|
136 | 147 |
|
137 |
final char notApplicable = '\0'; |
|
138 |
return addUser( |
|
139 |
userAlias, userType, userDesc, userPassword, userState, |
|
140 |
applicationId, notApplicable, txSession, true); |
|
148 |
ReturnBundle ret = addUser(userAlias, userType, userDesc, userPassword, userState, null); |
|
149 |
|
|
150 |
int rc = ret.code; |
|
151 |
if (rc == MinimalConstants.ERR_SUCCESS |
|
152 |
&& userType == MinimalConstants.UTYPE_STATE_USER) { |
|
153 |
|
|
154 |
AppAccessMgtService accessMgtService = new AppAccessMgtService(); |
|
155 |
|
|
156 |
final long userId = ret.userId.longValue(); |
|
157 |
boolean granted = accessMgtService.grantAppAccessToUser(userId, appId, UserAppAccess.TYPE_USER, null); |
|
158 |
rc = granted ? |
|
159 |
MinimalConstants.ERR_SUCCESS |
|
160 |
: MinimalConstants.ERR_SYSTEM_NOT_READY; |
|
161 |
} |
|
162 |
return rc; |
|
141 | 163 |
} |
142 | 164 |
|
143 |
public int addUser( |
|
144 |
String userAlias, int userType, String userDesc, |
|
145 |
String userPassword, int userState, int applicationId) { |
|
146 |
|
|
147 |
return addUser(userAlias, userType, userDesc, userPassword, userState, applicationId, null); |
|
148 |
} |
|
149 |
|
|
150 |
public int addUser( |
|
151 |
MinimalUserBean user, int appId, char accessType, |
|
152 |
Session txSession, boolean checkPassword) { |
|
165 |
public ReturnBundle addUser( |
|
166 |
MinimalUserBean user, Session txSession, boolean checkPassword) { |
|
153 | 167 |
|
154 | 168 |
return addUser( |
155 | 169 |
user.getUserAlias(), user.getUserType(), user.getDescription(), |
156 |
user.getPcipherText(), user.getPstate(), appId, |
|
157 |
accessType, txSession, checkPassword); |
|
170 |
user.getPcipherText(), user.getPstate(), txSession, checkPassword); |
|
158 | 171 |
} |
159 | 172 |
} |
src/main/java/my/com/upass/services/VerifyStaticPasswordService.java | ||
---|---|---|
140 | 140 |
return ret; |
141 | 141 |
} |
142 | 142 |
// -- migration period checking : START -- |
143 |
if (ret.user.getHashedPassword() == null) { // password null, so the user haven't get migrated. |
|
143 |
Config cfg = Config.getInstance(); |
|
144 |
if ("Y".equals(cfg.get(MinimalConstants.PROP_MIGRATION_PERIOD_FLAG).toString()) |
|
145 |
&& ret.user.getHashedPassword() == null) { // password null, so the user haven't get migrated. |
|
144 | 146 |
|
145 | 147 |
// authenticate to ldap |
146 |
Config cfg = Config.getInstance(); |
|
147 |
if ("Y".equals(cfg.get(MinimalConstants.PROP_MIGRATION_PERIOD_FLAG).toString())) { |
|
148 |
if (!MinimalUPassControllerV2.getMaybankLdapDAO().authenticate(userAlias, password)) { |
|
149 |
ret.code = MinimalConstants.ERR_INVALID_CREDENTIAL; |
|
150 |
return ret; |
|
151 |
} |
|
148 |
if (!MinimalUPassControllerV2.getMaybankLdapDAO().authenticate(userAlias, password)) { |
|
149 |
ret.code = MinimalConstants.ERR_INVALID_CREDENTIAL; |
|
150 |
return ret; |
|
152 | 151 |
} |
153 | 152 |
|
154 | 153 |
// update password to upass |
... | ... | |
236 | 235 |
if (!lrc) { |
237 | 236 |
ret.code = MinimalConstants.ERR_SYSTEM_NOT_READY; |
238 | 237 |
} |
239 |
|
|
238 |
|
|
240 | 239 |
} catch (UPassException e) { |
241 | 240 |
e.printStackTrace(); |
242 | 241 |
ret.code = e.getErrorCode(); |
Also available in: Unified diff