express-session-fixation-middleware

1.0.1 • Public • Published

express-session-fixation-middleware

Reset express-session session IDs to prevent against fixation attacks

Install

$ npm install --save express-session-fixation-middleware

Usage

var fixation = require('express-session-fixation-middleware');

// Register with express
app.use(fixation(options));

app.use('/api/login', function(req, res, next) {
    req.login();
    req.resetSessionID().then(function() {
        next();
    });
});

API

Options

express-session-fixation-middleware accepts an optional options object that may include the following options

everyRequest

Set this to true if you want the session ID to reset every time the user visits. Defaults to false. It's good for security, but may result in longer response times. For this reason, it only resets the ID if the request is a non-AJAX request.

Package Sidebar

Install

npm i express-session-fixation-middleware

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

2.59 kB

Total Files

3

Last publish

Collaborators

  • owenm