public static bool IsValid(this IStudioXAntiForgeryManager manager, HttpRequestHeaders headers) { var cookieTokenValue = GetCookieValue(manager, headers); if (cookieTokenValue.IsNullOrEmpty()) { return(true); } var headerTokenValue = GetHeaderValue(manager, headers); if (headerTokenValue.IsNullOrEmpty()) { return(false); } return(manager.As <IStudioXAntiForgeryValidator>().IsValid(cookieTokenValue, headerTokenValue)); }
public static bool IsValid(this IStudioXAntiForgeryManager manager, HttpContextBase context) { var cookieValue = GetCookieValue(context); if (cookieValue.IsNullOrEmpty()) { return(true); } var formOrHeaderValue = manager.Configuration.GetFormOrHeaderValue(context); if (formOrHeaderValue.IsNullOrEmpty()) { return(false); } return(manager.As <IStudioXAntiForgeryValidator>().IsValid(cookieValue, formOrHeaderValue)); }