You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by co...@apache.org on 2012/04/16 17:11:00 UTC
svn commit: r1326644 - in /incubator/syncope/trunk/core/src:
main/java/org/syncope/core/rest/controller/
main/java/org/syncope/core/rest/data/ test/java/org/syncope/core/rest/
Author: coheigea
Date: Mon Apr 16 15:10:59 2012
New Revision: 1326644
URL: http://svn.apache.org/viewvc?rev=1326644&view=rev
Log:
Change the verifyPassword method of the UserController to take a username instead of userId
Modified:
incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/UserController.java
incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserDataBinder.java
incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserRequestTestITCase.java
incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserTestITCase.java
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/UserController.java?rev=1326644&r1=1326643&r2=1326644&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/UserController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/UserController.java Mon Apr 16 15:10:59 2012
@@ -109,15 +109,15 @@ public class UserController {
private ConnObjectUtil connObjectUtil;
@PreAuthorize("hasRole('USER_READ')")
- @RequestMapping(method = RequestMethod.GET, value = "/verifyPassword/{userId}")
+ @RequestMapping(method = RequestMethod.GET, value = "/verifyPassword/{username}")
@Transactional(readOnly = true)
- public ModelAndView verifyPassword(@PathVariable("userId") Long userId,
+ public ModelAndView verifyPassword(@PathVariable("username") String username,
@RequestParam("password") final String password) throws NotFoundException, UnauthorizedRoleException {
auditManager.audit(Category.user, UserSubCategory.create, Result.success,
- "Verified password for: " + userId);
+ "Verified password for: " + username);
- return new ModelAndView().addObject(userDataBinder.verifyPassword(userId, password));
+ return new ModelAndView().addObject(userDataBinder.verifyPassword(username, password));
}
@PreAuthorize("hasRole('USER_LIST')")
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserDataBinder.java?rev=1326644&r1=1326643&r2=1326644&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserDataBinder.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/UserDataBinder.java Mon Apr 16 15:10:59 2012
@@ -92,10 +92,10 @@ public class UserDataBinder extends Abst
}
@Transactional(readOnly = true)
- public boolean verifyPassword(final Long userId, final String password)
+ public boolean verifyPassword(final String username, final String password)
throws NotFoundException, UnauthorizedRoleException {
- SyncopeUser user = getUserFromId(userId);
+ SyncopeUser user = getUserFromUsername(username);
SyncopeUser passwordUser = new SyncopeUser();
passwordUser.setPassword(password, user.getCipherAlgoritm(), 0);
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserRequestTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserRequestTestITCase.java?rev=1326644&r1=1326643&r2=1326644&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserRequestTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserRequestTestITCase.java Mon Apr 16 15:10:59 2012
@@ -159,8 +159,8 @@ public class UserRequestTestITCase exten
super.setupRestTemplate();
// 7. user password has not changed yet
- Boolean verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{userId}?password="
- + userMod.getPassword(), Boolean.class, userTO.getId());
+ Boolean verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{username}.json?password="
+ + userMod.getPassword(), Boolean.class, userTO.getUsername());
assertFalse(verify);
// 8. actually update user
@@ -168,8 +168,8 @@ public class UserRequestTestITCase exten
assertNotNull(userTO);
// 9. user password has now changed
- verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{userId}?password=" + userMod.getPassword(),
- Boolean.class, userTO.getId());
+ verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{username}.json?password=" + userMod.getPassword(),
+ Boolean.class, userTO.getUsername());
assertTrue(verify);
}
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserTestITCase.java?rev=1326644&r1=1326643&r2=1326644&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/UserTestITCase.java Mon Apr 16 15:10:59 2012
@@ -522,12 +522,12 @@ public class UserTestITCase extends Abst
assertEquals(maxTaskExecutions, taskTO.getExecutions().size());
// 3. verify password
- Boolean verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{userId}?password=password123",
- Boolean.class, newUserTO.getId());
+ Boolean verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{username}.json?password=password123",
+ Boolean.class, newUserTO.getUsername());
assertTrue(verify);
- verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{userId}?password=passwordXX",
- Boolean.class, newUserTO.getId());
+ verify = restTemplate.getForObject(BASE_URL + "user/verifyPassword/{username}.json?password=passwordXX",
+ Boolean.class, newUserTO.getUsername());
assertFalse(verify);
// 4. try (and fail) to create another user with same (unique) values