Saves a new hash of a user's password when the login code re-hashes it.
Password hashing settings get stronger over time. At a successful login
the typed password is known, so DaoAuthenticationProvider can hash it
again with today's settings when the stored hash is older (another
{id} or weaker parameters) and hand the new hash to this service to
store. Implement it on your user store to keep hashes up to date
without asking users to change their passwords. Without it, old hashes
keep working and are never upgraded.
@Service()
class AccountUsers
implements UserDetailsService, UserDetailsPasswordService {
...
@override
Future<UserDetails> updatePassword(
UserDetails user,
String newPassword,
) async {
await accounts.setPasswordHash(user.username, newPassword);
return User.withUserDetails(user).password(newPassword).build();
}
}
Spring (Java): UserDetailsPasswordService.
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updatePassword(
UserDetails user, String newPassword) → FutureOr< UserDetails> -
Stores
newPassword, already encoded, foruserand returns the user with the new password; the returned user becomes the principal of the login.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited