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 1.2.0 to 1.3.0

6

lib/index.js

@@ -106,2 +106,8 @@ // Load modules

if (settings.redirectOnTry === false && // Defaults to true
request.auth.mode === 'try') {
return reply(err, result);
}
var redirectTo = settings.redirectTo;

@@ -108,0 +114,0 @@ if (request.route.plugins['hapi-auth-cookie'] &&

2

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

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

@@ -26,2 +26,4 @@ <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>

parameter name `'next'`. Set to a string to use a different parameter name. Defaults to `false`.
- `redirectOnTry` - if `false` and route authentication mode is `'try'`, authentication errors will not trigger a redirection. Requires **hapi**
version 6.2.0 or newer. Defaults to `true`;
- `validateFunc` - an optional session validation function used to validate the content of the session cookie on each request. Used to verify that the

@@ -113,3 +115,3 @@ internal session state is still valid (e.g. user account still exists). The function has the signature `function(session, callback)` where:

server.pack.require('hapi-auth-cookie', function (err) {
server.pack.register(require('hapi-auth-cookie'), function (err) {

@@ -116,0 +118,0 @@ server.auth.strategy('session', 'cookie', {

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

it('authenticates a request', function (done) {
it('logs in and authenticates a request', function (done) {

@@ -512,2 +512,35 @@ var server = new Hapi.Server();

it('skips when redirectOnTry is false in try mode', function (done) {
var server = new Hapi.Server();
server.pack.register(require('../'), function (err) {
expect(err).to.not.exist;
server.auth.strategy('default', 'cookie', 'try', {
password: 'password',
ttl: 60 * 1000,
redirectOnTry: false,
redirectTo: 'http://example.com/login',
appendNext: true
});
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
return reply(request.auth.isAuthenticated);
}
});
server.inject('/', function (res) {
expect(res.statusCode).to.equal(200);
expect(res.result).to.equal(false);
done();
});
});
});
it('sends to login page (uri with query)', function (done) {

@@ -514,0 +547,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