amphora icon indicating copy to clipboard operation
amphora copied to clipboard

Allow plugins to opt-in for authentication

Open pedro-rosario opened this issue 6 years ago • 1 comments

Feature Info

Description

  • Passes a function (useAuth) to each plugin.

Plugin example

'use strict';

const express = require('express');

module.exports = (router, _pluginDBAdapter, _publish, _sites, _site, useAuth) => {
  const pluginRouter = express.Router();

  useAuth(pluginRouter);
  pluginRouter.use((req, res) => res.json({ method: req.method }));
  router.use('/_test', pluginRouter);
}

Related

https://github.com/clay/amphora-auth/pull/19

TODO

Closes #640

pedro-rosario avatar May 01 '19 15:05 pedro-rosario