Commit | Line | Data |
692dcea4 |
1 | package AuthRealmTestAppCompat; |
2 | use warnings; |
3 | use strict; |
4 | |
5 | ### using A::Store::minimal with new style realms |
6 | ### makes the app blow up, since c::p::a::s::minimal |
7 | ### isa c:a::s::minimal, and it's compat setup() gets |
8 | ### run, with an unexpected config has (realms on top, |
9 | ### not users). This tests makes sure the app no longer |
10 | ### blows up when this happens. |
11 | use Catalyst qw/ |
12 | Authentication |
13 | Authentication::Store::Minimal |
14 | /; |
15 | |
16 | use Test::More; |
17 | use Test::Exception; |
18 | |
19 | our $members = { |
20 | bob => { |
21 | password => "s00p3r" |
22 | }, |
23 | }; |
24 | |
25 | sub moose : Local { |
26 | my ( $self, $c ) = @_; |
27 | |
28 | while ( my ($user, $info) = each %$members ) { |
29 | |
30 | my $ok = eval { |
31 | $c->authenticate( |
32 | { username => $user, password => $info->{password} }, |
33 | 'members' |
34 | ), |
35 | }; |
36 | |
37 | ok( !$@, "Test did not die: $@" ); |
38 | ok( $ok, "user $user authentication" ); |
39 | } |
40 | |
41 | $c->res->body( "ok" ); |
42 | } |
43 | |
44 | __PACKAGE__->config->{'Plugin::Authentication'} = { |
45 | default_realm => 'members', |
692dcea4 |
46 | members => { |
47 | credential => { |
48 | class => 'Password', |
49 | password_field => 'password', |
50 | password_type => 'clear' |
51 | }, |
52 | store => { |
53 | class => 'Minimal', |
54 | users => $members, |
55 | } |
56 | }, |
bf4d93a4 |
57 | |
692dcea4 |
58 | }; |
59 | |
60 | __PACKAGE__->setup; |