Identity: `IdentityOptions` should be inside an `IOptionsSnapshot`
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
If the user changes at runtime the `IdentityOptions` the changes are not reflected.
### Expected Behavior
Changed `IdentityOptions` should be reflected.
### Steps To Reproduce
1. Create a simple project `dotnet new mvc --auth Individual`.
2. At `Program.cs`
```cs
builder.Services.AddOptions().BindConfiguration("Identity");
```
2. Create a User
3. Change the `PasswordOptions`. at `appsettings.json` or another configuration source.
4. Try to create another User with the changed options, they are not reflected until another restart.
### Exceptions (if any)
_No response_
### .NET Version
8.0.204
### Anything else?
The cause is this constructor, it should be `IOptionsSnapshot`
https://github.com/dotnet/aspnetcore/blob/b83e1e159ef1bdfe638e36c8b00bc65ed2d1d857/src/Identity/Extensions.Core/src/UserManager.cs#L70
Contributor guide
Assessment
This issue has not been assessed yet.