krakenjs / swaggerize-express

Design-driven apis with swagger 2.0 and express.
Other
354 stars 81 forks source link

Security does not work when using basic security #139

Open muysewinkel opened 6 years ago

muysewinkel commented 6 years ago

HI I'm trying to get basic security working.

I started with the following security definition:

securityDefinitions:
  UserSecurity:
    type: basic
    #in: header
    #name: X-Access-Token
    x-authorize: security/userSecurity.js

and in the path I added:

security:
    - UserSecurity: []

If I try to access this path, I see that it fails if (thing.isFunction(security[type].authorize)) {

At this point my security type does not contain an authorize function

I tried adding the lines as described in the documentation

#
# Security
#
securityDefinitions:
  UserSecurity:
    type: basic
    x-authorize: /security/userSecurity.js
    scopes:
    - user:all

This does not work because scopes is not allowed for basic

#
# Security
#
securityDefinitions:
  UserSecurity:
    x-authorize: /security/userSecurity.js
    scopes:
    - user:all

This does not work because type is mandatory.