public static void SetCookie(this ICodeZeroAntiForgeryManager manager, HttpContext context, IIdentity identity = null)
        {
            if (identity != null)
            {
                context.User = new ClaimsPrincipal(identity);
            }

            context.Response.Cookies.Append(manager.Configuration.TokenCookieName, manager.GenerateToken());
        }
Esempio n. 2
0
 public static void SetCookie(this ICodeZeroAntiForgeryManager manager, HttpResponseHeaders headers)
 {
     headers.SetCookie(new Cookie(manager.Configuration.TokenCookieName, manager.GenerateToken()));
 }