I noticed following code in Md4PasswordEncoder in Spring Security:
/**
* Takes a previously encoded password and compares it with a raw password after mixing in the salt and
* encoding that value.
*
* @param encPass previously encoded password
* @param rawPass plain text password
* @param salt salt to mix into password
* @return true or false
*/
public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
String pass1 = "" + encPass;
String pass2 = encodePassword(rawPass, salt);
return PasswordEncoderUtils.equals(pass1,pass2);
}
I'm currently working on developing custom PasswordEncoder. Could please anyone explain why are spring developers handling null by adding an empty string to the passed in object?
Thanks in advance