Hello,
I googled thoroughly but there is hundred examples from ASP.NET but nothing about ASP.NET Core.
In order to getting password reset work I need to registe
You have to dig deep into the .NET Core code and find what internals the AddIdentity
is doing.
What I found was the following that worked for us as we could not use .AddIdentity()
as it overrode the IdentityServer4 middleware.
Instead, we added transients for the all the interfaces needed for UserManager and then used IdentityBuilder class to add the token provider.
NOTE The User class below inherits from IdentityUser
as we needed to customize our user table.
// add User Manager related objects into DI configuration
services.AddTransient, UserStore, ApplicationDbContext>>();
services.AddTransient>, RoleStore, ApplicationDbContext>>();
services.AddTransient, PasswordHasher>();
services.AddTransient();
services.AddTransient();
var identityBuilder = new IdentityBuilder(typeof(User), typeof(IdentityRole), services);
identityBuilder.AddTokenProvider("Default", typeof(DataProtectorTokenProvider));
services.AddTransient>();