Burgyn / MMLib.SwaggerForOcelot

This repo contains swagger extension for ocelot.
MIT License
351 stars 93 forks source link

Add security tags to swagger based on AuthenticationOptions from Ocelot #204

Closed bodnarkevin closed 2 years ago

bodnarkevin commented 2 years ago

Hi!

I was wondering whether it would be possiple to add security definitions to the swagger document based on the Ocelot configuration. I had a brief look at the code, and I wanted to get your opinion before I maybe make a pr.

My idea was to, first provide a dictionary in OcelotSwaggerGenOptions, between Ocelot's AuthenticationOptions.AuthenticationProviderKey and Swagger's securitySchemes. Than when rewriting the routes, check wheter any AuthenticationProviderKey was set, if so, add a security definition to the endpoint with the corresponding securityScheme from the provided dictionary. And finally even scopes could be added from the AuthenticationOptions.AllowedScopes property.

Thank You

Burgyn commented 2 years ago

This will be released after few minutes as version 4.6.0