How to secure generated API documentation using swagger swashbuckle
I don't think there's a way to secure the swagger swashbuckle endpoint up until now. You can have tips and more into this from their github issue here
This solution will only work if you have implemented authentication in your solution.
- Create new folder swagger in solution
- Add new Web.config file.
write following code in it:
<configuration> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>