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

hapi-auth-cookie

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-auth-cookie - npm Package Compare versions

Comparing version 2.2.0 to 3.0.1

4

example/index.js

@@ -102,4 +102,4 @@ var Hapi = require('hapi');

return callback(null, true, cached.account)
})
return callback(null, true, cached.account);
});
}

@@ -106,0 +106,0 @@ });

@@ -133,3 +133,3 @@ // Load modules

settings.validateFunc(session, function (err, isValid, credentials) {
settings.validateFunc(request, session, function (err, isValid, credentials) {

@@ -136,0 +136,0 @@ if (err ||

{
"name": "hapi-auth-cookie",
"description": "Cookie authentication plugin",
"version": "2.2.0",
"version": "3.0.1",
"repository": "git://github.com/hapijs/hapi-auth-cookie",
"main": "index",
"main": "lib/index.js",
"keywords": [

@@ -31,10 +31,6 @@ "hapi",

"scripts": {
"test": "make test-cov"
"test": "lab -a code -t 100 -L",
"test-cov-html": "lab -a code -r html -o coverage.html"
},
"licenses": [
{
"type": "BSD",
"url": "http://github.com/hapijs/hapi-auth-cookie/raw/master/LICENSE"
}
]
"license": "BSD-3-Clause"
}

@@ -43,4 +43,5 @@ ### hapi-auth-cookie

session cookie on each request. Used to verify that the internal session state is still valid
(e.g. user account still exists). The function has the signature `function(session, callback)`
(e.g. user account still exists). The function has the signature `function(request, session, callback)`
where:
- `request` - is the Hapi request object of the request which is being authenticated.
- `session` - is the session object set via `request.auth.session.set()`.

@@ -191,2 +192,1 @@ - `callback` - a callback function with the signature `function(err, isValid, credentials)`

```

@@ -23,2 +23,3 @@ // Load modules

describe('scheme', function () {
it('fails with no plugin options', function (done) {

@@ -28,8 +29,10 @@

server.connection();
server.register(require('../'), function(err) {
server.register(require('../'), function (err) {
expect(err).to.not.exist();
expect( function () {
expect(function () {
server.auth.strategy('default', 'cookie', true, {});
} ).to.throw(Error);
}).to.throw(Error);

@@ -44,11 +47,11 @@ done();

server.connection();
server.register(require('../'), function(err) {
server.register(require('../'), function (err) {
expect(err).to.not.exist();
expect( function () {
server.auth.strategy('default', 'cookie', true, {
password: 'password'
});
} ).to.not.throw();
expect(function () {
server.auth.strategy('default', 'cookie', true, { password: 'password' });
}).to.not.throw();
done();

@@ -62,11 +65,11 @@ });

server.connection();
server.register(require('../'), function(err) {
server.register(require('../'), function (err) {
expect(err).to.not.exist();
expect( function () {
server.auth.strategy('default', 'cookie', true, {
validateFunc: 'not a function'
});
} ).to.throw(Error);
expect(function () {
server.auth.strategy('default', 'cookie', true, { validateFunc: 'not a function' });
}).to.throw(Error);
done();

@@ -80,6 +83,8 @@ });

server.connection();
server.register(require('../'), function(err) {
server.register(require('../'), function (err) {
expect(err).to.not.exist();
expect( function () {
expect(function () {
server.auth.strategy('default', 'cookie', true, {

@@ -89,3 +94,3 @@ password: 'password',

});
} ).to.throw(Error);
}).to.throw(Error);

@@ -110,3 +115,3 @@ done();

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -193,3 +198,3 @@ var override = Hoek.clone(session);

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -227,3 +232,3 @@ var override = Hoek.clone(session);

mode: 'try',
strategies: ['default', 'simple'],
strategies: ['default', 'simple']
},

@@ -262,3 +267,3 @@ handler: function (request, reply) {

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -325,3 +330,3 @@ var override = Hoek.clone(session);

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -386,3 +391,3 @@ var override = Hoek.clone(session);

cookie: 'special',
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -500,3 +505,6 @@ var override = Hoek.clone(session);

clearInvalid: true,
validateFunc: function (session, callback) { return callback(new Error('boom')); }
validateFunc: function (request, session, callback) {
return callback(new Error('boom'));
}
});

@@ -554,3 +562,3 @@

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -603,3 +611,3 @@ var override = Hoek.clone(session);

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -662,3 +670,3 @@ return callback(null, session.user === 'valid');

clearInvalid: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -777,3 +785,3 @@ return callback(null, session.user === 'valid');

keepAlive: true,
validateFunc: function (session, callback) {
validateFunc: function (request, session, callback) {

@@ -855,4 +863,4 @@ var override = Hoek.clone(session);

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -902,2 +910,3 @@

method: 'GET', path: '/setKey', handler: function (request, reply) {
request.auth.session.set('key', 'value');

@@ -909,2 +918,3 @@ done();

server.inject('/login/steve', function (res) {
var pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/;

@@ -949,4 +959,4 @@ expect(res.result).to.equal('steve');

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -991,4 +1001,4 @@

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -1033,4 +1043,4 @@

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -1083,2 +1093,3 @@

method: 'GET', path: '/clearKey', handler: function (request, reply) {
request.auth.session.clear('key');

@@ -1090,2 +1101,3 @@ done();

server.inject('/login/steve', function (res) {
var pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/;

@@ -1130,4 +1142,4 @@ expect(res.result).to.equal('steve');

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -1172,4 +1184,4 @@

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -1214,4 +1226,4 @@

}
catch (err) {
return reply(err.message);
catch (error) {
return reply(error.message);
}

@@ -1265,2 +1277,3 @@

method: 'GET', path: '/ttl', handler: function (request, reply) {
request.auth.session.set('key', 'value');

@@ -1272,2 +1285,3 @@ done();

server.inject('/login/steve', function (res) {
var pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/;

@@ -1565,4 +1579,9 @@ expect(res.result).to.equal('steve');

server.route({ method: 'GET', path: '/', handler: function (request, reply) { return reply(); } });
server.route({
method: 'GET', path: '/', handler: function (request, reply) {
return reply();
}
});
server.inject({ url: '/', headers: { cookie: 'sid=123456' } }, function (res) {

@@ -1569,0 +1588,0 @@

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