Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danwakeem/loopback-swagger-auth
Loopback component to add global auth to your swagger spec document
https://github.com/danwakeem/loopback-swagger-auth
Last synced: about 6 hours ago
JSON representation
Loopback component to add global auth to your swagger spec document
- Host: GitHub
- URL: https://github.com/danwakeem/loopback-swagger-auth
- Owner: Danwakeem
- Created: 2019-06-07T16:30:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:48:06.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T22:02:48.470Z (7 months ago)
- Language: JavaScript
- Size: 445 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Loopback Swagger Auth
[![Build Status](https://travis-ci.com/Danwakeem/loopback-swagger-auth.svg?branch=master)](https://travis-ci.com/Danwakeem/loopback-swagger-auth)
[![Coverage Status](https://coveralls.io/repos/github/Danwakeem/loopback-swagger-auth/badge.svg?branch=master)](https://coveralls.io/github/Danwakeem/loopback-swagger-auth?branch=master)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```json
{
"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](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-definitions-object).
## Options
As mentioned above this component supports any global properties in the swagger 2.0 spec. Check the [README](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) for more info on what options are available.