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 1.0.1 to 1.1.0

8

CHANGELOG.md
# Changelog
## 1.1.0
Make the `req` mock to inherit from Koa's `request` object before adding delegates for Node's request and Koa's context to it. This makes custom properties/methods added to Koa's request available to passport and its authentication strategies.
## 1.0.1
- add `flash` to the `req` mock
## 1.0.0

@@ -4,0 +12,0 @@

4

gulpfile.js

@@ -7,5 +7,3 @@ /*eslint no-process-exit: 0*/

gulp.task('default', ['test'], function() {
process.exit(0)
})
gulp.task('default', ['test'])

@@ -12,0 +10,0 @@ var mocha = require('gulp-mocha')

@@ -155,7 +155,6 @@ /**

// create request mock
var request = require('./request')
var properties = require('./request')
function createReqMock(ctx) {
var req = Object.create(request)
req.context = ctx
var req = Object.create(ctx.request, properties)
return req
}

@@ -49,37 +49,4 @@ // Koa and Express are fundamental different in how they deal with extensions

'socket',
'connection',
// Koa's request
'header',
'headers',
'url',
'method',
'path',
'query',
'querystring',
'search',
'host',
'hostname',
'fresh',
'stale',
'idempotent',
'socket',
'charset',
'length',
'protocol',
'secure',
'ip',
'ips',
'subdomains',
'type',
'accepts',
'acceptsEncodings',
'acceptsCharsets',
'acceptsLanguages',
'is',
'get',
'inspect',
'toJSON',
'originalUrl',
'accept',
// Koa's context

@@ -106,7 +73,7 @@ 'app',

// create a delegate for each key
var request = module.exports = {}
var properties = module.exports = {}
keys.forEach(function(key) {
Object.defineProperty(request, key, {
properties[key] = {
get: function() {
var obj = getObject(this.context, key)
var obj = getObject(this.ctx, key)
if (!obj) return undefined

@@ -125,7 +92,6 @@

set: function(value) {
var obj = getObject(this.context, key) || this.context.passport
var obj = getObject(this.ctx, key) || this.ctx.passport
obj[key] = value
},
enumerable: true
})
}
}
})

@@ -140,2 +106,6 @@

if (key in ctx.request) {
return ctx.request
}
if (key in ctx.req) {

@@ -145,6 +115,2 @@ return ctx.req

if (key in ctx.request) {
return ctx.request
}
if (key in ctx) {

@@ -151,0 +117,0 @@ return ctx

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

},
"version": "1.0.1",
"version": "1.1.0",
"description": "Passport middleware for Koa",

@@ -24,3 +24,2 @@ "keywords": [

"chai": "^1.9.1",
"co-mocha": "^1.0.1",
"co-supertest": "0.0.7",

@@ -27,0 +26,0 @@ "gulp": "^3.8.7",

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