completecoding / serverless-auto-swagger

80 stars 48 forks source link

Add authorizer to generated swagger endpoints #86

Closed tahjgayfield closed 2 years ago

tahjgayfield commented 2 years ago

Is there a way to add an authorizer to the /swagger endpoint that is generated by this plugin?

chelodegli commented 2 years ago

If you mean the "Authorize" button on top, you could set it up like this in your serverless.yml:

custom:
    autoswagger:
        apiKeyHeaders: ['authentication-token']
bfaulk96 commented 2 years ago

He means actually adding lambda authorization, so you can't view the swagger endpoints without going through some form of auth.

@tahjgayfield It's not currently possible, but I am looking into adding that today.

bfaulk96 commented 2 years ago

@tahjgayfield this feature has been added as of release v2.9.2 😄

You can add a custom authorizer for /swagger and /swagger.json with the custom config option

lambdaAuthorizer: ${self:custom.customAuthorizer}