You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by ernst Developer <er...@gmail.com> on 2012/04/13 13:55:40 UTC
Update of attribute with rest call /rest/user/update also update the password?
Hi,
I have a question about the way the update of a user is implemented.
It looks like that when we use the restful request for updating only one
attribute, we notice that the password is reset is well.
I create a UserMod object that is completely empty except for the user id
and an attribute in the attributesToBeUpdated set.
When I studied the code of syncope core, I thought that this the way it is
implemented in the update method.
Is that true, or am I missing something here?
Hope my question is clear, and hope to get an answer soon.
Regards,
Ernst
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 16/04/2012 15:35, ernst Developer wrote:
> Hi Francesco,
>
> Thanks for the testing. It seems that the problem has its cause in the
> fact that previously a one time password was set in AD. We thought
> that the password was not provisioned but it had nothing to do with
> Syncope.
Don't mind: actual causes can be weird to find when dealing with complex
distributed architectures ;-)
Regards.
--
Francesco Chicchiriccò
Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by ernst Developer <er...@gmail.com>.
Hi Francesco,
Thanks for the testing. It seems that the problem has its cause in the fact
that previously a one time password was set in AD. We thought that the
password was not provisioned but it had nothing to do with Syncope.
Regards,
Ernst
2012/4/16 Francesco Chicchiriccò <il...@apache.org>
> On 14/04/2012 16:42, Francesco Chicchiriccò wrote:
>
> On 13/04/2012 14:23, ernst Developer wrote:
>
> Yes you are right, but I copied from different methods, to make it clear,
> and did do that good enough.
> How does this look?
>
>
> So the correct flow is:
>
>> UserMod userMod = new UserMod();
>> userMod.setId(userId);
>> Set<AttributeMod> attributesToBeUpdated = new
>> HashSet<AttributeMod>();
>> AttributeMod ourProperty = new AttributeMod();
>> ourProperty.setSchema(ourPropertyName);
>> ourProperty.setValuesToBeAdded(Arrays.asList(new
>> String[]{isoDateTime}));
>> attributesToBeUpdated.add(ourProperty);
>> userMod.setAttributesToBeUpdated(attributesToBeUpdated);
>> UserTO modifiedUser = restTemplate.postForObject(url, userMod,
>> UserTO.class);
>>
>>
> Ernst,
> this looks very strange: I cannot think of a "general" reason why this
> password gets modified.
>
> To be sure, I've added the following test case to UserTestITCase.java in
> Syncope core sources, and this run smoothly:
>
>
> Updated code - first version edited with vi on a remote machine, a didn't
> notice some omissions:
>
>
> @Test
> public void updateWithoutPassword() {
> UserTO userTO = getSampleTO(
> "updateWithoutPassword@syncope.apache.org"<up...@syncope.apache.org>
> );
>
> userTO = restTemplate.postForObject(BASE_URL + "user/create",
> userTO, UserTO.class);
> assertNotNull(userTO);
> String encodedPwd = userTO.getPassword();
>
> AttributeMod attributeMod = new AttributeMod();
> attributeMod.setSchema("subscriptionDate");
> attributeMod.addValueToBeAdded("2010-08-18T16:33:12.203+0200");
>
> UserMod userMod = new UserMod();
> userMod.setId(userTO.getId());
> userMod.addAttributeToBeUpdated(attributeMod);
>
>
> userTO = restTemplate.postForObject(BASE_URL + "user/update",
> userMod, UserTO.class);
> assertNotNull(userTO);
> assertEquals(encodedPwd, userTO.getPassword());
> }
>
>
> I'd suggest to check if there is something in your own setup (maybe bound
> with sync / provisioning) or even if some URL / parameter are not correct.
>
>
> Regards.
>
> --
> Francesco Chicchiriccò
>
> Apache Cocoon PMC and Apache Syncope PPMC Memberhttp://people.apache.org/~ilgrosso/
>
>
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 14/04/2012 16:42, Francesco Chicchiriccò wrote:
> On 13/04/2012 14:23, ernst Developer wrote:
>> Yes you are right, but I copied from different methods, to make it
>> clear, and did do that good enough.
>> How does this look?
>>
>>
>> So the correct flow is:
>>
>>> UserMod userMod = new UserMod();
>>> userMod.setId(userId);
>>> Set<AttributeMod> attributesToBeUpdated = new
>>> HashSet<AttributeMod>();
>>> AttributeMod ourProperty = new AttributeMod();
>>> ourProperty.setSchema(ourPropertyName);
>>> ourProperty.setValuesToBeAdded(Arrays.asList(new
>>> String[]{isoDateTime}));
>>> attributesToBeUpdated.add(ourProperty);
>>> userMod.setAttributesToBeUpdated(attributesToBeUpdated);
>>> UserTO modifiedUser =
>>> restTemplate.postForObject(url, userMod, UserTO.class);
>>
>
> Ernst,
> this looks very strange: I cannot think of a "general" reason why this
> password gets modified.
>
> To be sure, I've added the following test case to UserTestITCase.java
> in Syncope core sources, and this run smoothly:
Updated code - first version edited with vi on a remote machine, a
didn't notice some omissions:
@Test
public void updateWithoutPassword() {
UserTO userTO =
getSampleTO("updateWithoutPassword@syncope.apache.org");
userTO = restTemplate.postForObject(BASE_URL + "user/create",
userTO, UserTO.class);
assertNotNull(userTO);
String encodedPwd = userTO.getPassword();
AttributeMod attributeMod = new AttributeMod();
attributeMod.setSchema("subscriptionDate");
attributeMod.addValueToBeAdded("2010-08-18T16:33:12.203+0200");
UserMod userMod = new UserMod();
userMod.setId(userTO.getId());
userMod.addAttributeToBeUpdated(attributeMod);
userTO = restTemplate.postForObject(BASE_URL + "user/update",
userMod, UserTO.class);
assertNotNull(userTO);
assertEquals(encodedPwd, userTO.getPassword());
}
> I'd suggest to check if there is something in your own setup (maybe
> bound with sync / provisioning) or even if some URL / parameter are
> not correct.
Regards.
--
Francesco Chicchiriccò
Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 13/04/2012 14:23, ernst Developer wrote:
> Yes you are right, but I copied from different methods, to make it
> clear, and did do that good enough.
> How does this look?
>
>
> So the correct flow is:
>
>> UserMod userMod = new UserMod();
>> userMod.setId(userId);
>> Set<AttributeMod> attributesToBeUpdated = new
>> HashSet<AttributeMod>();
>> AttributeMod ourProperty = new AttributeMod();
>> ourProperty.setSchema(ourPropertyName);
>> ourProperty.setValuesToBeAdded(Arrays.asList(new
>> String[]{isoDateTime}));
>> attributesToBeUpdated.add(ourProperty);
>> userMod.setAttributesToBeUpdated(attributesToBeUpdated);
>> UserTO modifiedUser =
>> restTemplate.postForObject(url, userMod, UserTO.class);
>
Ernst,
this looks very strange: I cannot think of a "general" reason why this
password gets modified.
To be sure, I've added the following test case to UserTestITCase.java in
Syncope core sources, and this run smoothly:
@Test
public void updateWithoutPassword() {
UserTO userTO =
getSampleTO("updateWithoutPassword@syncope.apache.org");
userTO = restTemplate.postForObject(BASE_URL + "user/create",
userTO, UserTO.class);
assertNotNull(userTO);
String encodedPwd = userTO.getPassword();
AttributeMod attributeMod = new AttributeMod();
attributeMod.setSchema("subscriptionDate");
attributeMod.addValueToBeAdded("2010-08-18T16:33:12.203+0200");
UserMod userMod = new UserMod();
userMod.setId(userTO.getId());
userTO = restTemplate.postForObject(BASE_URL + "user/update",
userMod, UserTO.class);
assertNotNull(userTO);
assertEquals(encodedPwd, userTO.getPassword());
}
I'd suggest to check if there is something in your own setup (maybe
bound with sync / provisioning) or even if some URL / parameter are not
correct.
Regards.
--
Francesco Chicchiriccò
Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by ernst Developer <er...@gmail.com>.
Yes you are right, but I copied from different methods, to make it clear,
and did do that good enough.
How does this look?
So the correct flow is:
> UserMod userMod = new UserMod();
> userMod.setId(userId);
> Set<AttributeMod> attributesToBeUpdated = new
> HashSet<AttributeMod>();
> AttributeMod ourProperty = new AttributeMod();
> ourProperty.setSchema(ourPropertyName);
> ourProperty.setValuesToBeAdded(Arrays.asList(new
> String[]{isoDateTime}));
> attributesToBeUpdated.add(ourProperty);
> userMod.setAttributesToBeUpdated(attributesToBeUpdated);
> UserTO modifiedUser = restTemplate.postForObject(url, userMod,
> UserTO.class);
>
>
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 13/04/2012 14:09, ernst Developer wrote:
> Hi Francesco,
>
> Thanks for the really fast reply.
>
> In the UserMod object, the password property is null. But still the
> password seems to be updated.
>
> Code used:
>
> UserMod userMod = new UserMod();
> userMod.setId(userId);
> Set<AttributeMod> attributesToBeUpdated = new
> HashSet<AttributeMod>();
> AttributeMod ourProperty = new AttributeMod();
> ourProperty.setSchema(SyncopeSchema.securityQuestionsAnswered.name
> <http://SyncopeSchema.securityQuestionsAnswered.name>());
> ourProperty.setValuesToBeAdded(Arrays.asList(new String[]{isoDateTime}));
> attributesToBeUpdated.add(ourProperty);
> userMod.setAttributesToBeUpdated(attributesToBeUpdated);
> this.syncopeClient.update(userMod);
> UserTO modifiedUser = restTemplate.postForObject(url, user,
> UserTO.class);
Shouldn't this be
UserTO modifiedUser = restTemplate.postForObject(url, userMod,
UserTO.class);
?
> That is the code that is executed. Are we doing something wrong? In a
> previous version (0.5) it was working.
> Now with 0.7.1 it does not anymore.
>
> Kind regards,
> Ernst
>
> 2012/4/13 Francesco Chicchiriccò <ilgrosso@apache.org
> <ma...@apache.org>>
>
> On 13/04/2012 13:55, ernst Developer wrote:
>
> Hi,
>
> I have a question about the way the update of a user is
> implemented.
>
> It looks like that when we use the restful request for
> updating only one attribute, we notice that the password is
> reset is well.
> I create a UserMod object that is completely empty except for
> the user id and an attribute in the attributesToBeUpdated set.
>
> When I studied the code of syncope core, I thought that this
> the way it is implemented in the update method.
> Is that true, or am I missing something here?
>
>
> If you don't want the password to be reset, don't set any password
> in the UserMod object.
>
>
> Hope my question is clear, and hope to get an answer soon.
>
>
> Is this fast enough?
>
--
Francesco Chicchiriccò
Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by ernst Developer <er...@gmail.com>.
Hi Francesco,
Thanks for the really fast reply.
In the UserMod object, the password property is null. But still the
password seems to be updated.
Code used:
UserMod userMod = new UserMod();
userMod.setId(userId);
Set<AttributeMod> attributesToBeUpdated = new
HashSet<AttributeMod>();
AttributeMod ourProperty = new AttributeMod();
ourProperty.setSchema(SyncopeSchema.securityQuestionsAnswered.name
());
ourProperty.setValuesToBeAdded(Arrays.asList(new
String[]{isoDateTime}));
attributesToBeUpdated.add(ourProperty);
userMod.setAttributesToBeUpdated(attributesToBeUpdated);
this.syncopeClient.update(userMod);
UserTO modifiedUser = restTemplate.postForObject(url, user,
UserTO.class);
That is the code that is executed. Are we doing something wrong? In a
previous version (0.5) it was working.
Now with 0.7.1 it does not anymore.
Kind regards,
Ernst
2012/4/13 Francesco Chicchiriccò <il...@apache.org>
> On 13/04/2012 13:55, ernst Developer wrote:
>
>> Hi,
>>
>> I have a question about the way the update of a user is implemented.
>>
>> It looks like that when we use the restful request for updating only one
>> attribute, we notice that the password is reset is well.
>> I create a UserMod object that is completely empty except for the user id
>> and an attribute in the attributesToBeUpdated set.
>>
>> When I studied the code of syncope core, I thought that this the way it
>> is implemented in the update method.
>> Is that true, or am I missing something here?
>>
>
> If you don't want the password to be reset, don't set any password in the
> UserMod object.
>
>
> Hope my question is clear, and hope to get an answer soon.
>>
>
> Is this fast enough?
>
> --
> Francesco Chicchiriccò
>
> Apache Cocoon PMC and Apache Syncope PPMC Member
> http://people.apache.org/~**ilgrosso/<http://people.apache.org/~ilgrosso/>
>
>
Re: Update of attribute with rest call /rest/user/update also update
the password?
Posted by Francesco Chicchiriccò <il...@apache.org>.
On 13/04/2012 13:55, ernst Developer wrote:
> Hi,
>
> I have a question about the way the update of a user is implemented.
>
> It looks like that when we use the restful request for updating only
> one attribute, we notice that the password is reset is well.
> I create a UserMod object that is completely empty except for the user
> id and an attribute in the attributesToBeUpdated set.
>
> When I studied the code of syncope core, I thought that this the way
> it is implemented in the update method.
> Is that true, or am I missing something here?
If you don't want the password to be reset, don't set any password in
the UserMod object.
> Hope my question is clear, and hope to get an answer soon.
Is this fast enough?
--
Francesco Chicchiriccò
Apache Cocoon PMC and Apache Syncope PPMC Member
http://people.apache.org/~ilgrosso/