Last active
September 7, 2019 09:39
-
-
Save alistairjevans/65d27bcff1788a6c92cad37dc9311a6b to your computer and use it in GitHub Desktop.
Added SignMeIn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( | |
"AuthCookie", | |
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