[Catalyst] Authentication for web services (slightly off topic)

Ian Docherty catalyst at iandocherty.com
Thu Jan 24 09:23:43 GMT 2008


Problem solved with an upgrade to Test::WWW::Mechanize::Catalyst 0.41 
and Test::WWW::Mechanize 1.18

Ian Docherty wrote:
> Now this should work, but I can't make it do so. I can't read the 
> authorization username/password
>
> In my test I have
> ----------
> use strict;
> use warnings;
> use lib 't/lib';
>
> use Test::More tests => 1;
>
> my $mech = WWW::Test::Mechanize->new;
>
> $mech->credentials('admin','s3cr3t');
> $mech->get_ok("http://localhost/svc/status");
>
> ok ($mech, 'Can mechanize');
> 1;
> ----------
> In my controller I have
> ----------
> sub auto : Private {
>    my ($self, $c) = @_;
>      my ($username, $password) = $c->req->headers->authorization_basic;
>      print STDERR "Authorization [$username][$password]\n";
> }
> ----------
> Which gives the output
> ----------
> [Wed Jan 23 22:29:13 2008] 01_test.t: Use of uninitialized value in 
> concatenation (.) or string at /var/.../Controller/Svc.pm line 44.
> [Wed Jan 23 22:29:13 2008] 01_test.t: Use of uninitialized value in 
> concatenation (.) or string at /var/.../Controller/Svc.pm line 44.
> Authorization [][]
> ----------
> In other words I can't seem to get access to the username password
>
> Regards
> Ian
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: 
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>




More information about the Catalyst mailing list