In ASP.Net Core I know how to add the AuthorizeFilter
to all routes programmatically, like this..
services.AddMvc(options =>
{
options.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()));
})
However, I would like to only select certain paths to do this to. How can I do this? I just need a way to enforce authentication at startup to select paths, without having to decorate every route manually with the attribute. Thank you.