is there a chance to user IdentityManager with an AspNet Core Identity?
I did not find any implementation of IIdentityManagerService for AspNetCoreidentity.
Alternatively, is there any replacement for IdentityManager when using AspnetCore identity?
Thank you.
Yes, you can use IdentityManager to manage your AspNetIdentity users.
There is an implementation in IdentityManager itself called IdentityManager.AspNetIdentity. You may want to read through an article describing your scenario by Scott Hanselman.
What you essentially want to do is whereas you load your IdentityManagerService inheriting from the AspNetIdentityManagerService
public class ApplicationIdentityManagerService : AspNetIdentityManagerService<ApplicationUser, string, IdentityRole, string>
{
public ApplicationIdentityManagerService(ApplicationUserManager userMgr, ApplicationRoleManager roleMgr) : base(userMgr, roleMgr)
{
// Nothing
}
}
You can then plug it in into your factory as such:
app.Map("/users", idm =>
{
var factory = new IdentityManagerServiceFactory();
factory.IdentityManagerService = new Registration<IIdentityManagerService, ApplicationIdentityManagerService>();
factory.Register(new Registration<ApplicationUserManager>());
factory.Register(new Registration<ApplicationUserStore>());
factory.Register(new Registration<ApplicationRoleManager>());
factory.Register(new Registration<ApplicationRoleStore>());
factory.Register(new Registration<ApplicationDbContext>(resolver => new ApplicationDbContext("dbase")));
factory.Register(new Registration<ApplicationDbContext>());
idm.UseIdentityManager(new IdentityManagerOptions {
Factory = factory
});
});
Find a more complete example on the IdentityManager AspNetIdentity GitHub repo.