I'd like to use token based authentication to authenticate users from my node.js application, using the binary protocol via oriento.
With this I can authenticate a user and query the db with record level security for a user context. All great so far.
Now in my application I naturally need to identify the authenticated user. Given the token, is there a simple way to query for the authenticated user record? I'm considering using with a Bearer strategy in passport.js, see
https://github.com/jaredhanson/passport-http-bearer. I'd like to do the equivalent with OrientDB as in the following example (looks like Mongo/mongoose).
passport.use(new BearerStrategy(
function(token, done) {
User.findOne({ token: token }, function (err, user) {
if (err) { return done(err); }
if (!user) { return done(null, false); }
return done(null, user, { scope: 'all' });
});
}
));