Commit e2bf18ab authored by Luc Didry's avatar Luc Didry

Update passport-jwt to not be limited to NodeJS 4

This commit is dedicated to Schoumi, who is supporting me on Tipeee.
Many thanks :-)
parent 885a19c6
......@@ -17,8 +17,6 @@ MyPads propose la gestion :
MyPads est publié sur NPM. Vous pouvez de fait l'installer directement depuis l'interface d'administration d'etherpad. Vous pourriez avoir besoin de redémarrer votre instance une fois le plugin installé.
ATTENTION: si vous désinstallez MyPads, toutes les données associées seront définitivement *supprimées*.
**NB** MyPads ne fonctionne qu'avec NodeJS 4.
### Installation manuelle
Vous pouvez installer MyPads depuis les sources. Pour cela :
......
......@@ -26,8 +26,6 @@ MyPads manages :
At the moment, MyPads is publicly available on NPM. So you can install it from etherpad administration. You may need a reboot of your etherpad instance after the plugin install.
WARNING: if you uninstall MyPads, all its data will be definitely *removed*.
**NB** MyPads only works with NodeJS 4.
### Manual install
You can install MyPads from source. In order to do that :
......
......@@ -32,6 +32,7 @@
// External dependencies
var ld = require('lodash');
var jwt = require('jsonwebtoken');
var ExtractJwt = require('passport-jwt').ExtractJwt;
var LdapAuth = require('ldapauth-fork');
var settings;
try {
......@@ -112,7 +113,15 @@ module.exports = (function () {
*/
auth.fn.local = function () {
var opts = { secretOrKey: auth.secret, passReqToCallback: true };
var opts = {
secretOrKey: auth.secret,
passReqToCallback: true,
jwtFromRequest: ExtractJwt.fromExtractors([
ExtractJwt.fromUrlQueryParameter('auth_token'),
ExtractJwt.fromBodyField('auth_token'),
ExtractJwt.fromAuthHeaderWithScheme('JWT')
])
};
passport.use(new JWTStrategy(opts,
function (req, jwt_payload, callback) {
var isFS = function (s) { return (ld.isString(s) && !ld.isEmpty(s)); };
......
......@@ -24,12 +24,13 @@
"body-parser": "~1.12.3",
"cuid": "^1.2.4",
"emailjs": "~0.3.16",
"jasmine": "^2.8.0",
"js-base64": "~2.1.8",
"jsonwebtoken": "~5.0.4",
"ldapauth-fork": "^4.0.2",
"lodash": "^3.1.0",
"passport": "^0.2.1",
"passport-jwt": "~1.1.0",
"passport-jwt": "^3.0.1",
"slugg": "~0.1.2"
},
"devDependencies": {
......@@ -39,7 +40,7 @@
"es6-shim": "~0.32.2",
"express": "4.12.3",
"express-session": "1.11.1",
"jasmine": "^2.2.0",
"jasmine": "^2.8.0",
"jshint": "^2.6.0",
"minifyify": "^7.1.0",
"mithril": "^0.1.30",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment