[Catalyst] Remote authN not getting username from remote_user()
    Trevor Leffler 
    tleffler at uw.edu
       
    Wed Sep 22 23:40:53 GMT 2010
    
    
  
Hi, I'm using:
Catalyst::Runtime -- 5.80022
Catalyst::Plugin::Authentication -- 0.10016
I'm finding that C::Request->remote_user is not returning my username 
when I have authenticated under apache, whereas the deprecated 
C::R->user does.
This means that C::AuthN::Cred::Remote->authenticate fails under "option 
2" -- elsif ($c->req->can('remote_user')) {...} -- since yes, it can(), 
but alas 'undef' is the return value.
I'm unclear on how C::Request->remote_user is populated, or maybe I'd 
have figured out what's [not] going on here.
Any pointers, hints, perl packages that may need an upgrade, etc?
Thanks,
--Trevor
FWIW, here are relevant snippets from my App.pm and App::C::Root:
__PACKAGE__->config(
   name => 'App',
   'Plugin::Authentication' => {
     default_realm => 'remoterealm',
     realms => {
       remoterealm => {
         credential => {
           class        => 'Remote',
         },
         store => {class => 'Null',},
       },
     },
   },
);
sub begin : Private {
   my ($self, $c) = @_;
   my $r = $c->req;
   # returns yes, 'undef'
   warn "*** can remote_user? ", ($r->can('remote_user') ? 'yes' : 
'no'), "\n";
   my $ru = $r->remote_user;
   warn "*** remote_user: [", (defined $ru ? $ru : 'undef'), "]\n";
   # returns yes, 'tleffler'
   warn "*** can user? ", ($r->can('user') ? 'yes' : 'no'), "\n";
   my $u = $r->user;
   warn "*** user: [", (defined $u ? $u : 'undef'), "]\n";
   # returns $VAR1 = undef;
   use Data::Dumper;
   warn "*** env...", Dumper $c->engine->env;
   unless ($c->user_exists) {
     unless ($c->authenticate({})) {
       warn "*** failed authN ***\n";   # I get here
       $c->response->status(HTTP::Status::RC_FORBIDDEN());
     }
   }
}
    
    
More information about the Catalyst
mailing list