Burgyn / MMLib.SwaggerForOcelot

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

Added an option to skip ssl validation #228

Closed tomer-cohen closed 2 years ago

tomer-cohen commented 2 years ago

As mentioned in this issue: https://github.com/Burgyn/MMLib.SwaggerForOcelot/issues/82

This check for the DangerousAcceptAnyServerCertificateValidator flag in the route settings, if it's set to true - the ssl certificate validation will be skipped when trying to retrieve swagger.json.

update-docs[bot] commented 2 years ago

Thanks for opening this pull request! If you have implemented new functions, write about them in the readme file.

Burgyn commented 2 years ago

Hi, thanks. This will be released as version 5.1.0 in a few minutes.

AndryKwiatow commented 2 years ago

Hey guys, I saw this and was wondering: is this intended to be used this way? (See example below)

"Config": [
        {
          "DangerousAcceptAnyServerCertificateValidator": true,
          "Name": "Shipping API",
          "Version": "v1",
          "Url": "https://localhost:7020/swagger/v1/swagger.json"
        }
      ]
Burgyn commented 2 years ago

Hi @AndryKwiatow,

No. Property DangerousAcceptAnyServerCertificateValidator should be set in the route configuration. E.g.:

 "Routes": [
   {
     "DownstreamPathTemplate": "/api/{everything}",
     "DownstreamHostAndPorts": [
       {
          "Host": "localhost",
          "Port": 5100
       }
     ],
     "UpstreamPathTemplate": "/api/contacts/{everything}",
     "SwaggerKey": "contacts",
     "DangerousAcceptAnyServerCertificateValidator": true
   }
]