apigee-127/swagger-tools

handling middleware on on multiple optional security options

iamakimmer opened this issue · 1 comments

I have configured my swagger to optionally taken in a api key or jwt key:

security:

  • APIKeyHeader: []
  • JWTPublicKeyHeader: []

and my middleware to


  app.use(middleware.swaggerSecurity({
    JWTPublicKeyHeader: function(req, def, scopes, callback) {
           //logic 
    }, 
    APIKeyHeader: function(req, def, scopes, callback) {
         //logic 
    }
  }));

If i have a request and I'm only sending a JWTPublicKeyHeader, it still goes through the APIKeyHeader middleware in which no keys exist and will fail. How do I ignore this middleware from being called as I'm only sending 1 key?

I have the same problem