papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
241 stars 42 forks source link

Problem with authentication #107

Closed RamsesGomez closed 2 years ago

RamsesGomez commented 2 years ago

We just recently changed from version 0.2-beta.14 to version 0.2-beta.18 and all the sudden the authentication method stop working.

We are using JWT Token to authenticate, now after updating the Authorization: Bearer is not added and when you click on the lock for the authenticated routes nothing shows in the authentication dialog.

image

Then we tested the different version and something changed from 14 to 15 that broke this for us. Do we need to change anything in the configuration. No error is being logged.

Wicpar commented 2 years ago

it's possible there was a regression

RamsesGomez commented 2 years ago

Any suggestion? An idea of what should we change?

Wicpar commented 2 years ago

do you have an implementation I can test to reproduce ?

RamsesGomez commented 2 years ago

when you said "It's possible there was a regression" what do you really mean by this? We are following the exact same example you have with the exception that we have both unauthorized routes and authorized ones. Maybe that helps. Unfortunately I do not have an implementation for you to test.

Wicpar commented 2 years ago

can you send the openapi.json ? Have you tried the openapi.json on Redoc, it is has a better implementation of the standard. A commit between .14 and .18 changed the definition as it was not coherent with the standard. The regression would be in the library, as a few PRs have been accepted since.

Wicpar commented 2 years ago

@RamsesGomez I just tested the JWT test and it has the authorization as expected... I did update a few libraries though, let me wrap that up so you can try.

Wicpar commented 2 years ago

@RamsesGomez try the latest release and tell me if it works

RamsesGomez commented 2 years ago

@Wicpar Awesome let me try thanks a lot for the swift response

RamsesGomez commented 2 years ago

I tested it but no luck I can see that the new generated json looks like this:

"security": [ { "entries": [ null ], "keys": [ "jwtAuth" ], "size": 1, "values": [ [ "Dummy" ] ] } ],

where as the old one looked like this:

"security": [ { "jwtAuth": [ "Dummy" ] } ],

RamsesGomez commented 2 years ago

You mentioned you have an example that worked is it possible to see that sample?

RamsesGomez commented 2 years ago

Ok We found the problem... we have a custom serialization module to be able to use kotlin serialization, and the SecurityModel now is a Map and that was the problem, all DataModel were being serialized differently but now is all good thanks a lot for the support much appreciated