Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deepstream-passport

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepstream-passport

Passport Session Authentication for Deepstream.io

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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()

// You can define this somewhere in your app and then import it both
//  for express and deepstream.
// If you use a store such as redis for you sessions, you'll be able
//  to run express and deepstream in two seperate processes and/or on
//  two seperate ports if you so please.
const session = expressSession({
  ...options
})

// Basic:
server.set('permissionHandler', deepstreamPassport(session, {
  canPerformAction(user, callback) {
    callback(null, user.isAdmin)
  }
}))

// Custom `isValidUser`:
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)
  }
}))

FAQs

Package last updated on 07 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc