1 package User::SessionRestoring;
2 use base qw/Catalyst::Plugin::Authentication::User::Hash/;
4 sub for_session { $_[0]->id }
5 sub store { $_[0]->{store} }
7 package AuthSessionTestApp;
11 Session::State::Cookie
14 Authentication::Store::Minimal
15 Authentication::Credential::Password
21 use Digest::MD5 qw/md5/;
26 my ( $self, $c ) = @_;
28 ok(!$c->sessionid, "no session id yet");
29 ok(!$c->user_exists, "no user exists");
30 ok(!$c->user, "no user yet");
31 ok($c->login( "foo", "s3cr3t" ), "can login with clear");
32 is( $c->user, $users->{foo}, "user object is in proper place");
36 my ( $self, $c ) = @_;
38 ok( $c->sessionid, "session ID was restored" );
39 ok( $c->user_exists, "user exists" );
40 ok( $c->user, "a user was also restored");
41 is_deeply( $c->user, $users->{foo}, "restored user is the right one (deep test - store might change identity)" );
43 $c->delete_session("bah");
46 sub fluffy_bunny : Local {
47 my ( $self, $c ) = @_;
49 ok( !$c->sessionid, "no session ID was restored");
50 ok( !$c->user, "no user was restored");
53 __PACKAGE__->config->{authentication}{users} = $users = {
54 foo => User::SessionRestoring->new(
62 $users->{foo}{store} = __PACKAGE__->default_auth_store;