OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.96k stars 6.59k forks source link

[REQ] [aspnetcore] Secure the swagger documentation #3487

Open Doxoh opened 5 years ago

Doxoh commented 5 years ago

Is your feature request related to a problem? Please describe.

As an optional to set a middleware to secure the swagger documentation with basic authentication

Describe the solution you'd like

I created locally the middleware and would be implement it into this project.

Describe alternatives you've considered

-

Additional context

-

macjohnny commented 5 years ago

@Doxoh can you please explain your feature request in more detail?

Doxoh commented 5 years ago

@macjohnny yeah, I think its better to have the option to secure the swagger documentation under "/swagger". At my local branch I created this option. The endpoint "/swagger" is secured with basic authentication and the credentials will be set at the appsettings.json.

InfoSec812 commented 4 years ago

@Doxoh I believe that's always going to be a choice for individuals and I do not believe it makes sense to add that functionality to the generator. For example, companies which publish a public API probably do not want their SwaggerUI secured. Also, as you have probably already discovered, it is trivial to add this after the code generation.

@macjohnny I'm not sure this makes sense as part of the project, is there a set of design goals where the intent of what should be in the generators is made clear?

macjohnny commented 4 years ago

I don‘t understand the relation to the openapi-generator