public void ConfigureIdentityManager(IAppBuilder app) { app.Map("/idm", idm => { var db = new ApplicationDbContext(); var userMgr = new ApplicationUserManager(new UserStore <ApplicationUser>(db)); var roleMgr = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(db)); var svc = new AspNetIdentityManagerService <ApplicationUser, string, IdentityRole, string>(userMgr, roleMgr); var options = new IdentityManagerOptions() { Factory = { IdentityManagerService = new Registration <IIdentityManagerService>(svc) }, DisableUserInterface = false, SecurityConfiguration = new HostSecurityConfiguration() { HostAuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, RequireSsl = !GlobalSettings.IsDevelopment, AdminRoleName = Constants.Roles.Administrator, RoleClaimType = ClaimTypes.Role } }; idm.UseIdentityManager(options); }); }
public IIdentityManagerService Create() { var db = new ApplicationDbContext(); var userStore = new UserStore <ApplicationUser>(db); var userMgr = new UserManager <ApplicationUser>(userStore); var roleStore = new RoleStore <ApplicationRole>(db); var roleMgr = new RoleManager <ApplicationRole>(roleStore); var svc = new AspNetIdentityManagerService <ApplicationUser, string, ApplicationRole, string>(userMgr, roleMgr); return(new DisposableIdentityManagerService(svc, db)); }
private IIdentityManagerService Create() { var context = new IdentityDbContext( @"Data Source=.\SQLEXPRESS;Initial Catalog=AspIdentity;Integrated Security=true"); var userStore = new UserStore <IdentityUser>(context); var userManager = new UserManager <IdentityUser>(userStore); var roleStore = new RoleStore <IdentityRole>(context); var roleManager = new RoleManager <IdentityRole>(roleStore); var managerService = new AspNetIdentityManagerService <IdentityUser, string, IdentityRole, string>(userManager, roleManager); return(managerService); }