Commit | Line | Data |
d055ce0c |
1 | package AuthRealmTestAppProgressive::Controller::Root; |
2 | use warnings; |
3 | use strict; |
4 | use base qw/Catalyst::Controller/; |
5 | |
3a311407 |
6 | __PACKAGE__->config( namespace => '' ); |
d055ce0c |
7 | |
8 | use Test::More; |
9 | use Test::Exception; |
10 | |
11 | sub progressive : Local { |
fb90f091 |
12 | my ( $self, $c ) = @_; |
d055ce0c |
13 | |
14 | foreach my $realm ( keys %AuthRealmTestAppProgressive::members ) { |
3a311407 |
15 | while ( my ( $user, $info ) = |
16 | each %{ $AuthRealmTestAppProgressive::members{$realm} } ) |
17 | { |
18 | my $res; |
d055ce0c |
19 | my $ok = eval { |
3a311407 |
20 | $res = $c->authenticate( |
d055ce0c |
21 | { username => $user, password => $info->{password} }, |
3a311407 |
22 | ); |
23 | 1; |
d055ce0c |
24 | }; |
3a311407 |
25 | ok( !$@, "authentication passed." ); |
26 | ok( $ok, "user authenticated" ); |
d055ce0c |
27 | ok( $c->user_in_realm($realm), "user in proper realm" ); |
28 | } |
29 | } |
3a311407 |
30 | $c->res->body("ok"); |
d055ce0c |
31 | } |
32 | |
05e98f5f |
33 | sub progressive_detach : Local { |
34 | my ( $self, $c ) = @_; |
35 | |
36 | my $realm = $AuthRealmTestAppProgressive::detach_test_info->{realm_to_pass}; |
37 | my $user = $AuthRealmTestAppProgressive::detach_test_info->{user}; |
38 | my $pass = $AuthRealmTestAppProgressive::detach_test_info->{password}; |
39 | my $res; |
40 | my $ok = eval { |
41 | $res = $c->authenticate( { username => $user, password => $pass }, ); |
42 | 1; |
43 | }; |
44 | ok( !$@, "authentication passed skipping detach." ); |
45 | ok( $ok, "user authenticated skipping detach" ); |
46 | ok( $c->user_in_realm($realm), "user in proper realm" ); |
47 | $c->res->body("ok"); |
48 | } |
d055ce0c |
49 | 1; |
50 | |