swagger-magic-auth-handler

This module adds all the missing parts in the auth aspect. It adds the relevant paths and definitons into the swagger spec and consigure comtrollers to handle the auth aspect.

Usage no npm install needed!

<script type="module">
  import swaggerMagicAuthHandler from 'https://cdn.skypack.dev/swagger-magic-auth-handler';
</script>

README

Install

npm install swagger-magic-auth-handler --save

swagger-magic-auth-handler

This module adds all the missing parts to the auth aspect. It adds the relevant paths and definitons into the swagger spec and configure controller.

Params

  • swaggerObject Object - swagger spec representing the api
  • token Object - implementation of the swagger-magic-token-interface. required if securityDefinitions defined in the swagger spec
  • auth Object - implementation of the swagger-magic-auth-interface. required if securityDefinitions defined in the swagger spec

Returns: Object - the auth controller -> {name, methods}
Example

    var authHandler = require("swagger-magic-auth-handler");

    var result = authHandler(swaggerObject, token, auth);

    app.use(result.middleware());
    options.controllers[result.controller.name] = result.controller.methods;