wejsv2old-passport
v0.1.2
Published
Passport logic and config for We.js v2
Downloads
1
Readme
we-passport
Passport logic and configurator for We.js
Installation
Install it on you sails project
npm install we-passport --save
And create one custom Policy ex: PassportPolicy with:
//file api/policies/PassportPolicy.js
var wePassport = require('we-passport');
// initialize passport configs
var passportMiddleware = wePassport.init();
/**
* Use this Passport policy to check user acesss and pepopulate current logged in user
*/
module.exports = function (req, res, ok) {
passportMiddleware(req, res, ok);
};
And finely add to you policies.js configs:
//file configs/policies.js
module.exports.policies = {
'*':['PassportPolicy'],
'messenger': [
'PassportPolicy',
'AllRoutesPolicy',
'MessengerPolicy'
],
//'main': 'MainPolicy',
'activity': [
'PassportPolicy',
'AllRoutesPolicy'
]
// ...
};
@TODO check how to make this configs easy ...
Usage
In controller
var passport = require('we-passport').getPassport();
Configuration
TODO!
Credits
Alberto Souza - License: MIT