Пример #1
0
 public CodeZeroWebModuleConfiguration(
     ICodeZeroAntiForgeryWebConfiguration antiForgery,
     ICodeZeroWebLocalizationConfiguration localization)
 {
     AntiForgery  = antiForgery;
     Localization = localization;
 }
Пример #2
0
        public static bool ShouldValidate(
            this ICodeZeroAntiForgeryManager manager,
            ICodeZeroAntiForgeryWebConfiguration antiForgeryWebConfiguration,
            MethodInfo methodInfo,
            HttpVerb httpVerb,
            bool defaultValue)
        {
            if (!antiForgeryWebConfiguration.IsEnabled)
            {
                return(false);
            }

            if (methodInfo.IsDefined(typeof(ValidateCodeZeroAntiForgeryTokenAttribute), true))
            {
                return(true);
            }

            if (ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault <DisableCodeZeroAntiForgeryTokenValidationAttribute>(methodInfo) != null)
            {
                return(false);
            }

            if (antiForgeryWebConfiguration.IgnoredHttpVerbs.Contains(httpVerb))
            {
                return(false);
            }

            if (methodInfo.DeclaringType?.IsDefined(typeof(ValidateCodeZeroAntiForgeryTokenAttribute), true) ?? false)
            {
                return(true);
            }

            return(defaultValue);
        }
Пример #3
0
 public CodeZeroAntiForgeryApiFilter(
     ICodeZeroAntiForgeryManager CodeZeroAntiForgeryManager,
     ICodeZeroWebApiConfiguration webApiConfiguration,
     ICodeZeroAntiForgeryWebConfiguration antiForgeryWebConfiguration)
 {
     _CodeZeroAntiForgeryManager  = CodeZeroAntiForgeryManager;
     _webApiConfiguration         = webApiConfiguration;
     _antiForgeryWebConfiguration = antiForgeryWebConfiguration;
     Logger = NullLogger.Instance;
 }
 public CodeZeroAntiForgeryMvcFilter(
     ICodeZeroAntiForgeryManager CodeZeroAntiForgeryManager,
     ICodeZeroMvcConfiguration mvcConfiguration,
     ICodeZeroAntiForgeryWebConfiguration antiForgeryWebConfiguration)
 {
     _CodeZeroAntiForgeryManager  = CodeZeroAntiForgeryManager;
     _mvcConfiguration            = mvcConfiguration;
     _antiForgeryWebConfiguration = antiForgeryWebConfiguration;
     Logger = NullLogger.Instance;
 }