loopback-swagger-auth

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i loopback-swagger-auth

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

4.49 kB

Total Files

8

Last publish

Collaborators

  • danwakeem