I have been tasked with making sure that users cannot use previous passwords when changing their password. To that end I store the Hash of their password when the Identity framework hashes the password.
My question is how to compare the hash of the users newly selected password and the hash of their previously used password that I have saved? I need to take into account the salt that the Identity framework is using.
UPDATE: I am using appUserManager.PasswordHasher.HashPassword(passwordToHash) to hash the password but it creates a new hash each time (I assume it is because Identity framework is using a salt internally).
UserManager<TUser, TKey>.UpdateAsync(TUser user)and use a back-end history table. If a user is changing their password and it's one of the N passwords in the history, reject them withIdentityResult.Failed("Cannot reuse password."). - Brad ChristieappUserManager.PasswordHasher.HashPassword(passwordToHash). I get a different hash result every time. - webworm