1.0.0 • Published 5 years ago

loopback-swagger-auth v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Loopback Swagger Auth

This loopback component to add global authentication to your swagger spec file.

Note: This does not implement authentication it simply updates your swagger spec with global metadata. You can also technically use this to implement anything globally but I created it to add authentication to my spec file :)

Useage

Install

npm i loopback-swagger-auth --save

Integrate with Loopback

Include the mixin in your component-config.json file

{
  "loopback-swagger-auth": {
    "securityDefinitions": {
      "BearerAuth": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      }
    },
    "security": [
      {
        "BearerAuth": []
      }
    ]
  }
}

The example above is adding an Authorization header for bearer token authentication. If you need more info on securityDefinitions in swagger 2.0 check swaggers README.

Options

As mentioned above this component supports any global properties in the swagger 2.0 spec. Check the README for more info on what options are available.