1 package AuthRealmTestApp;
5 use Catalyst qw/Authentication/;
26 my ( $self, $c ) = @_;
28 ok(!$c->user, "no user");
30 while ( my ($user, $info) = each %$members ) {
34 { username => $user, password => $info->{password} },
37 "user $user authentication"
40 # check existing realms
41 ok( $c->user_in_realm('members'), "user in members realm");
42 ok(!$c->user_in_realm('admins'), "user not in admins realm");
44 # check an invalid realm
45 ok(!$c->user_in_realm('foobar'), "user not in foobar realm");
47 # check if we've got the right user
48 is( $c->user, $info, "user object is in proper place");
53 ok(!$c->user, "no more user after logout");
57 while ( my ($user, $info) = each %$admins ) {
61 { username => $user, password => $info->{password} },
64 "user $user authentication"
67 # check existing realms
68 ok(!$c->user_in_realm('members'), "user not in members realm");
69 ok( $c->user_in_realm('admins'), "user in admins realm");
71 # check an invalid realm
72 ok(!$c->user_in_realm('foobar'), "user not in foobar realm");
74 # check if we've got the right user
75 is( $c->user, $info, "user object is in proper place");
80 ok(!$c->user, "no more user after logout");
84 $c->res->body( "ok" );
87 __PACKAGE__->config->{authentication} = {
88 default_realm => 'members',
93 password_field => 'password',
94 password_type => 'clear'
104 password_field => 'password',
105 password_type => 'clear'