My core 2.0 app is set up with authentication roles, and I have my controller actions set with
[Authorize(Roles="demo_user")]
etc.
Authorization is working just fine, my question is how to lock down content directories and only serve them through a controller action?
Reading some docs, it looks like I need to serve docs based on this article: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files
And I believe the information I'm interested in is this paragraph:
Static file authorization The static file module provides no authorization checks. Any files served by it, including those under wwwroot are publicly available. To serve files based on authorization: Store them outside of wwwroot and any directory accessible to the static file middleware and Serve them through a controller action, returning a FileResult where authorization is applied
Does anyone have examples of storing directories outside of wwwroot and serving them via controller actions?