I have added Swagger and Swashbuckle generator to my site following this tutorial. Now, when navigating to https://localhost:port/swagger/
I can see the generated API documentation. Note, that I have not created any SwaggerController
class - this is all handled by the NuGet package.
The problem is, my whole site, even the API, is authenticated using custom LDAP. I would like to protect the /swagger/
page as well. However, I did not find a way how to do that. The only related question on StackOverflow describes adding authentication INTO swagger requests - not authenticating the whole API documentation page.
Is there a specific way how to protect the generated /swagger/
page? Or, is there a general way of adding authentication validators to ASP.NET Core 2.0 MVC routes?