hapi-auth-cookie
Advanced tools
Comparing version 3.1.0 to 4.0.0
@@ -1,6 +0,8 @@ | ||
var Hapi = require('hapi'); | ||
'use strict'; | ||
var uuid = 1; // Use seq instead of proper unique identifiers for demo only | ||
const Hapi = require('hapi'); | ||
var users = { | ||
let uuid = 1; // Use seq instead of proper unique identifiers for demo only | ||
const users = { | ||
john: { | ||
@@ -13,3 +15,3 @@ id: 'john', | ||
var home = function (request, reply) { | ||
const home = function (request, reply) { | ||
@@ -23,3 +25,3 @@ reply('<html><head><title>Login page</title></head><body><h3>Welcome ' | ||
var login = function (request, reply) { | ||
const login = function (request, reply) { | ||
@@ -30,4 +32,4 @@ if (request.auth.isAuthenticated) { | ||
var message = ''; | ||
var account = null; | ||
let message = ''; | ||
let account = null; | ||
@@ -62,7 +64,7 @@ if (request.method === 'post') { | ||
var sid = String(++uuid); | ||
request.server.app.cache.set(sid, { account: account }, 0, function (err) { | ||
const sid = String(++uuid); | ||
request.server.app.cache.set(sid, { account: account }, 0, (err) => { | ||
if (err) { | ||
reply(err); | ||
return reply(err); | ||
} | ||
@@ -75,3 +77,3 @@ | ||
var logout = function (request, reply) { | ||
const logout = function (request, reply) { | ||
@@ -82,8 +84,12 @@ request.auth.session.clear(); | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection({ port: 8000 }); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
var cache = server.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 }); | ||
if (err) { | ||
throw err; | ||
} | ||
const cache = server.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 }); | ||
server.app.cache = cache; | ||
@@ -98,3 +104,3 @@ | ||
cache.get(session.sid, function (err, cached) { | ||
cache.get(session.sid, (err, cached) => { | ||
@@ -120,3 +126,3 @@ if (err) { | ||
server.start(function () { | ||
server.start(() => { | ||
@@ -123,0 +129,0 @@ console.log('Server ready'); |
@@ -0,10 +1,12 @@ | ||
'use strict'; | ||
// Load modules | ||
var Boom = require('boom'); | ||
var Hoek = require('hoek'); | ||
var Joi = require('joi'); | ||
const Boom = require('boom'); | ||
const Hoek = require('hoek'); | ||
const Joi = require('joi'); | ||
// Declare internals | ||
var internals = {}; | ||
const internals = {}; | ||
@@ -41,8 +43,8 @@ | ||
var results = Joi.validate(options, internals.schema); | ||
const results = Joi.validate(options, internals.schema); | ||
Hoek.assert(!results.error, results.error); | ||
var settings = results.value; | ||
const settings = results.value; | ||
var cookieOptions = { | ||
const cookieOptions = { | ||
encoding: 'iron', | ||
@@ -71,3 +73,3 @@ password: settings.password, | ||
server.ext('onPreAuth', function (request, reply) { | ||
server.ext('onPreAuth', (request, reply) => { | ||
@@ -78,3 +80,3 @@ request.auth.session = { | ||
if (arguments.length > 1) { | ||
var key = session; | ||
const key = session; | ||
Hoek.assert(key && typeof key === 'string', 'Invalid session key'); | ||
@@ -96,3 +98,3 @@ session = request.auth.artifacts; | ||
Hoek.assert(key && typeof key === 'string', 'Invalid session key'); | ||
var session = request.auth.artifacts; | ||
const session = request.auth.artifacts; | ||
Hoek.assert(session, 'No active session to clear key from'); | ||
@@ -108,3 +110,3 @@ delete session[key]; | ||
var session = request.auth.artifacts; | ||
const session = request.auth.artifacts; | ||
Hoek.assert(session, 'No active session to modify ttl on'); | ||
@@ -118,10 +120,10 @@ reply.state(settings.cookie, session, { ttl: msecs }); | ||
var scheme = { | ||
const scheme = { | ||
authenticate: function (request, reply) { | ||
var validate = function () { | ||
const validate = function () { | ||
// Check cookie | ||
var session = request.state[settings.cookie]; | ||
const session = request.state[settings.cookie]; | ||
if (!session) { | ||
@@ -139,3 +141,3 @@ return unauthenticated(Boom.unauthorized(null, 'cookie')); | ||
settings.validateFunc(request, session, function (err, isValid, credentials) { | ||
settings.validateFunc(request, session, (err, isValid, credentials) => { | ||
@@ -160,3 +162,3 @@ if (err || | ||
var unauthenticated = function (err, result) { | ||
const unauthenticated = function (err, result) { | ||
@@ -169,3 +171,3 @@ if (settings.redirectOnTry === false && // Defaults to true | ||
var redirectTo = settings.redirectTo; | ||
let redirectTo = settings.redirectTo; | ||
if (request.route.settings.plugins['hapi-auth-cookie'] && | ||
@@ -181,3 +183,3 @@ request.route.settings.plugins['hapi-auth-cookie'].redirectTo !== undefined) { | ||
var uri = redirectTo; | ||
let uri = redirectTo; | ||
if (settings.appendNext) { | ||
@@ -184,0 +186,0 @@ if (uri.indexOf('?') !== -1) { |
{ | ||
"name": "hapi-auth-cookie", | ||
"description": "Cookie authentication plugin", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"repository": "git://github.com/hapijs/hapi-auth-cookie", | ||
@@ -15,16 +15,16 @@ "main": "lib/index.js", | ||
"engines": { | ||
"node": ">=0.10.32" | ||
"node": ">=4.x.x" | ||
}, | ||
"dependencies": { | ||
"boom": "2.x.x", | ||
"hoek": "2.x.x", | ||
"joi": "6.x.x" | ||
"boom": "3.x.x", | ||
"hoek": "3.x.x", | ||
"joi": "7.x.x" | ||
}, | ||
"peerDependencies": { | ||
"hapi": ">=8.x.x" | ||
"hapi": ">=10.x.x" | ||
}, | ||
"devDependencies": { | ||
"code": "1.x.x", | ||
"hapi": "8.x.x", | ||
"lab": "5.x.x" | ||
"code": "2.x.x", | ||
"hapi": "10.x.x", | ||
"lab": "8.x.x" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
104
README.md
@@ -75,5 +75,9 @@ ### hapi-auth-cookie | ||
```javascript | ||
var Hapi = require('hapi'); | ||
'use strict'; | ||
var users = { | ||
const Hapi = require('hapi'); | ||
let uuid = 1; // Use seq instead of proper unique identifiers for demo only | ||
const users = { | ||
john: { | ||
@@ -86,3 +90,3 @@ id: 'john', | ||
var home = function (request, reply) { | ||
const home = function (request, reply) { | ||
@@ -96,3 +100,3 @@ reply('<html><head><title>Login page</title></head><body><h3>Welcome ' | ||
var login = function (request, reply) { | ||
const login = function (request, reply) { | ||
@@ -103,4 +107,4 @@ if (request.auth.isAuthenticated) { | ||
var message = ''; | ||
var account = null; | ||
let message = ''; | ||
let account = null; | ||
@@ -135,7 +139,15 @@ if (request.method === 'post') { | ||
request.auth.session.set(account); | ||
return reply.redirect('/'); | ||
const sid = String(++uuid); | ||
request.server.app.cache.set(sid, { account: account }, 0, (err) => { | ||
if (err) { | ||
reply(err); | ||
} | ||
request.auth.session.set({ sid: sid }); | ||
return reply.redirect('/'); | ||
}); | ||
}; | ||
var logout = function (request, reply) { | ||
const logout = function (request, reply) { | ||
@@ -146,51 +158,47 @@ request.auth.session.clear(); | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection({ port: 8000 }); | ||
server.register(require('hapi-auth-cookie'), function (err) { | ||
server.register(require('../'), (err) => { | ||
server.auth.strategy('session', 'cookie', { | ||
if (err) { | ||
throw err; | ||
} | ||
const cache = server.cache({ segment: 'sessions', expiresIn: 3 * 24 * 60 * 60 * 1000 }); | ||
server.app.cache = cache; | ||
server.auth.strategy('session', 'cookie', true, { | ||
password: 'secret', | ||
cookie: 'sid-example', | ||
redirectTo: '/login', | ||
isSecure: false | ||
}); | ||
}); | ||
isSecure: false, | ||
validateFunc: function (request, session, callback) { | ||
server.route([ | ||
{ | ||
method: 'GET', | ||
path: '/', | ||
config: { | ||
handler: home, | ||
auth: 'session' | ||
} | ||
}, | ||
{ | ||
method: ['GET', 'POST'], | ||
path: '/login', | ||
config: { | ||
handler: login, | ||
auth: { | ||
mode: 'try', | ||
strategy: 'session' | ||
}, | ||
plugins: { | ||
'hapi-auth-cookie': { | ||
redirectTo: false | ||
cache.get(session.sid, (err, cached) => { | ||
if (err) { | ||
return callback(err, false); | ||
} | ||
} | ||
if (!cached) { | ||
return callback(null, false); | ||
} | ||
return callback(null, true, cached.account); | ||
}); | ||
} | ||
}, | ||
{ | ||
method: 'GET', | ||
path: '/logout', | ||
config: { | ||
handler: logout, | ||
auth: 'session' | ||
} | ||
} | ||
]); | ||
}); | ||
server.start(); | ||
server.route([ | ||
{ method: 'GET', path: '/', config: { handler: home } }, | ||
{ method: ['GET', 'POST'], path: '/login', config: { handler: login, auth: { mode: 'try' }, plugins: { 'hapi-auth-cookie': { redirectTo: false } } } }, | ||
{ method: 'GET', path: '/logout', config: { handler: logout } } | ||
]); | ||
server.start(() => { | ||
console.log('Server ready'); | ||
}); | ||
}); | ||
``` |
@@ -0,7 +1,9 @@ | ||
'use strict'; | ||
// Load modules | ||
var Code = require('code'); | ||
var Hapi = require('hapi'); | ||
var Hoek = require('hoek'); | ||
var Lab = require('lab'); | ||
const Code = require('code'); | ||
const Hapi = require('hapi'); | ||
const Hoek = require('hoek'); | ||
const Lab = require('lab'); | ||
@@ -11,3 +13,3 @@ | ||
var internals = {}; | ||
const internals = {}; | ||
@@ -17,19 +19,19 @@ | ||
var lab = exports.lab = Lab.script(); | ||
var describe = lab.describe; | ||
var it = lab.it; | ||
var expect = Code.expect; | ||
const lab = exports.lab = Lab.script(); | ||
const describe = lab.describe; | ||
const it = lab.it; | ||
const expect = Code.expect; | ||
describe('scheme', function () { | ||
describe('scheme', () => { | ||
it('fails with no plugin options', function (done) { | ||
it('fails with no plugin options', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
expect(err).to.not.exist(); | ||
expect(function () { | ||
expect(() => { | ||
@@ -43,11 +45,11 @@ server.auth.strategy('default', 'cookie', true, {}); | ||
it('passes with a password configured', function (done) { | ||
it('passes with a password configured', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
expect(err).to.not.exist(); | ||
expect(function () { | ||
expect(() => { | ||
@@ -61,11 +63,11 @@ server.auth.strategy('default', 'cookie', true, { password: 'password' }); | ||
it('passes with a password configured which is a Buffer', function (done) { | ||
it('passes with a password configured which is a Buffer', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
expect(err).to.not.exist(); | ||
expect(function () { | ||
expect(() => { | ||
@@ -79,11 +81,11 @@ server.auth.strategy('default', 'cookie', true, { password: new Buffer('foobar') }); | ||
it('fails if validateFunc is not a function', function (done) { | ||
it('fails if validateFunc is not a function', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
expect(err).to.not.exist(); | ||
expect(function () { | ||
expect(() => { | ||
@@ -97,11 +99,11 @@ server.auth.strategy('default', 'cookie', true, { validateFunc: 'not a function' }); | ||
it('fails if keepAlive is configured but not ttl', function (done) { | ||
it('fails if keepAlive is configured but not ttl', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
expect(err).to.not.exist(); | ||
expect(function () { | ||
expect(() => { | ||
@@ -118,7 +120,7 @@ server.auth.strategy('default', 'cookie', true, { | ||
it('authenticates a request', function (done) { | ||
it('authenticates a request', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -135,3 +137,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -163,16 +165,16 @@ | ||
server.inject('/login/valid', function (res) { | ||
server.inject('/login/valid', (res) => { | ||
expect(res.result).to.equal('valid'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.headers['set-cookie']).to.not.exist(); | ||
expect(res.result).to.equal('resource'); | ||
expect(res2.statusCode).to.equal(200); | ||
expect(res2.headers['set-cookie']).to.not.exist(); | ||
expect(res2.result).to.equal('resource'); | ||
done(); | ||
@@ -185,7 +187,7 @@ }); | ||
it('fails over to another strategy if not present', function (done) { | ||
it('fails over to another strategy if not present', (done) => { | ||
var extraSchemePlugin = function (plugin, options, next) { | ||
const extraSchemePlugin = function (plugin, options, next) { | ||
var simpleTestSchema = function () { | ||
const simpleTestSchema = function () { | ||
@@ -208,5 +210,5 @@ return { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -223,3 +225,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -243,3 +245,3 @@ | ||
server.register(extraSchemePlugin, function (err) { | ||
server.register(extraSchemePlugin, (err) => { | ||
@@ -260,3 +262,3 @@ expect(err).to.not.exist(); | ||
var credentialsTest = (request.auth.credentials && request.auth.credentials.test) || 'NOT AUTH'; | ||
const credentialsTest = (request.auth.credentials && request.auth.credentials.test) || 'NOT AUTH'; | ||
return reply('multiple ' + credentialsTest); | ||
@@ -267,3 +269,3 @@ } | ||
server.inject('/multiple', function (res) { | ||
server.inject('/multiple', (res) => { | ||
@@ -278,7 +280,7 @@ expect(res.statusCode).to.equal(200); | ||
it('ends a session', function (done) { | ||
it('ends a session', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -295,3 +297,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -323,16 +325,16 @@ | ||
server.inject('/login/valid', function (res) { | ||
server.inject('/login/valid', (res) => { | ||
expect(res.result).to.equal('valid'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/logout', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/logout', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.equal('logged-out'); | ||
expect(res.headers['set-cookie'][0]).to.equal('special=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; Domain=example.com; Path=/'); | ||
expect(res2.statusCode).to.equal(200); | ||
expect(res2.result).to.equal('logged-out'); | ||
expect(res2.headers['set-cookie'][0]).to.equal('special=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; Domain=example.com; Path=/'); | ||
done(); | ||
@@ -345,7 +347,7 @@ }); | ||
it('fails a request with invalid session', function (done) { | ||
it('fails a request with invalid session', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -362,3 +364,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -390,15 +392,15 @@ | ||
server.inject('/login/invalid', function (res) { | ||
server.inject('/login/invalid', (res) => { | ||
expect(res.result).to.equal('invalid'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.headers['set-cookie'][0]).to.equal('special=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; Domain=example.com; Path=/'); | ||
expect(res.statusCode).to.equal(401); | ||
expect(res2.headers['set-cookie'][0]).to.equal('special=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; Domain=example.com; Path=/'); | ||
expect(res2.statusCode).to.equal(401); | ||
done(); | ||
@@ -411,7 +413,7 @@ }); | ||
it('does not clear a request with invalid session (clearInvalid not set)', function (done) { | ||
it('does not clear a request with invalid session (clearInvalid not set)', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -427,3 +429,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -455,15 +457,15 @@ | ||
server.inject('/login/invalid', function (res) { | ||
server.inject('/login/invalid', (res) => { | ||
expect(res.result).to.equal('invalid'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.headers['set-cookie']).to.not.exist(); | ||
expect(res.statusCode).to.equal(401); | ||
expect(res2.headers['set-cookie']).to.not.exist(); | ||
expect(res2.statusCode).to.equal(401); | ||
done(); | ||
@@ -476,7 +478,7 @@ }); | ||
it('logs in and authenticates a request', function (done) { | ||
it('logs in and authenticates a request', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -512,15 +514,15 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
expect(res.result).to.equal('steve'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.equal('resource'); | ||
expect(res2.statusCode).to.equal(200); | ||
expect(res2.result).to.equal('resource'); | ||
done(); | ||
@@ -533,7 +535,7 @@ }); | ||
it('errors in validation function', function (done) { | ||
it('errors in validation function', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -574,13 +576,13 @@ expect(err).to.not.exist(); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
expect(res.result).to.equal('steve'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const 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) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(401); | ||
expect(res2.statusCode).to.equal(401); | ||
done(); | ||
@@ -593,7 +595,7 @@ }); | ||
it('authenticates a request (no ttl)', function (done) { | ||
it('authenticates a request (no ttl)', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -609,3 +611,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -629,9 +631,8 @@ | ||
server.inject('/login/valid', function (res) { | ||
server.inject('/login/valid', (res) => { | ||
expect(res.result).to.equal('valid'); | ||
var header = res.headers['set-cookie']; | ||
const header = res.headers['set-cookie']; | ||
expect(header.length).to.equal(1); | ||
expect(header[0]).to.not.contain('Max-Age'); | ||
var cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
done(); | ||
@@ -642,7 +643,7 @@ }); | ||
it('authenticates a request (no session override)', function (done) { | ||
it('authenticates a request (no session override)', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -683,15 +684,15 @@ expect(err).to.not.exist(); | ||
server.inject('/login/valid', function (res) { | ||
server.inject('/login/valid', (res) => { | ||
expect(res.result).to.equal('valid'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.equal('resource'); | ||
expect(res2.statusCode).to.equal(200); | ||
expect(res2.result).to.equal('resource'); | ||
done(); | ||
@@ -704,7 +705,7 @@ }); | ||
it('authenticates a request (no session override) on a sub-path', function (done) { | ||
it('authenticates a request (no session override) on a sub-path', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -745,16 +746,16 @@ expect(err).to.not.exist(); | ||
server.inject('/subpath/login/valid', function (res) { | ||
server.inject('/subpath/login/valid', (res) => { | ||
expect(res.result).to.equal('valid'); | ||
var header = res.headers['set-cookie']; | ||
const 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
expect(header[0]).to.contain('Path=/subpath'); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/subpath/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/subpath/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.equal('resource'); | ||
expect(res2.statusCode).to.equal(200); | ||
expect(res2.result).to.equal('resource'); | ||
done(); | ||
@@ -767,7 +768,7 @@ }); | ||
it('extends ttl automatically', function (done) { | ||
it('extends ttl automatically', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -804,14 +805,14 @@ expect(err).to.not.exist(); | ||
server.inject('/login/valid', function (res) { | ||
server.inject('/login/valid', (res) => { | ||
var header = res.headers['set-cookie']; | ||
let 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
var header = res.headers['set-cookie']; | ||
expect(res2.statusCode).to.equal(200); | ||
header = res2.headers['set-cookie']; | ||
expect(header.length).to.equal(1); | ||
@@ -826,7 +827,7 @@ expect(header[0]).to.contain('Max-Age=60'); | ||
it('extends ttl automatically (validateFunc)', function (done) { | ||
it('extends ttl automatically (validateFunc)', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -844,3 +845,3 @@ expect(err).to.not.exist(); | ||
var override = Hoek.clone(session); | ||
const override = Hoek.clone(session); | ||
override.something = 'new'; | ||
@@ -872,17 +873,17 @@ | ||
server.inject('/login/valid', function (res) { | ||
server.inject('/login/valid', (res) => { | ||
expect(res.result).to.equal('valid'); | ||
var header = res.headers['set-cookie']; | ||
let 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]*))/); | ||
const cookie = header[0].match(/(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/resource', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.equal('resource'); | ||
expect(res2.statusCode).to.equal(200); | ||
expect(res2.result).to.equal('resource'); | ||
var header = res.headers['set-cookie']; | ||
header = res2.headers['set-cookie']; | ||
expect(header.length).to.equal(1); | ||
@@ -897,9 +898,9 @@ expect(header[0]).to.contain('Max-Age=60'); | ||
describe('set()', function () { | ||
describe('set()', () => { | ||
it('errors on missing session in set()', function (done) { | ||
it('errors on missing session in set()', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -933,3 +934,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -942,7 +943,7 @@ expect(res.result).to.equal('Invalid session'); | ||
it('sets individual cookie key', function (done) { | ||
it('sets individual cookie key', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -978,15 +979,15 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
var pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/; | ||
const pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/; | ||
expect(res.result).to.equal('steve'); | ||
var header = res.headers['set-cookie']; | ||
const header = res.headers['set-cookie']; | ||
expect(header.length).to.equal(1); | ||
expect(header[0]).to.contain('Max-Age=60'); | ||
var cookie = header[0].match(pattern); | ||
const cookie = header[0].match(pattern); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/setKey', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/setKey', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res2.statusCode).to.equal(200); | ||
}); | ||
@@ -998,7 +999,7 @@ /* eslint-enable hapi/no-shadow-relaxed */ | ||
it('throws on missing session when trying to set key', function (done) { | ||
it('throws on missing session when trying to set key', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1032,3 +1033,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -1041,7 +1042,7 @@ expect(res.result).to.equal('No active session to apply key to'); | ||
it('throws when trying to set key with invalid input', function (done) { | ||
it('throws when trying to set key with invalid input', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1075,3 +1076,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -1084,7 +1085,7 @@ expect(res.result).to.equal('Invalid session key'); | ||
it('throws when trying to set key with null key', function (done) { | ||
it('throws when trying to set key with null key', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1118,3 +1119,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -1128,9 +1129,9 @@ expect(res.result).to.equal('Invalid session key'); | ||
describe('clear()', function () { | ||
describe('clear()', () => { | ||
it('clear a specific session key', function (done) { | ||
it('clear a specific session key', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1166,15 +1167,15 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
var pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/; | ||
const pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/; | ||
expect(res.result).to.equal('steve'); | ||
var header = res.headers['set-cookie']; | ||
const header = res.headers['set-cookie']; | ||
expect(header.length).to.equal(1); | ||
expect(header[0]).to.contain('Max-Age=60'); | ||
var cookie = header[0].match(pattern); | ||
const cookie = header[0].match(pattern); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/clearKey', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/clearKey', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res2.statusCode).to.equal(200); | ||
}); | ||
@@ -1186,7 +1187,7 @@ /* eslint-enable hapi/no-shadow-relaxed */ | ||
it('throws when trying to clear a key on missing session', function (done) { | ||
it('throws when trying to clear a key on missing session', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1220,3 +1221,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -1229,7 +1230,7 @@ expect(res.result).to.equal('No active session to clear key from'); | ||
it('throws when trying to clear a key with invalid input', function (done) { | ||
it('throws when trying to clear a key with invalid input', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1263,3 +1264,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -1272,7 +1273,7 @@ expect(res.result).to.equal('Invalid session key'); | ||
it('throws when trying to clear a key with null input', function (done) { | ||
it('throws when trying to clear a key with null input', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1306,3 +1307,3 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
@@ -1316,9 +1317,9 @@ expect(res.result).to.equal('Invalid session key'); | ||
describe('ttl()', function () { | ||
describe('ttl()', () => { | ||
it('overrides ttl', function (done) { | ||
it('overrides ttl', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1355,15 +1356,15 @@ expect(err).to.not.exist(); | ||
server.inject('/login/steve', function (res) { | ||
server.inject('/login/steve', (res) => { | ||
var pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/; | ||
const pattern = /(?:[^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)\s*=\s*(?:([^\x00-\x20\"\,\;\\\x7F]*))/; | ||
expect(res.result).to.equal('steve'); | ||
var header = res.headers['set-cookie']; | ||
const header = res.headers['set-cookie']; | ||
expect(header.length).to.equal(1); | ||
expect(header[0]).to.contain('Max-Age=60'); | ||
var cookie = header[0].match(pattern); | ||
const cookie = header[0].match(pattern); | ||
/* eslint-disable hapi/no-shadow-relaxed */ | ||
server.inject({ method: 'GET', url: '/ttl', headers: { cookie: 'special=' + cookie[1] } }, function (res) { | ||
server.inject({ method: 'GET', url: '/ttl', headers: { cookie: 'special=' + cookie[1] } }, (res2) => { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res2.statusCode).to.equal(200); | ||
}); | ||
@@ -1376,9 +1377,9 @@ /* eslint-enable hapi/no-shadow-relaxed */ | ||
describe('redirection', function () { | ||
describe('redirection', () => { | ||
it('sends to login page (uri without query)', function (done) { | ||
it('sends to login page (uri without query)', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1401,3 +1402,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1411,7 +1412,7 @@ expect(res.statusCode).to.equal(302); | ||
it('skips when redirectTo is set to false', function (done) { | ||
it('skips when redirectTo is set to false', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1436,3 +1437,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1445,7 +1446,7 @@ expect(res.statusCode).to.equal(401); | ||
it('skips when route override', function (done) { | ||
it('skips when route override', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1477,3 +1478,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1486,7 +1487,7 @@ expect(res.statusCode).to.equal(401); | ||
it('skips when redirectOnTry is false in try mode', function (done) { | ||
it('skips when redirectOnTry is false in try mode', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1512,3 +1513,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1522,7 +1523,7 @@ expect(res.statusCode).to.equal(200); | ||
it('sends to login page (uri with query)', function (done) { | ||
it('sends to login page (uri with query)', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1545,3 +1546,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1555,7 +1556,7 @@ expect(res.statusCode).to.equal(302); | ||
it('sends to login page and does not append the next query when appendNext is false', function (done) { | ||
it('sends to login page and does not append the next query when appendNext is false', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1578,3 +1579,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1588,7 +1589,7 @@ expect(res.statusCode).to.equal(302); | ||
it('appends the custom query when appendNext is string', function (done) { | ||
it('appends the custom query when appendNext is string', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1611,3 +1612,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1621,7 +1622,7 @@ expect(res.statusCode).to.equal(302); | ||
it('redirect on try', function (done) { | ||
it('redirect on try', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1644,3 +1645,3 @@ expect(err).to.not.exist(); | ||
server.inject('/', function (res) { | ||
server.inject('/', (res) => { | ||
@@ -1654,7 +1655,7 @@ expect(res.statusCode).to.equal(302); | ||
it('clear cookie on invalid', function (done) { | ||
it('clear cookie on invalid', (done) => { | ||
var server = new Hapi.Server(); | ||
const server = new Hapi.Server(); | ||
server.connection(); | ||
server.register(require('../'), function (err) { | ||
server.register(require('../'), (err) => { | ||
@@ -1676,3 +1677,3 @@ expect(err).to.not.exist(); | ||
server.inject({ url: '/', headers: { cookie: 'sid=123456' } }, function (res) { | ||
server.inject({ url: '/', headers: { cookie: 'sid=123456' } }, (res) => { | ||
@@ -1679,0 +1680,0 @@ expect(res.statusCode).to.equal(401); |
Sorry, the diff of this file is not supported yet
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
1464
199
74212
+ Addedboom@3.2.2(transitive)
+ Addedhoek@3.0.44.3.1(transitive)
+ Addedisemail@2.2.1(transitive)
+ Addedjoi@7.3.0(transitive)
+ Addedtopo@2.1.1(transitive)
- Removedboom@2.10.1(transitive)
- Removedhoek@2.16.3(transitive)
- Removedisemail@1.2.0(transitive)
- Removedjoi@6.10.1(transitive)
- Removedtopo@1.1.0(transitive)
Updatedboom@3.x.x
Updatedhoek@3.x.x
Updatedjoi@7.x.x