[Catalyst] how to authenticate using database users

Tomas Doran bobtfish at bobtfish.net
Fri Mar 20 11:03:14 GMT 2009


Karl Forner wrote:
> 2) write a custom Authentication plugin, the your specific code is in 
> _authenticate_against_SGDB
>
> package Serono::Gecko::Business::CredentialVerifier;
>
> use Catalyst::Plugin::Authentication::User::Hash;
>
> sub authenticate {
>     my ( $self, $c, $realm, $authinfo ) = @_;
<snip>

You know Catalyst::Plugin::Authentication::User::Hash is a deprecated 
compatibility shim, right? And that you shouldn't be writing 
authentication plugins (i.e. auth plugins as Catalyst plugins are 
deprecated)

You seem to be confused by old auth (where the auth credential and store 
were plugins, and therefore composed onto MyApp's @ISA), and new auth 
(where the auth credential, realm and store are separate instances, and 
not part of MyApp.

Your credential should be an instance, and should be sub authenticate { 
my ( $self, $authinfo, $c ) = @_;

> 3) configure it through the catalyst config file
>
> <authentication>
<snip>
>
> </authentication>
>
This is a config for new style auth..

Other than this confusion, this seems like a totally reasonable 
approach, and could / should be a reuseable and generic solution.

I'd be happy to help you get this to CPANable if you'd like to/you're 
able to volunteer. :_)

Cheers
t0m




More information about the Catalyst mailing list