[Catalyst] "Catalyst::Plugin::Authentication uses NEXT, which is deprecated."

Paul Makepeace paulm at paulm.com
Mon May 10 01:25:05 GMT 2010


On Sun, May 9, 2010 at 17:07, J. Shirley <jshirley at gmail.com> wrote:
> On May 9, 2010, at 4:49 PM, Paul Makepeace wrote:
>
>> I'm puzzled with this warning since there's nothing I can see in the
>> docs of the latest version that suggests we should be using another
>> module (cf. Catalyst::Plugin::Authentication::Store::DBIC which is
>> very clear). What's the story here? What's the best course of action
>> for Catalyst authentication?
>>
>> (Yuval pointed me at another module at YAPC::NA last year but that
>> conversion got shelved & I've forgotten the details now...)
>>
>> Thanks,
>> Paul
>
> It's moderately confusing, so don't feel bad but you can certainly provide some doc patches to make it more clear.
>
> Specifically, what you are looking at is the authentication modules and not *the* authentication plugin.
>
> Catalyst::Plugin::Authentication is the right module to use.
>
> The old Store and Credential modules were under Catalyst::Plugin::Authentication but current modules are under the Catalyst::Authentication namespace.
>
> So, what you should do is install Catalyst::Authentication::Store::DBIx::Class (and preferably uninstall the deprecated Catalyst::Plugin::Authentication::Store::DBIC version).

Thanks; I think this much was actually clear and that my issue was
forgetting we had our local hacked version of C::P::A. No NEXT
warnings any more!

I'm doing this now,

  if ($c->authenticate( {
    password => $password,
    dbix_class => {
        searchargs => [          { -or => [ username => $username,
email => $username ] }, {}
        ]
      }
     })) {

Is there an easier* way of checking username & email against the same
'username' form? Seems like the old user_field => [qw/username email/]
has gone.

* OK I guess this isn't very hard
---
Finally, we have our roles via a join: user <-- user_role --> role. It
seems like role_field is expecting a string but it's here getting an
integer. Is there anyway of having go further into the role table with
that integer key and compare on role.role?

We used to use,
__PACKAGE__->config->{authorization}->{dbic} = {
  role_class           => 'DBIC_Readonly::Role',
  role_field           => 'role',
  role_rel             => 'map_user_role',            # DBIx::Class only
  user_role_user_field => 'user',
};

Now,
__PACKAGE__->config->{authentication} = {
  default_realm => 'members',
  realms => {
    members => {
      credential => {
        class => 'Password',
        password_field => 'password',
        password_type => 'clear',
      },
      store => {
        class => 'DBIx::Class',
        user_model => 'DBIC_Readonly::User',
        role_relation => 'map_user_role',
        role_field => 'role',
      },
    },
  },
};

with, (unchanged),
User.pm,
__PACKAGE__->has_many(map_user_role => 'IDL::Schema::UserRole' => 'user');

Paul



More information about the Catalyst mailing list