SMILEY4 / ktor-swagger-ui

Kotlin Ktor plugin to generate OpenAPI and provide Swagger UI
Apache License 2.0
182 stars 33 forks source link

Structural error at components.securitySchemes #78

Closed douglasqueirozalmeida closed 11 months ago

douglasqueirozalmeida commented 11 months ago

I don't know if the documentation is out of date or if it really is a problem.

securityScheme(JWT_SECURITY) {
                type = AuthType.HTTP
                scheme = AuthScheme.BEARER
                bearerFormat = "jwt"
}

JSON

"jwtSecurity" : {
        "type" : "http",
        "scheme" : "Bearer",
        "bearerFormat" : "jwt"
      }

Swagger Validate

Structural error at components.securitySchemes.MyJwtAuth
should NOT have a `bearerFormat` property without `scheme: bearer` being set

The problem is because the word Bearer has the first letter capitalized. It needs to be all in lowercase letters. bearer

douglasqueirozalmeida commented 11 months ago

@SMILEY4 can you help?

SMILEY4 commented 11 months ago

Hi, i can change it to lowercase bearer. Though i am not quite sure why the validator reports this as an error. According to https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml Bearer should be a valid name.

FoorFoxGeek commented 2 months ago

I would like this to be changed back to "Bearer", since I can't use authentication in Swagger UI because of lowercase 'b'.

Taken from https://www.rfc-editor.org/rfc/rfc6750.html#section-2.1

2.1. Authorization Request Header Field

When sending the access token in the "Authorization" request header field defined by HTTP/1.1 [RFC2617], the client uses the "Bearer" authentication scheme to transmit the access token.