[Catalyst] Legacy porting to auto-authenticate a logged in user

Peter Edwards peter at dragonstaff.com
Sun Dec 23 17:37:14 GMT 2007


Oh well, worth a shot.
I had a similar problem and ended up in the bowels of the auth code with the
perl debugger to try and figure out the correct params. I also wanted to be
able to hook up to a legacy passwd db and it was a bit tricky to get it
working.
If you want to try this, stick a
  $DB::single = 1;
in your site_perl library Catalyst/Plugin/Authentication.pm in sub
authenticate()
and then run the test server with perl -d scripts/myapp_server.pl.
Use your web browser to try and login, and in the debugger step into the
auth handling to see what is going on.
There's a page I wrote on using the perl debugger with Catalyst that may
help: http://dev.catalyst.perl.org/wiki/DebugSample


Regards, Peter
http://perl.dragonstaff.co.uk


-----Original Message-----
From: Ashley Pond V [mailto:apv at sedition.com] 
Sent: 23 December 2007 17:11
To: The elegant MVC web framework
Subject: Re: [Catalyst] Legacy porting to auto-authenticate a logged in user

Thanks for the idea. Didn't work. After following the code trail back  
through a few namespaces and lots of config v class_data v .... eyes  
glaze over, I fixed it by setting the password_type to "none" and  
merely authenticating on the "username."

This is fine in this case but it's obviously less than ideal. If  
anyone has insight into what I'm doing wrong with my original  
version, I'd love to hear it.

WORKING VERSION (username isn't guaranteed unique so I went with the  
Id instead):

   $c->authenticate({ acctid => $user->acctid })
        or die "RC_403: " . $user->username . ": " . $user->acctid .  
" failed to authenticate";

  authentication:
    default_realm: users
    realms:
      users:
        credential:
          class: Password
          password_type: none
#        password_hash_type: SHA-1
#        password_field: crypt_passwd
       store:
         class: DBIx::Class
         user_class: DB::User
         id_field: acctid


On Dec 22, 2007, at 3:44 AM, Peter Edwards wrote:

> Try
>
>     $c->authenticate({ acctid => $user->username,
>                        password => $user->password })
>         or die "RC_403: " . $user->username . " failed to  
> authenticate";
>





More information about the Catalyst mailing list