2016-09-30 13:45:59 +02:00
|
|
|
var ClientPasswordStrategy = require('passport-oauth2-client-password').Strategy,
|
|
|
|
BearerStrategy = require('passport-http-bearer').Strategy,
|
|
|
|
passport = require('passport'),
|
2017-09-18 14:01:58 +02:00
|
|
|
authStrategies = require('./auth-strategies');
|
2016-09-30 13:45:59 +02:00
|
|
|
|
2016-10-12 13:11:56 +02:00
|
|
|
/**
|
|
|
|
* auth types:
|
|
|
|
* - password: local login
|
|
|
|
*/
|
2017-09-18 14:01:58 +02:00
|
|
|
exports.init = function initPassport() {
|
|
|
|
passport.use(new ClientPasswordStrategy(authStrategies.clientPasswordStrategy));
|
|
|
|
passport.use(new BearerStrategy(authStrategies.bearerStrategy));
|
2016-11-08 15:21:25 +01:00
|
|
|
|
2017-09-18 14:01:58 +02:00
|
|
|
return passport.initialize();
|
2016-09-30 13:45:59 +02:00
|
|
|
};
|