[Catalyst] Authentication for web services (slightly off topic)
Ian Docherty
catalyst at iandocherty.com
Wed Jan 23 22:44:07 GMT 2008
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
More information about the Catalyst
mailing list