deepstream-passport
Notice!
This project is no longer supported. My other module use-express-middleware
covers this use case.
Install:
npm install deepstream-passport --save
Usage:
import Deepstream from 'deepstream.io'
import deepstreamPassport from 'deepstream-passport'
import expressSession from 'express-session'
const server = new Deepstream()
const session = expressSession({
...options
})
server.set('permissionHandler', deepstreamPassport(session, {
canPerformAction(user, callback) {
callback(null, user.isAdmin)
}
}))
server.set('permissionHandler', deepstreamPassport(session, {
isValidUser: (user, callback) => {
if(user) {
callback(null, user.id)
} else {
callback(null, 'open')
}
},
canPerformAction(user, callback) {
callback(null, user.isAdmin)
}
}))