public async Task InvokeAsync(HttpContext context, RequestDelegate next) { List <Claim> claims = new List <Claim>(); if (_Configuration.IsDevelopmentMode() == true) { if (context.User != null && context.User.Identity != null && context.User.Identity.IsAuthenticated == true) { // copy the existing claims claims.AddRange(context.User.Claims); AddClaim(claims, ClaimTypes.GivenName, "Testy"); AddClaim(claims, ClaimTypes.Surname, "McTestface"); AddClaim(claims, ClaimTypes.Email, "*****@*****.**"); var identity = new ClaimsIdentity(claims); context.User = new System.Security.Claims.ClaimsPrincipal(identity); } } else { AddClaimsFromHeader(context, claims); AddClaimsFromAuthMeService(context, claims); var identity = new ClaimsIdentity(claims); context.User = new System.Security.Claims.ClaimsPrincipal(identity); } await next(context); }
public IActionResult Login() { var model = new SecurityLoginModel(); if (_Configuration.IsDevelopmentMode() == true) { AddLoginTypeKeyValue(model, "Local Development", Url.Action("DevelopmentLogin")); } AddLoginType(model, "Azure Active Directory", "aad"); AddLoginType(model, "Microsoft Account", "microsoftaccount"); AddLoginType(model, "Google", "google"); return(View(model)); }