2020-12-21 17:11:48 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const passport = require('koa-passport');
|
|
|
|
|
|
|
|
const createLocalStrategy = require('./passport/local-strategy');
|
|
|
|
|
2021-01-27 11:52:02 +01:00
|
|
|
const getPassportStrategies = () => [createLocalStrategy(strapi)];
|
2020-12-21 17:11:48 +01:00
|
|
|
|
|
|
|
const init = () => {
|
2021-01-27 11:52:02 +01:00
|
|
|
strapi.admin.services.passport
|
|
|
|
.getPassportStrategies()
|
|
|
|
.forEach(strategy => passport.use(strategy));
|
2020-12-21 17:11:48 +01:00
|
|
|
|
|
|
|
return passport.initialize();
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
init,
|
2021-01-27 11:52:02 +01:00
|
|
|
getPassportStrategies,
|
2020-12-21 17:11:48 +01:00
|
|
|
};
|