cabrel-crumb

0.1.0 • Public • Published

crumb Logo

CSRF crumb generation for hapi

Build Status

Options

  • options is an object with the following keys:
    • name - the name of the CSRF token (Default is crumb)
    • size - the length of the CSRF token (Default is 43)
    • autoGenerate - forces the plugin to generate the token on its own (Default is true)
      • If set to false, you must call request.plugins.crumb.generate() manually
    • addToViewContext - if the response is a View, adds it to the context (Default is true)
    • cookieOptions - See the options section for server.state(name, [options])
      • path - the cookie path scope. (Default is /)

Setup

var Hapi = require('hapi');

var server = Hapi.createServer('localhost', 3000);

var options = {
  name: 'myCrumb'
};

server.allow({ ext: true, state: true }).require('crumb', options, function(err) {
  if (err) {
    console.log('Failed to load plugin: crumb');
  }
});

/cabrel-crumb/

    Package Sidebar

    Install

    npm i cabrel-crumb

    Weekly Downloads

    1

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • cabrel