dotnet / dotnet/aspnetcore

Expose private UpdatePasswordHash with IUserPasswordStore overload to derived classes

Open
#12,344 5 comments 10 reactions 0 assignees View on GitHub
affected-few area-identity enhancement severity-minor triaged
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is your feature request related to a problem? Please describe.

Content...

- I have a derived class of UserManager.
- I have an alternative implementation of PasswordHasher that requires an Async call ( Argon2 ).
- I also have additional processes I need to perform between when a password is hashed and the user is updated.

Unfortunately the placed where both of these processes are performed is in the **private** overload of UpdatePasswordHash that has the IUserPasswordStore parameter.

To resolve my issue I have to replace all 6 methods that hash passwords that, with the exception of UpdatePasswordHash, are identical to the implementation in the UserManager.
- AddPasswordAsync
- ChangePasswordAsync
- CheckPasswordAsync (ReHash flow)
- CreatePasswordAsync
- RemovePasswordAsync

The original hashing method also calls another private method **UpdateSecurityStampInternal** that I need to also call.

Incidently GenerateNewAuthenticatorKey is virtual, but UpdateSecurityStampInternal directly uses the it's default target of NewSecurityStamp. What's the point of making it virtual if UpdateSecurityStampInternal doesn't use it.

### Describe the solution you'd like
Make the private UpdatePasswordHash with IUserPasswordStore overload **protected**
Make the private UpdateSecurityStampInternal method **protected**

### Additional context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.