Catalyst-Plugin-Authentication-Basic-Remote
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Basic/Remote.pm view on Meta::CPAN
if ( $c->config->{authentication}->{auth_url} ) {
if ( $c->req->header('Authorization') and my ($tokens) = ( $c->req->header('Authorization') =~ /^Basic (.+)$/) ) {
my ( $username, $password ) = split /:/, decode_base64($tokens);
$c->log->debug("Authentication via ". $c->config->{authentication}->{auth_url} );
$c->log->debug("user: $username");
$c->log->debug("pass: $password");
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new( HEAD => $c->config->{authentication}->{auth_url} );
$req->header( 'Authorization' => $c->req->header('Authorization') );
my $res = $ua->request($req);
if ( $res->code ne '401' ) {
$c->log->debug("Authorization successful.");
$c->req->{user} = $username;
$c->session->{user} = $username;
$c->req->{password} = $password;
$c->session->{password} = $password;
( run in 0.445 second using v1.01-cache-2.11-cpan-de7293f3b23 )