I have implemented API documentation using swagger swashbukle. Now I want to publish generated documentation as a help file in my website. How to secure this link and publish?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Inside your SwaggerConfig.cs file, un-comment the following pieces of code to satisfy your security needs.
This solution will only work if you have implemented authentication in your solution.
write following code in it:
I figured out the way to do this. Use the latest swashbuckle version and add the below div tag in the injected index.html
<div
id='auth_container'>This will show an Authorize button in the swagger UI which can be used for authentication and once Authenticated, for all the requests to the API, the JWT token will be passed from the swagger UI
Also, follow the below link to protect all the calls for the swagger docs - https://github.com/domaindrivendev/Swashbuckle/issues/601
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