[Catalyst] Debugging Auth code

Dr. Jennifer Nussbaum bg271828 at yahoo.com
Sat Jul 5 15:01:34 BST 2008


Hi,

Im trying to convert a legacy program over to Catalyst, and in the process =
have
tried to use the new Auth framework that i havent used before. Im having so=
me
problems that i cant debug, though, even though it looks like im doing thin=
gs right.

I got my setup from the docs and Tutorial. In my base class i use=A0 Authen=
tication,
Session Session::Store::DBIC, and Session::State::Cookie. My config is:

=A0__PACKAGE__->config->{'Plugin::Authentication'} =3D {=A0 =

=A0=A0=A0=A0 default_realm =3D> 'dbic',
=A0=A0=A0=A0 realms =3D> {
=A0=A0=A0 =A0dbic =3D> {
=A0=A0=A0 =A0=A0=A0=A0 credential =3D> {
=A0=A0=A0 =A0=A0=A0 =A0class =3D> 'Password',
=A0=A0=A0 =A0=A0=A0 =A0password_type =3D> 'clear'
=A0=A0=A0 =A0=A0=A0=A0 },
=A0=A0=A0 =A0=A0=A0=A0 store =3D> {
=A0=A0=A0 =A0=A0=A0 =A0class =3D> 'DBIx::Class',
=A0=A0=A0 =A0=A0=A0 =A0user_class =3D> 'MyDB::User'
=A0=A0=A0 =A0=A0=A0=A0 }
=A0=A0=A0 =A0}
=A0=A0=A0=A0 }
=A0};

(By the way i dont really know what 'realms' does, as im not using them now=
, but
i thought that i can just use anything as long as im not using it directly.)

Then my login routine includes:

=A0my $username =3D $c->request->params->{username} || "";
=A0 my $password =3D $c->request->params->{password} || "";

=A0 # If the username and password values were found in form
=A0 if ($username && $password) {
=A0=A0=A0=A0=A0 $c->log->debug("we have a username and pw");
=A0=A0=A0=A0=A0 $c->log->debug("username is >$username<, password is >$pass=
word<");
=A0=A0=A0 # Attempt to log the user in
=A0=A0=A0 if ($c->authenticate({ login =3D> $username, =

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0 password =3D> $password })) {
# ...

(The name of my "username" field in the underlying table is "login" for leg=
acy
reasons. But i thought thta using "login =3D> $username" would address this;
login is the right column in the table itself.)

When i run DBIC_TRACE, the SQL that's executed _does_ return the user object
associated with this username and password combo. However, when i run this,
my log shows:

[debug] Path is "login"
[debug] we have a username and pw
[debug] username is >testuser<, password is >passw0rd<
[debug] Unable to locate user matching user info provided

Since the SQL is returning the right thing, and everything else looks OK, i=
 cant
tell why this is failing. Can someone give me some advice on debugging this?

Thanks!




      =

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080705/030c6=
1a6/attachment.htm


More information about the Catalyst mailing list