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 | |
33 | 1; |
34 | |