using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.DependencyInjection; namespace TurnstileTag; /// /// Specifies that the class or method that this attribute is applied validates the turnstile response. /// If the turnstile response is not available or invalid, the validation will fail /// and the action method will not execute. /// /// /// This attribute helps defend against bots and non-human requests. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class ValidateTurnstileAttribute : Attribute, IFilterFactory, IOrderedFilter { /// public int Order { get; set; } = 1100; /// public bool IsReusable => true; /// public IFilterMetadata CreateInstance(IServiceProvider serviceProvider) { return serviceProvider.GetRequiredService(); } }