Burgyn / MMLib.SwaggerForOcelot

This repo contains swagger extension for ocelot.
MIT License
353 stars 94 forks source link

In swagger UI generation enable Authentication #83

Closed Raj1633 closed 4 years ago

Raj1633 commented 4 years ago

Hi,

Please guide how to enable JWT authentication verification in swagger UI while generating using MMLib.SwaggerForOcelot.

Burgyn commented 4 years ago

Hi,

unfortunately this package doesn't support Swagger UI authentification.

The only thing you can use is settings DownstreamSwaggerHeaders. This headers will be send when requesting a swagger endpoint.

 app.UseSwaggerForOcelotUI(Configuration, opt => {
     opts.DownstreamSwaggerHeaders = new[]
    {
        new KeyValuePair<string, string>("Auth-Key", "AuthValue"),
    };
 })

If you need to dynamically forward headers from the original SwaggerUI request, then theoretically you can implement cusom IEnumerable<KeyValuePair<string, string>> which takes the request headers from the current httpContext and set to DownstreamSwaggerHeaders property.

Raj1633 commented 4 years ago

@Burgyn thanks for your response