If I have [Authorize] turned on for all controllers and methods via configuration and have a custom middleware that I have up and running as well.
What I would like, is to make a particular middleware run conditionally based on whether the method that is to be run is marked [AllowAnonymous]. If the method is marked [AllowAnonymous], I do NOT want to run the middleware.
It looks like UseWhen might be the answer but I can't seem to figure out how to make it work.
Any help is appreciated.