Revision 32:e71d877fb463

View differences:

src/main/java/my/com/upass/MinimalUPassControllerV2.java
151 151
		}
152 152
		int rc;
153 153
		try {
154
			Integer appId = checkAppAccess(appAccessId, hashedSecretKey);
154
			Integer appId = checkAppAccess(appAccessId, hashedSecretKey, txSession);
155 155

  
156 156
			if (appId == null)
157 157
				rc = MinimalConstants.ERR_APP_SERV_NOT_PERMITTED;
......
201 201

  
202 202
		int rc;
203 203
		try {
204
			checkAppAccessToUser(appAccessId, hashedSecretKey, username);
204
			checkAppAccessToUser(appAccessId, hashedSecretKey, username, null);
205 205
			rc = verifyStaticPasswordService.verifyStaticPassword(
206 206
					username, hashedPassword, false, 0);
207 207

  
......
281 281

  
282 282
		int rc;
283 283
		try {
284
			Integer appId = checkAppAccess(appAccessId, hashedSecretKey);
284
			Integer appId = checkAppAccess(appAccessId, hashedSecretKey, txSession);
285 285

  
286 286
			final Object appIdObj = AppAccessMgtService.profileToAppMap.get(profile.getClass());
287 287
			final int appIdForProfile = ((Integer) appIdObj).intValue();
......
332 332

  
333 333
		int rc;
334 334
		try {
335
			checkAppAccessToUser(appAccessId, hashedSecretKey, username);
335
			checkAppAccessToUser(appAccessId, hashedSecretKey, username, null);
336 336
			rc = changeStaticPasswordService.changeStaticPassword(
337 337
					username, newHashedPassword, oldHashedPassword, true);
338 338

  
......
354 354

  
355 355
		int rc;
356 356
		try {
357
			checkAppAccessToUser(appAccessId, hashedSecretKey, username);
357
			checkAppAccessToUser(appAccessId, hashedSecretKey, username, null);
358 358
			rc = modifyUserService.modifyUser(
359 359
					username, MinimalConstants.UTYPE_STATE_USER, "",
360 360
					newHashedPassword, MinimalConstants.UID_STATE_ACTIVE);
......
373 373

  
374 374
	// Helper methods
375 375

  
376
	protected Integer checkAppAccessToUser(String appAccessId, String hashedSecretKey, String username)
376
	protected Integer checkAppAccessToUser(
377
			String appAccessId, String hashedSecretKey, String username, final Session txSession)
377 378
			throws MultipleAppAccessesFound, UPassException {
378 379

  
379
		Integer appId = checkAppAccess(appAccessId, hashedSecretKey);
380
		Integer appId = checkAppAccess(appAccessId, hashedSecretKey, txSession);
380 381

  
381
		List appIdsForUser = appAccessMgtService.listAppIdsForUser(username, null);
382
		List appIdsForUser = appAccessMgtService.listAppIdsForUser(username, txSession);
382 383
		int rc = appIdsForUser.contains(appId) ?
383 384
				MinimalConstants.ERR_SUCCESS
384 385
				: MinimalConstants.ERR_APP_SERV_NOT_PERMITTED;
......
389 390
		return appId;
390 391
	}
391 392

  
392
	protected Integer checkAppAccess(String appAccessId, String hashedSecretKey)
393
	protected Integer checkAppAccess(
394
			String appAccessId, String hashedSecretKey, final Session txSession)
393 395
			throws UPassException, MultipleAppAccessesFound {
394 396

  
395 397
		int rc = verifyStaticPasswordService.verifyStaticPassword(
396 398
				appAccessId, hashedSecretKey, true,
397
				MinimalConstants.UTYPE_STATE_USER);
399
				MinimalConstants.UTYPE_STATE_USER, txSession);
398 400

  
399 401
		if (rc != MinimalConstants.ERR_SUCCESS)
400 402
			throw new UPassException(rc);
401 403

  
402
		Integer appId = appAccessMgtService.getAppIdForAdmin(appAccessId, null);
404
		Integer appId = appAccessMgtService.getAppIdForAdmin(appAccessId, txSession);
403 405
		return appId;
404 406
	}
405 407
}
src/main/java/my/com/upass/maybank/MinimalMaybankFacadeImpl.java
2 2

  
3 3
import my.com.upass.MinimalConstants;
4 4
import my.com.upass.MinimalUPassControllerV2;
5
import my.com.upass.maybank.entities.IbccUser;
6 5
import my.com.upass.maybank.entities.M2uUser;
7 6
import my.com.upass.maybank.entities.UserProfile;
8 7
import my.com.upass.pojo.MinimalUserBean;
9 8
import net.penril.generic.hibernate.GenericDAOHibernate;
10 9
import net.penril.generic.hibernate.HibernateUtils;
11 10

  
12
import org.apache.commons.lang.NotImplementedException;
13 11
import org.apache.log4j.Logger;
14 12
import org.hibernate.Session;
15 13

  
src/main/java/my/com/upass/services/VerifyPasswordComplexityService.java
13 13
		this.upc = upc;
14 14
	}
15 15

  
16
	public int verifyPasswordComplexity(String userPassword, int applicationId) {
16
	public int verifyPasswordComplexity(String userPassword, int appId) {
17 17
		int rc = MinimalConstants.ERR_SYSTEM_NOT_READY;
18 18
		try {
19 19
			MinimalUserBean ub = new MinimalUserBean();
20 20
			PasswordController pc = new PasswordController(ub, upc.getConfigurationsMap());
21
			ConfigBean configBean = pc.getConfigBean();
21
			ConfigBean configBean = pc.getConfigBean(new Integer(appId));
22 22

  
23 23
			if (pc.patternValidator(userPassword, configBean.getPasswordAcceptPattern())) {
24 24
				rc = MinimalConstants.ERR_SUCCESS;
src/main/java/my/com/upass/spassword/PasswordController.java
49 49
		this.configurationsMap = configurationsMap;
50 50
	}
51 51

  
52
	public ConfigBean getConfigBean()
53
	{
52
	public ConfigBean getConfigBean() {
54 53
		return (ConfigBean) configurationsMap.get(this.userBean.getApplicationId());
55 54
	}
56 55

  
56
	public ConfigBean getConfigBean(Integer appId) {
57

  
58
		return (ConfigBean) configurationsMap.get(appId);
59
	}
60

  
57 61
	public PasswordController() {
58 62
		getSystemProperties();
59 63
	}
......
298 302
			if (!patternValidator(password, getConfigBean().getPasswordAcceptPattern())) {
299 303
				return false;
300 304
			}
301
//			return true;
305
			// return true;
302 306
		}
303 307
		return patternValidator(password, getConfigBean().getPasswordValidPattern());
304 308
	}

Also available in: Unified diff