NAME
Pickles::Plugin::AntiCSRF - CSRF Block Plugin
SYNOPSIS
__PACKAGE__->load_plugins( qw(Encode AntiCSRF) );
return +{
'Plugin::AntiCSRF' => {
token_name => '_token' ,
token_length => 8
}
};
router {
connect '/' => { controller => 'Root' , action => 'index' };
connect '/commit' =>
{ controller => 'Root' , action => 'commit' },
{ method => 'POST' };
};
|
DESCRIPTION
Provides basic CSRF detection/protection.
CONTROLLING CSRF CHECK
USING THE STASH
__PACKAGE__->load_plugins( qw(Encode AntiCSRF) );
__PACKAGE__->add_trigger( init => sub {
my ( $c ) = @_ ;
if ( $c ->req->path=~m|^/api|) {
$c ->stash->{skip_csrf_check}++;
}
} );
|
USING ROUTES
connect '/api' =>
{
controller => 'Root' ,
action => 'api' ,
skip_csrf_check => 1
},
{
method => 'POST'
}
;
|