Can we have a feature for deleting user claims when we delete users using the default identity in blazor .net 8?
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 276
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
We have a [forum question](https://learn.microsoft.com/en-us/answers/questions/1494456/asp-net-identity-library-delete-user-does-not-dele) here.
I created a blazor web app SSR(.net 8) using the VS 2022 template choosing the Individual Account. Then I found that we have an out-of-box feature which allowing us to delete the user.

Referring to the code we could see that the "delete" feature only delete the user from User table: **var result = await UserManager.DeleteAsync(user);**, but not deleting user related information such as User Claims at the same time.
### Describe the solution you'd like
I'm afraid we could have a feature that allows us to choose to delete all the user-related rows stored in table if possible. For example, click an checkbox so that we could choose to delete user claims of this user at the same time.
In the meantime, I found that in .net7 when I delete the user, the user claims are deleted at the same time.
### Additional context
now I'm writing code to manually list and delete the user related claims before deleting user.
var claims = await UserManager.GetClaimsAsync(user);
var res = await UserManager.RemoveClaimsAsync(user, claims);
var result = await UserManager.DeleteAsync(user);
Contributor guide
Research direction
Start with the Blazor SSR .NET 8 Individual Account delete flow and the UserManager.DeleteAsync(user) call described in the issue. Compare its behavior with .NET 7 and determine how user claims should be removed, including whether deletion should be configurable; done means the selected user-related claims are removed with the user while existing deletion behavior remains clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- authentication, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100