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

Setting global security definitions does not work. #106

Open
randomcatgamer opened this issue Jul 19, 2017 · 4 comments
Open

Setting global security definitions does not work. #106

randomcatgamer opened this issue Jul 19, 2017 · 4 comments

Comments

@randomcatgamer
Copy link

Using the global security definition does not work.

...
securityDefinitions:
   APIKeyHeader:
     type: apiKey
     in: header
     name: X-jwttoken
security:
        - APIKeyHeader: []
...
/someendpoint:
    x-swagger-router-controller: someendpoint
    get:
      description: a description
      operationId: someendpointMethod
      produces:
        - application/json
      parameters:
        - name: X-jwttoken
          in: header
          description: jwt wso2 token
          required: false
          type: string
      responses:
        '200':
          description: Success

The error I get is:
_Cannot read property 'type' of undefined","stacktrace":"TypeError: Cannot read property 'type' of undefined
at getScopeOrAPIKey (D:\devcat\dev_workspace\workspace\backend-marketplace-productactivation\node_modules\swagger-node-runner\fittings\swagger_security.js:80:25)
at andCheck (D:\devcat\dev_workspace\workspace\backend-marketplace-productactivation\node_modules\swagger-node-runner\fittings\swagger_security.js:51:43)

If I put the security definition within each of my paths (instead of global) it works.

Also, with swagger-node-mw 0.1.0 the global definition works.

@benishak
Copy link

I have the same issue

I get this error

{"message":"Cannot read property 'type' of undefined"}

@benishak
Copy link

@theganyo do you mind having look into this?

@theganyo
Copy link
Collaborator

Hey Ben. I see you're pushing for a new Sway release. If that can happen, it would solve everything in one fell swoop, so that would be best.

@benishak
Copy link

Yes hopefully that happens soon! Thanks.

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

3 participants