Given an ActionDescriptor, for example the ActionDescriptor of the action located at GET /api/Item/{id}, how do I tell if it requires authentication or not?
Checking if filters of the method corresponding to the action, and possibly the filters of the class that declares the method are AuthorizeAttribute or AllowAnonymousAttribute is not reliable because in this way the policies of AuthorizationOptions (FallbackPolicy, DefaultPolicy and the policies added with AddPolicy()) would not be taken into consideration, for example.
I tried to check if the following interfaces had a method that accepts an ActionDescriptor, but unfortunately none of them have it:
IAuthorizationPolicyProviderIAuthorizationServiceIAuthorizationHandlerIAuthorizationHandlerContextFactoryIAuthorizationHandlerProvider
EDIT: after searching a bit, I think what I need existed in WebForms: UrlAuthorizationModule.CheckUrlAccessForPrincipal(). I wonder if there is something similar for ASP.NET Core.