public async Task <IActionResult> DevelopmentLogin(DevelopmentLoginModel model) { if (_Configuration.DevelopmentMode == false) { return(NotFound()); } else { var claims = new List <Claim> { new Claim(SecurityConstants.Claim_X_MsClientPrincipalId, Guid.NewGuid().ToString()), new Claim( SecurityConstants.Claim_X_MsClientPrincipalIdp, SecurityConstants.Idp_DevelopmentMode), new Claim(SecurityConstants.Claim_X_MsClientPrincipalName, model.Username) }; var temp = new ClaimsPrincipal(new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme)); await HttpContext.SignInAsync(temp, new AuthenticationProperties { IsPersistent = model.KeepMeLoggedIn, AllowRefresh = true }); return(RedirectToAction("Index", "SecuritySummary")); } }
public async Task <IActionResult> DevelopmentLogin(DevelopmentLoginModel model) { if (_Configuration.IsDevelopmentMode() == false) { return(NotFound()); } else { var claims = new List <Claim> { new Claim(SecurityConstants.Claim_X_MsClientPrincipalId, Guid.NewGuid().ToString()), new Claim(SecurityConstants.Claim_X_MsClientPrincipalIdp, "LocalDev"), new Claim(SecurityConstants.Claim_X_MsClientPrincipalName, model.Username) }; var temp = new ClaimsPrincipal(new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme)); await HttpContext.SignInAsync(temp, new AuthenticationProperties { IsPersistent = model.KeepMeLoggedIn, AllowRefresh = true }); /* * var owinContext = HttpContext.SignInAsync(temp); * * * .Current.GetOwinContext(); * var authmanager = owinContext.Authentication; * var claimsIdentity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie); * authmanager.SignIn(new AuthenticationProperties { IsPersistent = false, AllowRefresh = true }, claimsIdentity); */ return(RedirectToAction("Index", "SecuritySummary")); } }