loopback-swagger-auth
v1.0.0
Published
Loopback component to add global auth to your swagger spec document
Downloads
2
Readme
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.