6 use Test::More 'no_plan';
12 Authentication::Store::Minimal
13 Authentication::Credential::Password
19 use Digest::MD5 qw/md5/;
24 my ( $self, $c ) = @_;
26 ok(!$c->user, "no user");
27 ok($c->login( "foo", "s3cr3t" ), "can login with clear");
28 is( $c->user, $users->{foo}, "user object is in proper place");
30 ok( !$c->user->roles, "no roles for foo" );
31 my @new = qw/foo bar gorch/;
32 $c->user->roles( @new );
33 is_deeply( [ $c->user->roles ], \@new, "roles set as array");
36 ok(!$c->user, "no more user, after logout");
39 ok($c->login( "bar", "s3cr3t" ), "can login with crypted");
40 is( $c->user, $users->{bar}, "user object is in proper place");
43 ok($c->login("gorch", "s3cr3t"), "can login with hashed");
44 is( $c->user, $users->{gorch}, "user object is in proper place");
47 ok(!$c->login( "bar", "bad pass" ), "can't login with bad password");
48 ok(!$c->user, "no user");
50 throws_ok { $c->login( "baz", "foo" ) } qr/support.*mechanism/, "can't login without any supported mech";
55 __PACKAGE__->config->{authentication}{users} = $users = {
60 crypted_password => crypt("s3cr3t", "x8"),
63 hashed_password => md5("s3cr3t"),
64 hash_algorithm => "MD5",
72 use Catalyst::Test qw/AuthTestApp/;