Hello,
My team and I are attempting to use HIbernate to persist user objects. The user password is stored as a hash in MySQL, and is hashed with MySQL's password() function.
When a user changes password, there are several ways to get the right thing to happen:
1 - Store the plaintext password in the DTO, have the service hash the password, replace the freetext with the hash, and persist the DTO.
2 - Same as #1 but have both "password" and "password hash" fields. The former is null on read, full on write.
3 - Have the client call a Java version of password() on the password, setting the DTO field to the resulting hash. Because there is no good java impl of MySQL's password() function.
Which is best? Is there another way? We're using Tomcat but not any of it's authentication.
|