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

No authorization headers available in generated API server #2775

Closed
SonnyRajagopalan opened this issue Mar 23, 2017 · 6 comments
Closed

No authorization headers available in generated API server #2775

SonnyRajagopalan opened this issue Mar 23, 2017 · 6 comments

Comments

@SonnyRajagopalan
Copy link

SonnyRajagopalan commented Mar 23, 2017

Hello,

I have my security definitions in the preamble section of my swagger.yaml like so:

securityDefinitions:
  Bearer:
    description: |
      For accessing the API a valid JWT token must be passed in all the queries in
      the 'Authorization' header.
      A valid JWT token is generated by the API and retourned as answer of a call
      to the route /login giving a valid user & password.
      The following syntax must be used in the 'Authorization' header :
       Bearer: header.payload.signature

    type: apiKey
    name: Authorization
    in: header

And the protected routes have this:

  description: |
    blah blah
  tags:
    - Tag                  
  security:
    - Bearer: []

Now, when I launch this using Swagger UI, I see the API showing up the Security section of the authentication for getting the Authorization token. Also, all the protected routes have the check box for the associated security token (Bearer). But, when I generate the node-js server stub and launch the server stub, I no longer see an authentication section of the API, nor it it as being included as a parameter in the body for the protected routes.

Is this normal behavior? If not, what am I missing?

Any help is appreciated.

Thanks,
Sonny.

@webron
Copy link
Contributor

webron commented Mar 24, 2017

If you have an issue with the generated code, open the ticket on swagger-codegen. It's got nothing to do with the UI.

@webron webron closed this as completed Mar 24, 2017
@SonnyRajagopalan
Copy link
Author

FWIW, It is not clear if this is an issue in codegen or UI.

@webron
Copy link
Contributor

webron commented Mar 24, 2017

Your definition looks correct. If it works as expected in the UI and not in the generated code... the issue is with the codegen

@SonnyRajagopalan
Copy link
Author

SonnyRajagopalan commented Mar 24, 2017 via email

@SonnyRajagopalan
Copy link
Author

SonnyRajagopalan commented Mar 24, 2017

@webron Sorry to be harping on this, but this also is related to the highly anticipated feature described in https://github.com//issues/1108

I have to second that request. This is kinda basic feature, in my opinion, but again, I harp.

PS: I have raised this in codegen, with no response so far.

@webron
Copy link
Contributor

webron commented Mar 25, 2017

I don't see how the generate server is related to #1108.

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

No branches or pull requests

2 participants