=head1 NAME

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

=head1 SYNOPSIS

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

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

=head1 DESCRIPTION

L<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 L<Mojolicious::Plugin::RemoteAddr>, so please check "order" option.

=head1 CONFIG

=head2 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 );
  });

=head1 SEE ALSO

L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.

=cut