0.1.0 • Published 11 years ago
cabrel-crumb v0.1.0
CSRF crumb generation for hapi
Options
options
is an object with the following keys:name
- the name of the CSRF token (Default iscrumb
)size
- the length of the CSRF token (Default is43
)autoGenerate
- forces the plugin to generate the token on its own (Default istrue
)- 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 istrue
)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
11 years ago