public static void SetCookie(this IInfrastructureAntiForgeryManager manager, HttpContextBase context, IIdentity identity = null) { if (identity != null) { context.User = new ClaimsPrincipal(identity); } context.Response.Cookies.Add(new HttpCookie(manager.Configuration.TokenCookieName, manager.GenerateToken())); }
public static void SetCookie(this IInfrastructureAntiForgeryManager manager, HttpResponseHeaders headers) { headers.SetCookie(new Cookie(manager.Configuration.TokenCookieName, manager.GenerateToken())); }