public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs, string salt)
 {
     this._verbs = new AcceptVerbsAttribute(verbs);
     this._validator = new ValidateAntiForgeryTokenAttribute()
     {
         Salt = salt
     };
 }
 public ValidateAntiForgeryTokenWrapperAttribute(HttpVerbs verbs)
 {
   this._verbs = new AcceptVerbsAttribute(verbs);
   this._validator = new ValidateAntiForgeryTokenAttribute()
   {
     Salt = Consts.AntiForgeryToken
   };
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomValidateAntiForgeryTokenAttribute"/> class.
        /// </summary>
        /// <param name="verbs">The verbs.</param>
        /// <param name="salt">The salt.</param>
        public CustomValidateAntiForgeryTokenAttribute(HttpVerbs verbs, string salt)
        {
            Verbs = verbs;
            Salt = salt;

            AcceptVerbsAttribute = new AcceptVerbsAttribute(Verbs);
            Validator = new ValidateAntiForgeryTokenAttribute
            {
                Salt = Salt
            };
        }
        public override bool IsValidForRequest(ControllerContext cc, MethodInfo mi)
        {
            bool result = true;

            if (AcceptVerbs.HasValue)
                result = new AcceptVerbsAttribute(AcceptVerbs.Value).IsValidForRequest(cc, mi);

            //if (result && EnsureXSRFSafe)
            //{
            //    if (!AcceptVerbs.HasValue || (AcceptVerbs.Value & HttpVerbs.Post) == 0)
            //        throw new ArgumentException("When this.XSRFSafe is true, this.AcceptVerbs must include HttpVerbs.Post");

            //    result = new XSRFSafeAttribute().IsValidForRequest(cc, mi);
            //}

            return result;
        }
 public AntiForgeryTokenFilter(HttpVerbs verbs)
 {
     _verbs = new AcceptVerbsAttribute(verbs);
 }
 public ValidateAntiForgeryTokenOnVerbsAttribute(HttpVerbs verbs)
 {
     _validator = new ValidateAntiForgeryTokenAttribute();
     _verbs = new AcceptVerbsAttribute(verbs);
 }
Esempio n. 7
0
 public PostAttribute()
 {
     verbsAttribute = new AcceptVerbsAttribute(HttpVerbs.Post);
 }
 public AcceptVerbsWithOverride(HttpVerbs verbs)
 {
     _acceptVerbs = new AcceptVerbsAttribute(verbs);
 }
		public RestOperationAttribute(HttpVerbs httpVerb, string url)
		{
			innerAttribute = new AcceptVerbsAttribute(httpVerb);
			Url = url;
		}
 public UnsealedAcceptVerbsAttribute(HttpVerbs verbs)
 {
     _Verbs = new AcceptVerbsAttribute(verbs);
 }