public AccountController() { IdentityStore = new IdentityStoreManager(new IdentityStoreContext()); AuthenticationManager = new IdentityAuthenticationManager(IdentityStore); Bearer = IdentityConfig.Bearer; ExternalTokenHandler = new ExternalAccessTokenHandler(IdentityConfig.Bearer.AccessTokenHandler); }
public ActionResult Create(Members Member) { IdentityStoreManager.AddIdentityUser(Member.EmailAddress, "Passw0rd123*"); unitOfWork.Members.Add(Member); unitOfWork.SaveChanges(); return(View()); }
public AccountController(IdentityStoreManager identityStore, IdentityAuthenticationManager authenticationManager, OAuthBearerAuthenticationOptions bearer, ISecureDataHandler <ExternalAccessToken> externalTokenHandler) { IdentityStore = identityStore; AuthenticationManager = authenticationManager; Bearer = bearer; ExternalTokenHandler = externalTokenHandler; }
public async static Task <bool> InitAppRoles(IdentityStoreManager identityStore) { if (!(await identityStore.Context.Roles.RoleExists(ADMIN_ROLE))) { await identityStore.Context.Roles.CreateRole(new Role(ADMIN_ROLE)); } if (!(await identityStore.Context.Roles.RoleExists(COMPANY_ROLE))) { await identityStore.Context.Roles.CreateRole(new Role(COMPANY_ROLE)); } await identityStore.Context.SaveChanges(); return(true); }
async public Task <ActionResult> Index() { var result = User.IsInRole("Admin"); var a = new IdentityStoreContext(new SiteCertDbContext()); var identityStore = new IdentityStoreManager(new IdentityStoreContext(new SiteCertDbContext())); var x = await a.Roles.IsUserInRole("Admin", "Admin"); //result = ctx.Roles.IsUserInRole("Admin", "Admin"); return(View()); }
protected void CreateUser_Click(object sender, EventArgs e) { string userName = UserName.Text; try { var store = new IdentityStoreManager(); var storeManager = new IdentityStoreManagerSync(store); var authManager = new IdentityAuthenticationManagerSync(new IdentityAuthenticationManager(store)); User u = new User(userName) { UserName = userName }; if (storeManager.CreateLocalUser(u, Password.Text)) { authManager.SignIn(new HttpContextWrapper(Context), u.Id, isPersistent: false); IdentityConfig.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response); } } catch (IdentityException ex) { ErrorMessage.Text = ex.Message; } }
public AccountController(IdentityStoreManager storeManager, IdentityAuthenticationManager authManager) { IdentityStore = storeManager; AuthenticationManager = authManager; }
public AccountController() { IdentityStore = new IdentityStoreManager(); AuthenticationManager = new IdentityAuthenticationManager(IdentityStore); }
public AccountController() { IdentityStore = new IdentityStoreManager(new IdentityStoreContext(new SiteCertDbContext())); AuthenticationManager = new IdentityAuthenticationManager(IdentityStore); }