New test for credentials with detach.
[catagits/Catalyst-Plugin-Authentication.git] / t / lib / AuthRealmTestAppProgressive.pm
1 package AuthRealmTestAppProgressive;
2 use warnings;
3 use strict;
4 use base qw/Catalyst/;
5
6 ### using A::Store::minimal with new style realms
7 ### makes the app blow up, since c::p::a::s::minimal
8 ### isa c:a::s::minimal, and it's compat setup() gets
9 ### run, with an unexpected config has (realms on top,
10 ### not users). This tests makes sure the app no longer
11 ### blows up when this happens.
12 use Catalyst qw/
13     Authentication
14     Authentication::Store::Minimal
15 /;
16
17 our %members = (
18     'members' => {
19         bob => { password => "s00p3r" }
20     },
21     'other' => {
22         sally => { password => "s00p3r" }
23     },
24 );
25
26 # Matches user above so we can test against a detach and confirm
27 # it gets skipped and auths in 'members' realm
28 our $detach_test_info = {
29     'user' => 'bob',
30     'password' => 's00p3r',
31     'realm_to_pass' => 'members',
32 };
33
34 __PACKAGE__->config('Plugin::Authentication' => {
35     default_realm => 'progressive',
36     progressive => {
37         class  => 'Progressive',
38         realms => [ 'alwaysdetach', 'other', 'members' ],
39     },
40     alwaysdetach => {
41         credential => {
42             class => 'AlwaysDetach',
43         },
44         store => {
45             class => 'Minimal',
46             users => {},
47         },
48     },
49     other => {
50         credential => {
51             class => 'Password',
52             password_field => 'password',
53             password_type  => 'clear'
54         },
55         store => {
56             class => 'Minimal',
57             users => $members{other},
58         }
59     },
60     members => {
61         credential => {
62             class => 'Password',
63             password_field => 'password',
64             password_type => 'clear'
65         },
66         store => {
67             class => 'Minimal',
68             users => $members{members},
69         }
70     },
71 });
72
73 __PACKAGE__->setup;
74
75 1;
76