[Catalyst] Maintenance release: C::P::Authentication
marcus baker
marcus.baker at gmail.com
Tue Jul 24 15:41:26 GMT 2007
Thanks for the confirmation on the latest DBIx + Auth modules working
correctly - it turns out my models are configured incorrectly.
-Marcus
2007/7/23, Jay K <jayk at ion0.com>:
> Hi Marcus,
>
> What I can tell you to start is that the most recent (on cpan)
> C::P::Auth and DBIx::Class work fine together. I am using them in
> several live applications at the moment. So my guess is that this
> is something to do with the interaction between the DBIx::Class
> module and your user class.
>
> The DBIx::Class module expects the result of $c->model($config->
> {'user_class'}) to be something that is (or at least behaves like) a
> ResultSet.
>
> The first thing I would do is drop loading of
> Authentication::Credential::Password - The Auth module will load it
> itself. It has some compatibility shims which may be fouling you up
> - It expects that if you load it as a plugin, it should be working in
> compatibility mode.
>
> So I would start there.. please remove it from the use Catalyst
> line and post what happens?
>
> Thanks,
>
> JayK
>
> On Jul 23, 2007, at 2:00 PM, marcus baker wrote:
>
> > I should note that the furthest I was able to trace this down within
> > Catalyst was to line 26 in the new() method of
> > Catalyst::Plugin::Authentication::Store::DBIx::Class::User:
> >
> > my @pks = $self->{'resultset'}->result_source->primary_columns;
> >
> > $self having been instantiated as follows starting in line 15:
> > my $self = {
> > resultset => $c->model($config->{'user_class'}),
> > config => $config,
> > _roles => undef,
> > _user => undef
> > };
> >
> > It seems like $self->{resultset} ends up as my User class
> > ((App)::Model::DBIC::User) but somewhere withing the calling of
> > result_source on it, it is dying.
> >
> > -Marcus
> >
> > 2007/7/23, marcus baker <marcus.baker at gmail.com>:
> >> Is it possible that the latest C::P::Authentication updates are
> >> also affecting
> >> Catalyst::Plugin::Authentication::Store::DBIx::Class? Using the
> >> recent modules (including Catalyst-Plugin-Authentication-0.10002
> >> which I'm assuming is this maintenance release) I'm continuing to
> >> get the following error when I try running the authenticate()
> >> method, passing in a username and password in a hashref:
> >>
> >> Caught exception in (App)::Controller::Root->login "Can't use
> >> string ("(App)::Model::DBIC::User") as a HASH ref while "strict
> >> refs" in use at /usr/local/share/perl/5.8.7/Class/Accessor/
> >> Grouped.pm line 251."
> >>
> >> (App) being my application's package name, and my authentication /
> >> authorization configuration as follows:
> >>
> >> authentication => {
> >> default_realm => 'users',
> >> realms => {
> >> users => {
> >> credential => {
> >> class => 'Password',
> >> password_field => 'password',
> >> password_type => 'hashed',
> >> password_hash_type => 'SHA-1',
> >> },
> >> store => {
> >> class => 'DBIx::Class',
> >> user_field => 'username',
> >> user_class => 'DBIC::User',
> >> role_relation => 'user_roles',
> >> role_field => 'role'
> >> },
> >> },
> >> },
> >> },
> >> authorization => {
> >> dbic => {
> >> role_class => 'DBIC::Role',
> >> role_field => 'role',
> >> role_rel => 'user_roles',
> >> user_role_user_field => 'user',
> >> }
> >> },
> >>
> >> The related plugins loaded are: Authentication (0.10002),
> >> Authentication::Credential::Password (?), Authorization::Roles
> >> (0.05), and Authorization::ACL (0.08)
> >>
> >> Class::Accessor::Grouped ( 0.07000)
> >> DBIx::Class (0.08003)
> >>
> >> Thanks
> >> -Marcus
> >>
> >>
> >> 2007/7/21, Jay K <jayk at ion0.com>:
> >>
> >> > Hey all,
> >> >
> >> > Turns out there was a minor bug in C::P::Authentication - this
> >> didn't
> >> > affect updated modules, but it did limit the compatibility of older
> >> > modules with the new Auth.
> >> >
> >> > I've uploaded a maintenance release to CPAN which fixes this bug.
> >> > I should also note that after fixing this bug, the LDAP module
> >> is now
> >> > fully compatible with realms (with a slightly different config)
> >> >
> >> > Basically - you avoid placing the LDAP store in the 'use Catalyst'
> >> > line and instead configure auth as follows:
> >> >
> >> > > __PACKAGE__->config(
> >> > > authentication => {
> >> > > default_realm => 'users',
> >> > > realms => {
> >> > > users => {
> >> > > credential => {
> >> > > class => 'Password',
> >> > > password_field => 'password',
> >> > > password_type => 'self_check',
> >> > > },
> >> > > store => {
> >> > > class => 'LDAP::Backend',
> >> > > [ ... rest of LDAP config ]
> >> > > }
> >> > > }
> >> > > }
> >> > > }
> >> > > );
> >> >
> >> > Then just replace your $c->login call with $c->authenticate, as
> >> follows:
> >> >
> >> > > old:
> >> > >
> >> > > $c->login($username, $password);
> >> > >
> >> > > new:
> >> > >
> >> > > $c->authenticate({ id => $username, password => $password });
> >> >
> >> > I post this because this may work with other 'old-style' modules
> >> too
> >> > - and is worth trying as an initial step towards migrating to
> >> realms.
> >> >
> >> > Anyway - thanks to Wade (aka waswas) for helping track this problem
> >> > down.
> >> >
> >> > JayK
> >> >
> >> >
> >> >
> >> > ---
> >> > For most things, throwing yourself at the wall over and over is a
> >> > better way to improve than thinking hard about the wall and taking
> >> > pictures of it. -- D.Litwack
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > List: Catalyst at lists.rawmode.org
> >> > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> >> > Searchable archive: http://www.mail-archive.com/
> >> catalyst at lists.rawmode.org/
> >> > Dev site: http://dev.catalyst.perl.org/
> >> >
> >>
> >>
> >
> > _______________________________________________
> > List: Catalyst at lists.rawmode.org
> > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> > Searchable archive: http://www.mail-archive.com/
> > catalyst at lists.rawmode.org/
> > Dev site: http://dev.catalyst.perl.org/
>
> ---
> "Those who can make you believe absurdities can make you commit
> atrocities." --Voltaire
>
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list