UNPKG

loopback-component-auth

Version:

Extends loopback-component-passport to support custom auth schemes (i.e. other than the supported 'ldap', 'local', 'oauth', 'oauth1', 'oauth 1.0', 'openid', 'openid connect' and 'oauth 2.0')

26 lines (21 loc) 475 B
'use strict'; const _ = require('lodash'); const registry = {}; function add(name, options) { if (registry[name]) { throw new Error(`a provider with name "${name} is already registered"`); } registry[name] = options; // @TODO: validate provider options?? } function list() { return Object.keys(registry).map((providerName) => { return _.assign({}, registry[providerName], { name: providerName, }); }); } module.exports = { add, list, };