0.1.0 • Published 12 years ago
cabrel-crumb v0.1.0

CSRF crumb generation for hapi
Options
- optionsis 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 callrequest.plugins.crumb.generate()manually
 
- If set to 
- 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');
  }
});0.1.0
12 years ago
