Grails update embedded object but no encoding password using spring security

160 views Asked by At

I'm trying to update an embedded object but when the object is updated, the password user is encoded again.

I would like to update the Card object into User class. The UserService should only update the card object but it's updating the password object.

UserPasswordEncoderListener is default from grails spring security core plugin.

Using:

  • grailsVersion=3.3.8
  • grailsWrapperVersion=1.0.0
  • gormVersion=6.1.10.RELEASE
  • gradleWrapperVersion=3.5
  • mongodb:6.1.6

Any idea? or what I'm doing wrong? What is the best way to handle the embedded object?

github bug

User class

enter image description here

Customer class

enter image description here

Card class

enter image description here

UserService class

enter image description here

UserPasswordEncoderListener

enter image description here

1

There are 1 answers

0
injecteer On

Looks like the password is also updated somewhere, so u.isDirty( 'password' ) in UserPasswordEncoderListener returns true.

You should be able to suppress password update by setting it to null.