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");
31 ok(!$c->user, "no more user, after logout");
33 ok($c->login( "bar", "s3cr3t" ), "can login with crypted");
34 is( $c->user, $users->{bar}, "user object is in proper place");
37 ok($c->login("gorch", "s3cr3t"), "can login with hashed");
38 is( $c->user, $users->{gorch}, "user object is in proper place");
41 ok(!$c->login( "bar", "bad pass" ), "can't login with bad password");
42 ok(!$c->user, "no user");
44 throws_ok { $c->login( "baz", "foo" ) } qr/support.*mechanism/, "can't login without any supported mech";
47 __PACKAGE__->config->{authentication}{users} = $users = {
52 crypted_password => crypt("s3cr3t", "x8"),
55 hashed_password => md5("s3cr3t"),
56 hash_algorithm => "MD5",
64 use Catalyst::Test qw/AuthTestApp/;