コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }