You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/05/24 19:08:08 UTC
[2/3] syncope git commit: [SYNCOPE-671] Fix provided
[SYNCOPE-671] Fix provided
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4c90ea87
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4c90ea87
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4c90ea87
Branch: refs/heads/master
Commit: 4c90ea872d43831e4ee593cb7b39306232b477cf
Parents: 15cca15
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sun May 24 18:27:31 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sun May 24 18:27:31 2015 +0200
----------------------------------------------------------------------
.../core/rest/controller/UserController.java | 10 +++++++++-
.../syncope/core/rest/UserSelfTestITCase.java | 17 ++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4c90ea87/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java b/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
index f989f4d..dc5fdd2 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
@@ -20,6 +20,7 @@ package org.apache.syncope.core.rest.controller;
import java.lang.reflect.Method;
import java.security.AccessControlException;
+import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -401,7 +402,14 @@ public class UserController extends AbstractSubjectController<UserTO, UserMod> {
uwfAdapter.confirmPasswordReset(user.getId(), token, password);
- List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(user, null, null);
+ UserMod userMod = new UserMod();
+ userMod.setId(user.getId());
+ userMod.setPassword(password);
+
+ List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
+ new WorkflowResult<Map.Entry<UserMod, Boolean>>(
+ new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, null), null, "confirmPasswordReset"),
+ true, null);
PropagationReporter propReporter =
ApplicationContextProvider.getApplicationContext().getBean(PropagationReporter.class);
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/4c90ea87/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
index aaf5347..57a7a6e 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/UserSelfTestITCase.java
@@ -20,6 +20,7 @@ package org.apache.syncope.core.rest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -53,6 +54,7 @@ import org.junit.Assume;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
+import org.springframework.jdbc.core.JdbcTemplate;
@FixMethodOrder(MethodSorters.JVM)
public class UserSelfTestITCase extends AbstractTest {
@@ -93,7 +95,7 @@ public class UserSelfTestITCase extends AbstractTest {
membership.setRoleId(3L);
userTO.getMemberships().add(membership);
userTO.getResources().add(RESOURCE_NAME_TESTDB);
-
+
SyncopeClient anonClient = clientFactory.createAnonymous();
userTO = anonClient.getService(UserSelfService.class).
create(userTO, true).
@@ -256,8 +258,15 @@ public class UserSelfTestITCase extends AbstractTest {
UserTO user = UserTestITCase.getUniqueSampleTO("pwdReset@syncope.apache.org");
user.setSecurityQuestion(1L);
user.setSecurityAnswer("Rossi");
+ user.getResources().add(RESOURCE_NAME_TESTDB);
createUser(user);
+ // verify propagation (including password) on external db
+ JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
+ String pwdOnResource = jdbcTemplate.queryForObject("SELECT password FROM test WHERE id=?", String.class,
+ user.getUsername());
+ assertTrue(StringUtils.isNotBlank(pwdOnResource));
+
// 2. verify that new user is able to authenticate
SyncopeClient authClient = clientFactory.create(user.getUsername(), "password123");
UserTO read = authClient.getService(UserSelfService.class).read();
@@ -292,6 +301,12 @@ public class UserSelfTestITCase extends AbstractTest {
read = authClient.getService(UserSelfService.class).read();
assertNotNull(read);
assertNull(read.getToken());
+
+ // 7. verify that password was changed on external resource
+ String newPwdOnResource = jdbcTemplate.queryForObject("SELECT password FROM test WHERE id=?", String.class,
+ user.getUsername());
+ assertTrue(StringUtils.isNotBlank(newPwdOnResource));
+ assertNotEquals(pwdOnResource, newPwdOnResource);
}
@Test