Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][ALL] HTTP Auth scheme names are (incorrectly) case-sensitive #6184

Open
asazernik opened this issue May 6, 2020 · 2 comments
Open

Comments

@asazernik
Copy link

Description

The API generator does not generate authorization/authentication code when the user inserts a security scheme like so:

components:
  securitySchemes:
    bearerToken:
      type: http
      scheme: Bearer

Note that "Bearer" is title-cased. It works if the scheme is instead lowercase "bearer".

Even though the spec is not clear on the subject, according to the spec author HTTP auth schemes should be case-insensitive. Even if the schemes were case-sensitive, the IANA registry's canonical cases for the two most common schemes are "Bearer" and "Basic".

openapi-generator version

4.3.0

OpenAPI declaration file content or url

See yaml snippet in description above

Command line used for generation

openapi-generator generate -i $OAS3_YAML_FILE -g scala-akka -o /tmp/apiclient-test

I have also tested this with ruby and bash generators

Suggest a fix

I've opened a PR in swagger-api/swagger-js#1531; I don't know where the relevant code is in this project, though.

@auto-labeler
Copy link

auto-labeler bot commented May 6, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@l0gicgate
Copy link
Contributor

l0gicgate commented Jun 6, 2020

Using the following security schemes:

components:
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer

security:
  - bearerToken: []

I'm getting this when generating HTML2 docs:

curl -X GET -H "Accept: application/json" -H "Authorization: Basic [[basicHash]]"

No matter what the case is. What am I doing wrong?

Edit:
I fixed my issue with #6579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants