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

koa-passport

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-passport - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

25

lib/framework/koa.js

@@ -13,4 +13,10 @@ /**

/**
* Passport's HTTP IncomingMessage extension names
*/
var requestExtensions = ['login', 'logIn', 'logout', 'logOut',
'isAuthenticated', 'isUnauthenticated']
/**
* Passport's initialization middleware for Koa.
*
*
* @return {GeneratorFunction}

@@ -22,3 +28,13 @@ * @api private

return function*(next) {
// koa <-> connect compatibility
this.req.session = this.session
this.req.query = this.request.query
this.req.body = this.request.body
// add aliases for passport's request extensions to `ctx`
var ctx = this
requestExtensions.forEach(function(method) {
ctx[method] = ctx.req[method].bind(ctx.req)
})
yield middleware.bind(middleware, this.req, this)

@@ -41,5 +57,2 @@ yield next

return function*(next) {
// koa ↔ connect compatibility
this.req.session = this.session
this.req.query = this.query
var ctx = this

@@ -70,3 +83,3 @@

// call the connect middleware
middleware(this.req, res, done)
middleware(ctx.req, res, done)
}

@@ -81,3 +94,3 @@

}
/**

@@ -84,0 +97,0 @@ * Framework support for Koa.

@@ -7,3 +7,3 @@ {

},
"version": "0.2.0",
"version": "0.3.0",
"description": "Passport middleware for Koa",

@@ -10,0 +10,0 @@ "keywords": [

@@ -1,2 +0,2 @@

# koa-passport
# koa-passport
[![NPM](https://badge.fury.io/js/koa-passport.png)](https://npmjs.org/package/koa-passport)

@@ -10,9 +10,6 @@ [![Dependency Status](https://david-dm.org/rkusa/koa-passport.png?theme=shields.io)](https://david-dm.org/rkusa/koa-passport)

```js
// Body Parser & Query
app.use(function*(next) {
this.req.body = yield /* insert your body parser here */
// body parser
var bodyParser = require('koa-bodyparser')
app.use(bodyParser())
yield next
})
// Sessions

@@ -19,0 +16,0 @@ var session = require('koa-session')

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