@passport-next/passport
Advanced tools
Comparing version 0.5.0 to 1.0.0
@@ -0,3 +1,17 @@ | ||
This changelog follows Semantic Versioning https://semver.org/ | ||
# 1.0.0 (2018-09-06) | ||
### Major | ||
* Removed obsolete pauseStream option, streams as of node 0.10 are paused by default https://nodejs.org/api/stream.html#stream_two_modes @rwky | ||
### Minor | ||
* Updated dev deps @rwky | ||
# 0.5.0 (2018-06-29) | ||
### Minor | ||
* Added CHANGELOG.md @rwky | ||
@@ -4,0 +18,0 @@ * Updated travis to use node 6, 8 and 10 @rwky |
@@ -221,9 +221,2 @@ /** | ||
* | ||
* Options: | ||
* - `pauseStream` Pause the request stream before deserializing the user | ||
* object from the session. Defaults to _false_. Should | ||
* be set to true in cases where middleware consuming the | ||
* request body is configured after passport and the | ||
* deserializeUser method is asynchronous. | ||
* | ||
* @param {Object} options | ||
@@ -230,0 +223,0 @@ * @return {Function} middleware |
/** | ||
* Module dependencies. | ||
*/ | ||
var pause = require('pause') | ||
, util = require('util') | ||
var util = require('util') | ||
, Strategy = require('@passport-next/passport-strategy'); | ||
@@ -50,2 +49,3 @@ | ||
su; | ||
if (req._passport.session) { | ||
@@ -56,7 +56,2 @@ su = req._passport.session.user; | ||
if (su || su === 0) { | ||
// NOTE: Stream pausing is desirable in the case where later middleware is | ||
// listening for events emitted from request. For discussion on the | ||
// matter, refer to: https://github.com/jaredhanson/passport/pull/106 | ||
var paused = options.pauseStream ? pause(req) : null; | ||
this._deserializeUser(su, req, function(err, user) { | ||
@@ -72,5 +67,2 @@ if (err) { return self.error(err); } | ||
self.pass(); | ||
if (paused) { | ||
paused.resume(); | ||
} | ||
}); | ||
@@ -87,1 +79,3 @@ } else { | ||
module.exports = SessionStrategy; | ||
/* vim: set tabstop=2 shiftwidth=2 softtabstop=0 expandtab smarttab */ |
{ | ||
"name": "@passport-next/passport", | ||
"version": "0.5.0", | ||
"version": "1.0.0", | ||
"description": "Simple, unobtrusive authentication for Node.js.", | ||
@@ -32,4 +32,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@passport-next/passport-strategy": "1.x.x", | ||
"pause": "0.0.1" | ||
"@passport-next/passport-strategy": "1.x.x" | ||
}, | ||
@@ -41,4 +40,3 @@ "devDependencies": { | ||
"chai-connect-middleware": "0.3.x", | ||
"chai-passport-strategy": "1.x.x", | ||
"proxyquire": "2.0.x" | ||
"@passport-next/chai-passport-strategy": "1.x.x" | ||
}, | ||
@@ -45,0 +43,0 @@ "engines": { |
@@ -14,2 +14,3 @@ # Passport | ||
Status: | ||
[![NPM version](https://img.shields.io/npm/v/@passport-next/passport.svg)](https://www.npmjs.com/package/@passport-next/passport) | ||
[![Build Status](https://travis-ci.org/passport-next/passport.svg?branch=master)](https://travis-ci.org/passport-next/passport) | ||
@@ -109,2 +110,23 @@ [![Coverage Status](https://coveralls.io/repos/github/passport-next/passport/badge.svg?branch=master)](https://coveralls.io/github/passport-next/passport?branch=master) | ||
#### Protect Routes When Using Sessions | ||
Passport provides an `isAuthenticated()` function on the request object, which | ||
is used to determine if the user has been authenticated and stored in the | ||
session. | ||
```javascript | ||
app.post('/some/protected/route', | ||
function(req, res, next) { | ||
if(req.isAuthenticated()){ | ||
next(); | ||
} else { | ||
next(new Error('Unauthorized')); | ||
} | ||
}); | ||
``` | ||
For a more complete solution to handling unauthenticated users, see | ||
[connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login), a | ||
middleware to ensure login sessions. | ||
## Strategies | ||
@@ -141,3 +163,4 @@ | ||
- Postgres | ||
- [Tutorial](http://mherman.org/blog/2015/01/31/local-authentication-with-passport-and-express-4/) / [working example](https://github.com/mjhea0/passport-local-express4) | ||
- [Tutorial](http://mherman.org/blog/2016/09/25/node-passport-and-postgres/) / [working example](https://github.com/mjhea0/passport-local-knex) | ||
- Koa - [Tutorial](http://mherman.org/blog/2018/01/02/user-authentication-with-passport-and-koa) / [working example](https://github.com/mjhea0/node-koa-api) | ||
- **Social Authentication**: Refer to the following tutorials for setting up various social authentication strategies: | ||
@@ -144,0 +167,0 @@ - Express v3x - [Tutorial](http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/) / [working example](https://github.com/mjhea0/passport-examples) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
46180
1
5
1
173
1063
- Removedpause@0.0.1
- Removedpause@0.0.1(transitive)