Reputation: 323
I build a solution with some c# library for
There are also 2 main project :
My problem: I need to manage users and roles in Admin App with UserManager/RoleManager (_Dati.Accesso.Identity library) but i haven't any OwinContext on current request because on admin app i don't create any owin pipeline in startup/configAuth methods.
What is the best way to solve the problem? I'm not very well versed with issues affecting auth logic. Is there a way to create an on-demand OWINcontext and create with it user/role manager? Or the solution is create a startup/configAuth method on Admin app too? ... or something else :)
Thanks for your time.
Upvotes: 1
Views: 878
Reputation: 4280
You don't have to have Owin context to manage accounts.
This should work:
var dbContext=new ApplicationDbContext();// This is your IdentityDbContext
var userManager=new ApplicationUserManager(new UserStore<ApplicationUser>(dbContext));
You will need a reference to your original project to have access to the ApplicationDbContext class, and you will need to configure the connection string properly so that your dbContext can connect to the database.
Upvotes: 1