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

hapi-auth-cookie

Package Overview
Dependencies
Maintainers
1
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 1.0.1 to 1.0.2

8

package.json
{
"name": "hapi-auth-cookie",
"description": "Cookie authentication plugin",
"version": "1.0.1",
"version": "1.0.2",
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",

@@ -16,3 +16,3 @@ "repository": "git://github.com/spumko/hapi-auth-cookie",

"engines": {
"node": "0.10.x"
"node": ">=0.10.22"
},

@@ -24,6 +24,6 @@ "dependencies": {

"peerDependencies": {
"hapi": "2.x.x"
"hapi": ">=2.x.x"
},
"devDependencies": {
"hapi": "2.x.x",
"hapi": "3.x.x",
"lab": "1.x.x"

@@ -30,0 +30,0 @@ },

@@ -189,2 +189,55 @@ // Load modules

it('errors in validation function', function (done) {
var server = new Hapi.Server();
server.pack.require('../', function (err) {
expect(err).to.not.exist;
server.auth.strategy('default', 'cookie', {
password: 'password',
ttl: 60 * 1000,
cookie: 'special',
clearInvalid: true,
validateFunc: function (session, callback) { return callback(new Error('boom')); }
});
server.route({
method: 'GET', path: '/login/{user}',
config: {
auth: { mode: 'try' },
handler: function (request, reply) {
request.auth.session.set({ user: request.params.user });
return reply(request.params.user);
}
}
});
server.route({
method: 'GET', path: '/resource', handler: function (request, reply) {
expect(request.auth.credentials.user).to.equal('steve');
return reply('resource');
},
config: { auth: true }
});
server.inject('/login/steve', function (res) {
expect(res.result).to.equal('steve');
var header = res.headers['set-cookie'];
expect(header.length).to.equal(1);
expect(header[0]).to.contain('Max-Age=60');
var cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/);
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) {
expect(res.statusCode).to.equal(401);
done();
});
});
});
});
describe('redirection', function (done) {

@@ -191,0 +244,0 @@

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