Hi all,
Been a while. I've been banging my head for ages and can't work out why changing the following makes prove fail
[http://cpansearch.perl.org/src/BOBTFISH/Catalyst-Plugin-Authenticatio
+n-0.10018/lib/Catalyst/Authentication/Realm/Progressive.pm]
if ( my $obj = $realm->authenticate( $c, $auth ) ) {
$c->set_authenticated( $obj, $realm->name );
return $obj;
}
Changes:
139 my $auth_obj;
140 my $error = try {
141 $auth_obj = $realm->authenticate( $c, $auth );
142 }
143 catch { return $_; };
144
145 if ($auth_obj) {
146 $c->set_authenticated( $auth_obj, $realm->name );
147 return $auth_obj;
148 }
[ghenry@dax-xen Catalyst-Plugin-Authentication]$ cat t/live_app_realms
+_progressive.t
use strict;
use warnings;
use Test::More;
use lib 't/lib';
use Catalyst::Test qw/AuthRealmTestAppProgressive/;
ok(get("/progressive"), "get ok");
done_testing;
[ghenry@dax-xen Catalyst-Plugin-Authentication]$ cat t/lib/AuthRealmTe
+stAppProgressive/Controller/Root.pm
package AuthRealmTestAppProgressive::Controller::Root;
use warnings;
use strict;
use base qw/Catalyst::Controller/;
__PACKAGE__->config(namespace => '');
use Test::More;
use Test::Exception;
sub progressive : Local {
my ( $self, $c ) = @_;
foreach my $realm ( keys %AuthRealmTestAppProgressive::members ) {
while ( my ( $user, $info ) = each %{$AuthRealmTestAppProgress
+ive::members{$realm}} ) {
my $ok = eval {
$c->authenticate(
{ username => $user, password => $info->{password}
+ },
);
};
diag $@;
diag $ok;
ok( !$@, "authentication passed." );
ok( $ok, "user authenticated" );
ok( $c->user_in_realm($realm), "user in proper realm" );
}
}
$c->res->body( "ok" );
}
1;
[ghenry@dax-xen Catalyst-Plugin-Authentication]$ prove -l t/live_app_r
+ealms_progressive.t
t/live_app_realms_progressive.t .. #
# undef
t/live_app_realms_progressive.t .. 1/?
# Failed test 'user authenticated'
# at t/lib/AuthRealmTestAppProgressive/Controller/Root.pm line 24.
# Failed test 'user in proper realm'
# at t/lib/AuthRealmTestAppProgressive/Controller/Root.pm line 25.
#
# undef
# Failed test 'user authenticated'
# at t/lib/AuthRealmTestAppProgressive/Controller/Root.pm line 24.
# Looks like you failed 3 tests of 7.
t/live_app_realms_progressive.t .. Dubious, test returned 3 (wstat 768
+, 0x300)
Failed 3/7 subtests
Test Summary Report
-------------------
t/live_app_realms_progressive.t (Wstat: 768 Tests: 7 Failed: 3)
Failed tests: 2-3, 5
Non-zero exit status: 3
Files=1, Tests=7, 7 wallclock secs ( 0.09 usr 0.00 sys + 4.14 cusr
+ 0.09 csys = 4.32 CPU)
Result: FAIL
I'm trying to patch Catalyst::Authentication::Realm::Progressive to allow multiple realms with Basic HTTP auth, as the credential HTTP plugin calls ->detach which means other realms never get tried.
Thanks.
Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!