You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was just thinking about how it would be possible to have a channel that requires you to provide certain credentials before messages to pass. It also occured to me that it might be possible to adapt passport.js to do this.
For instance, this bit of pseudocode would be to allow file uploads, but only for messages that authenticate against the passport local auth, or twitter, or json web token. whatever.
var graft = require('graft');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var passportStream = require('passport-stream')(passport);
var fs = require('fs');
passport.use(new LocalStrategy(/* snip */));
var graftServer = graft()
.pipe(passportStream.authenticate('local'))
.pipe(uploadService)
// client
var graftClient = graft();
graftClient.pipe(graftServer);
graft.write({
username: 'adam',
password: '***',
file: fs.createReadStream('/file/to/upload'),
location: '/path/on/server'
});
The text was updated successfully, but these errors were encountered:
AdrianRossouw
changed the title
authentication
authentication of channels / streams with passport.js
Jul 31, 2015
I was just thinking about how it would be possible to have a channel that requires you to provide certain credentials before messages to pass. It also occured to me that it might be possible to adapt passport.js to do this.
Passport seems to be designed with stuff like this in mind : jaredhanson/passport#383
For instance, this bit of pseudocode would be to allow file uploads, but only for messages that authenticate against the passport local auth, or twitter, or json web token. whatever.
The text was updated successfully, but these errors were encountered: