The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::BindSessionToIP - Binds your Mojolicious session to IP-address for better security of your application

SYNOPSIS

  # Mojolicious
  $self->plugin('RemoteAddr'); # For getting remote ip address
  $self->plugin('BindSessionToIP');

  # Mojolicious::Lite
  plugin 'RemoteAddr';
  plugin 'BindSessionToIP';

DESCRIPTION

Mojolicious::Plugin::BindSessionToIP binds your Mojolicious session to IP-address for better security of your application. If client IP was changed then the plugin will clean client's sessions and will redirect to '/'. It uses Mojolicious::Plugin::RemoteAddr, so please check "order" option.

CONFIG

on_error

You can pass custom error handling callback. For example

  $self->plugin('BindSessionToIP', on_error => sub {
      my $c = shift;
      $c->render(template => 'wrong_session', status => 403 );
  });

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.