Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Added SignMeIn
public async Task<IActionResult> SignMeIn()
// Just do a real basic login.
var claims = new List<Claim>
new Claim(ClaimTypes.Name, "ajevans"),
new Claim("FullName", "Alistair Evans"),
new Claim(ClaimTypes.Role, "Administrator"),
var claimsIdentity = new ClaimsIdentity(claims, "AuthCookie");
await HttpContext.SignInAsync(
new ClaimsPrincipal(claimsIdentity));
Logger.LogInformation("Signed in {user}", claimsIdentity.Name);
return RedirectToAction(nameof(Index));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment