javalin / javalin-openapi

Annotation processor for compile-time OpenAPI & JsonSchema, with out-of-the-box support for Javalin 5.x, Swagger & ReDoc
https://github.com/javalin/javalin-openapi/wiki
Apache License 2.0
44 stars 17 forks source link

ClientCredentials flowType string with tralling space #200

Closed ysavourel closed 1 year ago

ysavourel commented 1 year ago

I'm having trouble getting the proper behavior when using the ClientCredentials OAuth2 flow: The fields for client ID and client secret do not show up in the Swagger UI. And I noticed that there is a trailing space in the flowType declaration of io.javalin.openapi.ClientCredentials:

class ClientCredentials @JvmOverloads constructor(
    val tokenUrl: String,
    override val scopes: MutableMap<String, String> = mutableMapOf()
) : OAuth2Flow<ClientCredentials> {
    override val flowType: String = "clientCredentials " <--- EXTRA SPACE HERE
}

It looks strange to me, and I wonder if it's the cause of my problem.

I'd love to try to fix it by creating an extended ClientCredentials class in Java where i would override the string, but ClientCredentials is final. Is there any way around this? (I'm using 5.5.0-1, but 5.6.0 has the same issue).

Thanks -yves

dzikoysk commented 1 year ago

The empty space is definitely a bug. Do you use the new cfg api, or the deprecated one?

ysavourel commented 1 year ago

The deprecated one.

dzikoysk commented 1 year ago

Could you try with 5.6.2-2?

ysavourel commented 1 year ago

Works with 5.5.2-2 : Now i get the expected Swagger popup with the expected input fields.

Thanks!

From: dzikoysk @.> Sent: Thursday, August 31, 2023 4:50 PM To: javalin/javalin-openapi @.> Cc: ysavourel @.>; Author @.> Subject: Re: [javalin/javalin-openapi] ClientCredentials flowType string with tralling space (Issue #200)

Could you try with 5.6.2-2

— Reply to this email directly, view it on GitHub https://github.com/javalin/javalin-openapi/issues/200#issuecomment-1701197280 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AALBSQG6WBONJPAL4F2Y72LXYCQC5ANCNFSM6AAAAAA4EZBNL4 . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AALBSQHWB3H7CV42QQVULC3XYCQC5A5CNFSM6AAAAAA4EZBNL6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTFMY26A.gif Message ID: @. @.> >