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.5.1 to 1.0.0

.drone.yml

24

CHANGELOG.md
# Changelog
## 1.0.0
Using ES6 Proxy currently breaks debugging (see #17). Until this is fixed, the Proxy approach got replace by delegating a whitelist of possible used properties/methods to either Node's request, Koa's context or Koa's request.
Note: There is nothing special about this being `1.0.0`. The major version bump is just because the update could possible break something.
## 0.5.1
- re-add authenticated user to `req.user`
## 0.5.0
* internal improvements (neither modify Node's request nor Koa's request object by mocking the `req` object with a proxy that forwards reads to either Node's request object, Koa's request object or Koa's context)
* `--harmony-proxies` has to enabled now
- internal improvements (neither modify Node's request nor Koa's request object by mocking the `req` object with a proxy that forwards reads to either Node's request object, Koa's request object or Koa's context)
- `--harmony-proxies` has to enabled now
## 0.4.0
* Add support for custom authentication methods, e.g.:
- Add support for custom authentication methods, e.g.:

@@ -30,14 +40,14 @@ ```js

* add generator function names for Koa debugging purposes
- add generator function names for Koa debugging purposes
## 0.3.1
* make ctx.login() yieldable
- make ctx.login() yieldable
## 0.3.0
* adapt recent Koa API changes
- adapt recent Koa API changes
## 0.2.0
* `passport 0.2.x compatibility
- `passport 0.2.x compatibility

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

*/
var _initialize = require('passport/lib/middleware/initialize')
, _authenticate = require('passport/lib/middleware/authenticate')
var _initialize = require('passport/lib/middleware/initialize')
var _authenticate = require('passport/lib/middleware/authenticate')

@@ -27,14 +27,24 @@ /**

this.passport = {}
Object.defineProperty(ctx.req, 'user', {
var userProperty = passport._userProperty || 'user'
Object.defineProperty(ctx.req, userProperty, {
enumerable: true,
get: function() { return ctx.passport.user }
get: function() {
return ctx.passport[userProperty]
},
set: function(val) {
ctx.passport[userProperty] = val
}
})
var req = createReqMock(ctx)
// add aliases for passport's request extensions to `ctx`
var login = ctx.req.login
ctx.login = ctx.logIn = ctx.req.login = function(user, options) {
// add aliases for passport's request extensions to Koa's context
var login = ctx.req.login
var logout = ctx.req.logout
ctx.login = ctx.logIn = function(user, options) {
return login.bind(req, user, options)
}
ctx.logout = ctx.logOut = ctx.req.logout = ctx.req.logout.bind(req)
ctx.req.login = ctx.req.logIn = login.bind(req)
ctx.logout = ctx.logOut = ctx.req.logout = ctx.req.logOut = logout.bind(req)
ctx.isAuthenticated = ctx.req.isAuthenticated = ctx.req.isAuthenticated.bind(req)

@@ -61,3 +71,3 @@ ctx.isUnauthenticated = ctx.req.isUnauthenticated = ctx.req.isUnauthenticated.bind(req)

callback = options
options = {}
options = {}
}

@@ -78,8 +88,6 @@ options = options || {}

var _callback = callback
callback = function callback(err, user, info) {
co(function*() {
yield _callback(err, user, info)
callback.done(null, false)
})()
}
callback = co(function*(err, user, info) {
yield _callback(err, user, info)
callback.done(null, false)
})
}

@@ -150,13 +158,8 @@

// create
var handler = require('node-proxy-defaults')
// create request mock
var request = require('./request')
function createReqMock(ctx) {
// Use a proxy that forwards `req` reads to either `ctx.passport`,
// Node's request, Koa's request or Koa's context. Writes are persistet
// into `ctx.passport`.
return Proxy.create(handler(ctx.passport, {
get: function(receiver, key) {
return ctx.passport[key] || ctx.req[key] || ctx.request[key] || ctx[key]
}
}))
}
var req = Object.create(request)
req.context = ctx
return req
}
var passport = module.exports = require('passport')
passport.framework(require('./framework/koa')())
passport.framework(require('./framework/koa')())

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

},
"version": "0.5.1",
"version": "1.0.0",
"description": "Passport middleware for Koa",

@@ -19,6 +19,20 @@ "keywords": [

"dependencies": {
"co": "^3.0.6",
"node-proxy-defaults": "^1.0.0",
"passport": ">=0.2.x"
"co": "^3.1.0",
"passport": "^0.2.0"
},
"devDependencies": {
"chai": "^1.9.1",
"co-mocha": "^1.0.1",
"co-supertest": "0.0.7",
"gulp": "^3.8.7",
"gulp-coveralls": "^0.1.2",
"gulp-istanbul": "git://github.com/EricMCornelius/gulp-istanbul",
"gulp-mocha": "^1.0.0",
"koa": "^0.10.0",
"koa-bodyparser": "^1.0.1",
"koa-route": "^2.1.0",
"mocha": "^1.21.4",
"passport-local": "^1.0.0",
"supertest": "^0.13.0"
},
"bugs": "https://github.com/rkusa/koa-passport/issues",

@@ -29,2 +43,6 @@ "repository": {

},
"scripts": {
"test": "node --harmony `which gulp`",
"coveralls": "node --harmony `which gulp` coverage"
},
"engines": {

@@ -31,0 +49,0 @@ "node": ">=0.11.2"

@@ -7,2 +7,3 @@ # koa-passport

[![Dependency Status][dependencies]](https://david-dm.org/rkusa/koa-passport)
[![Build Status][drone]](https://ci.rkusa.st/github.com/rkusa/koa-passport)

@@ -51,3 +52,4 @@ ## Usage

[npm]: http://img.shields.io/npm/v/koa-passport.svg?style=flat
[dependencies]: http://img.shields.io/gemnasium/rkusa/koa-passport.svg?style=flat
[npm]: http://img.shields.io/npm/v/koa-passport.svg?style=flat-square
[dependencies]: http://img.shields.io/david/rkusa/koa-passport.svg?style=flat-square
[drone]: http://ci.rkusa.st/github.com/rkusa/koa-passport/status.svg?success=https%3A%2F%2Fimg.shields.io%2Fbadge%2Fbuild-success-brightgreen.svg%3Fstyle%3Dflat-square&failure=https%3A%2F%2Fimg.shields.io%2Fbadge%2Fbuild-failure-red.svg%3Fstyle%3Dflat-square

Sorry, the diff of this file is not supported yet

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