Debugging Auth code

View: New views
7 Messages — Rating Filter:   Alert me  

Debugging Auth code

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 some
problems that i cant debug, though, even though it looks like im doing things right.

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

 __PACKAGE__->config->{'Plugin::Authentication'} = { 
     default_realm => 'dbic',
     realms => {
     dbic => {
         credential => {
         class => 'Password',
         password_type => 'clear'
         },
         store => {
         class => 'DBIx::Class',
         user_class => 'MyDB::User'
         }
     }
     }
 };

(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:

 my $username = $c->request->params->{username} || "";
  my $password = $c->request->params->{password} || "";

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

(The name of my "username" field in the underlying table is "login" for legacy
reasons. But i thought thta using "login => $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!



_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Debugging Auth code

by J. Shirley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jul 5, 2008 at 7:01 AM, Dr. Jennifer Nussbaum
<bg271828@...> wrote:

> 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
> some
> problems that i cant debug, though, even though it looks like im doing
> things right.
>
> I got my setup from the docs and Tutorial. In my base class i use
> Authentication,
> Session Session::Store::DBIC, and Session::State::Cookie. My config is:
>
>  __PACKAGE__->config->{'Plugin::Authentication'} = {
>      default_realm => 'dbic',
>      realms => {
>      dbic => {
>          credential => {
>          class => 'Password',
>          password_type => 'clear'
>          },
>          store => {
>          class => 'DBIx::Class',
>          user_class => 'MyDB::User'
>          }
>      }
>      }
>  };
>
> (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:
>
>  my $username = $c->request->params->{username} || "";
>   my $password = $c->request->params->{password} || "";
>
>   # If the username and password values were found in form
>   if ($username && $password) {
>       $c->log->debug("we have a username and pw");
>       $c->log->debug("username is >$username<, password is >$password<");
>     # Attempt to log the user in
>     if ($c->authenticate({ login => $username,
>                password => $password })) {
> # ...
>
> (The name of my "username" field in the underlying table is "login" for
> legacy
> reasons. But i thought thta using "login => $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!
>
>

Hi Jennifer,

Looks like you are missing the "password_field" config parameter:
http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10006/lib/Catalyst/Authentication/Credential/Password.pm#CONFIGURATION

Also, you need to have the "id_field" set in your store configuration:
http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION

That would be the name of your username field in your MyDB::User class.

If you configure those items, you should be up and running.
Everything else looks fine.

-J

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Debugging Auth code

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


My password field is called "password", so i left it out of the config, because the
docs say that this is the default and therefore unnecessary.

I thought that the id_field was the name of the id; i do have an id value,
but of course the user just enters a name, not their database id.

In any case I changed the config to:

 __PACKAGE__->config->{'Plugin::Authentication'} = { 
     default_realm => 'dbic',
     realms => {
     dbic => {
         credential => {
         class => 'Password',
         password_field => 'password',
         password_type => 'clear'
         },
         store => {
         class => 'DBIx::Class',
         user_class => 'CiteEditorDB::User',
         id_field => 'login'
         }
     }
     }
 };

(Sorry about the indentation, its not cut-and-pasting well.)

And i have the same result--"[debug] Unable to locate user matching user info provided"
in my log.

Anything else i can try? Thank you!

Jen

--- On Sat, 7/5/08, J. Shirley <jshirley@...> wrote:
From: J. Shirley <jshirley@...>
Subject: Re: [Catalyst] Debugging Auth code
To: bg271828@..., "The elegant MVC web framework" <catalyst@...>
Date: Saturday, July 5, 2008, 9:05 AM

On Sat, Jul 5, 2008 at 7:01 AM, Dr. Jennifer Nussbaum
<bg271828@...> wrote:

> 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
> some
> problems that i cant debug, though, even though it looks like im doing
> things right.
>
> I got my setup from the docs and Tutorial. In my base class i use
> Authentication,
> Session Session::Store::DBIC, and Session::State::Cookie. My config is:
>
> __PACKAGE__->config->{'Plugin::Authentication'} = {
> default_realm => 'dbic',
> realms => {
> dbic => {
> credential => {
> class => 'Password',
> password_type => 'clear'
> },
> store => {
> class => 'DBIx::Class',
> user_class => 'MyDB::User'
> }
> }
> }
> };
>
> (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:
>
> my $username = $c->request->params->{username} || "";
> my $password = $c->request->params->{password} || "";
>
> # If the username and password values were found in form
> if ($username && $password) {
> $c->log->debug("we have a username and pw");
> $c->log->debug("username is >$username<, password
is >$password<");
> # Attempt to log the user in
> if ($c->authenticate({ login => $username,
> password => $password })) {
> # ...
>
> (The name of my "username" field in the underlying table is
"login" for
> legacy
> reasons. But i thought thta using "login => $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!
>
>

Hi Jennifer,

Looks like you are missing the "password_field" config parameter:
http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10006/lib/Catalyst/Authentication/Credential/Password.pm#CONFIGURATION

Also, you need to have the "id_field" set in your store
configuration:
http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION

That would be the name of your username field in your MyDB::User class.



_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Debugging Auth code

by J. Shirley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Jul 5, 2008 at 9:25 AM, Dr. Jennifer Nussbaum
<bg271828@...> wrote:

>
> My password field is called "password", so i left it out of the config,
> because the
> docs say that this is the default and therefore unnecessary.
>
> I thought that the id_field was the name of the id; i do have an id value,
> but of course the user just enters a name, not their database id.
>
> In any case I changed the config to:
>
>  __PACKAGE__->config->{'Plugin::Authentication'} = {
>      default_realm => 'dbic',
>      realms => {
>      dbic => {
>          credential => {
>          class => 'Password',
>          password_field => 'password',
>          password_type => 'clear'
>          },
>          store => {
>          class => 'DBIx::Class',
>          user_class => 'CiteEditorDB::User',
>          id_field => 'login'
>          }
>      }
>      }
>  };
>
> (Sorry about the indentation, its not cut-and-pasting well.)
>
> And i have the same result--"[debug] Unable to locate user matching user
> info provided"
> in my log.
>
> Anything else i can try? Thank you!
>
> Jen
>
> --- On Sat, 7/5/08, J. Shirley <jshirley@...> wrote:
>
> From: J. Shirley <jshirley@...>
> Subject: Re: [Catalyst] Debugging Auth code
> To: bg271828@..., "The elegant MVC web framework"
> <catalyst@...>
> Date: Saturday, July 5, 2008, 9:05 AM
>
> On Sat, Jul 5, 2008 at 7:01 AM, Dr. Jennifer Nussbaum
> <bg271828@...> wrote:
>> 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
>> some
>> problems that i cant debug, though, even though it looks like im doing
>> things right.
>>
>> I got my setup from the docs and Tutorial. In my base class i use
>> Authentication,
>> Session Session::Store::DBIC, and Session::State::Cookie. My config is:
>>
>>  __PACKAGE__->config->{'Plugin::Authentication'} = {
>>      default_realm => 'dbic',
>>      realms => {
>>      dbic => {
>>          credential =>
>  {
>>          class => 'Password',
>>          password_type => 'clear'
>>          },
>>          store => {
>>          class => 'DBIx::Class',
>>          user_class => 'MyDB::User'
>>          }
>>      }
>>      }
>>  };
>>
>> (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:
>>
>>  my $username = $c->request->params->{username} || "";
>>   my $password = $c->request->params->{password} || "";
>>
>>   # If the username and password values were found in form
>>   if ($username && $password) {
>>       $c->log->debug("we have a username and pw");
>>       $c->log->debug("username is >$username<, password
> is
>  >$password<");
>>     # Attempt to log the user in
>>     if ($c->authenticate({ login => $username,
>>                password => $password })) {
>> # ...
>>
>> (The name of my "username" field in the underlying table is
> "login" for
>> legacy
>> reasons. But i thought thta using "login => $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!
>>
>>
>
> Hi Jennifer,
>
> Looks like you are missing the "password_field" config parameter:
> http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10006/lib/Catalyst/Authentication/Credential/Password.pm#CONFIGURATION
>
> Also, you need to have the "id_field" set in your store
> configuration:
> http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION
>
> That would be the name of your username field in your MyDB::User class.
>
>
>

One thing to check is that you don't have any older versions of
Catalyst::Plugin::Authentication::* laying around (especially
Catalyst::Plugin::Authentication::Store::DBIx::Class or
Catalyst::Plugin::Authentication::Credential::Password) - that may be
causing some confusion internally.

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Debugging Auth code

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--- On Sat, 7/5/08, J. Shirley <jshirley@...> wrote:
From: J. Shirley <jshirley@...>
Subject: Re: [Catalyst] Debugging Auth code
To: bg271828@...
Cc: "The elegant MVC web framework" <catalyst@...>
Date: Saturday, July 5, 2008, 10:35 AM

On Sat, Jul 5, 2008 at 9:25 AM, Dr. Jennifer Nussbaum
<bg271828@...> wrote:
>
> My password field is called "password", so i left it out of the
config,

> because the
> docs say that this is the default and therefore unnecessary.
>
> I thought that the id_field was the name of the id; i do have an id value,
> but of course the user just enters a name, not their database id.
>
> In any case I changed the config to:
>
>  __PACKAGE__->config->{'Plugin::Authentication'} = {
>      default_realm => 'dbic',
>      realms => {
>      dbic => {
>          credential => {
>          class => 'Password',
>          password_field => 'password',
>          password_type => 'clear'
>          },
>          store => {
>          class => 'DBIx::Class',
>          user_class => 'CiteEditorDB::User',
>          id_field => 'login'
>          }
>      }
>      }
>  };
>
> (Sorry about the indentation, its not cut-and-pasting well.)
>
> And i have the same result--"[debug] Unable to locate user matching
user

> info provided"
> in my log.
>
> Anything else i can try? Thank you!
>
> Jen
>
> --- On Sat, 7/5/08, J. Shirley <jshirley@...> wrote:
>
> From: J. Shirley <jshirley@...>
> Subject: Re: [Catalyst] Debugging Auth code
> To: bg271828@..., "The elegant MVC web framework"
> <catalyst@...>
> Date: Saturday, July 5, 2008, 9:05 AM
>
> On Sat, Jul 5, 2008 at 7:01 AM, Dr. Jennifer Nussbaum
> <bg271828@...> wrote:
>> 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
>> some
>> problems that i cant debug, though, even though it looks like im doing
>> things right.
>>
>> I got my setup from the docs and Tutorial. In my base class i use
>> Authentication,
>> Session Session::Store::DBIC, and Session::State::Cookie. My config
is:

>>
>>  __PACKAGE__->config->{'Plugin::Authentication'} = {
>>      default_realm => 'dbic',
>>      realms => {
>>      dbic => {
>>          credential =>
>  {
>>          class => 'Password',
>>          password_type => 'clear'
>>          },
>>          store => {
>>          class => 'DBIx::Class',
>>          user_class => 'MyDB::User'
>>          }
>>      }
>>      }
>>  };
>>
>> (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:
>>
>>  my $username = $c->request->params->{username} ||
"";
>>   my $password = $c->request->params->{password} ||
"";
>>
>>   # If the username and password values were found in form
>>   if ($username && $password) {
>>       $c->log->debug("we have a username and pw");
>>       $c->log->debug("username is >$username<,
password

> is
>  >$password<");
>>     # Attempt to log the user in
>>     if ($c->authenticate({ login => $username,
>>                password => $password })) {
>> # ...
>>
>> (The name of my "username" field in the underlying table is
> "login" for
>> legacy
>> reasons. But i thought thta using "login => $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!
>>
>>
>
> Hi Jennifer,
>
> Looks like you are missing the "password_field" config
parameter:
>
http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10006/lib/Catalyst/Authentication/Credential/Password.pm#CONFIGURATION
>
> Also, you need to have the "id_field" set in your store
> configuration:
>
http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION
>
> That would be the name of your username field in your MyDB::User class.
>
>
> One thing to check is that you don't have any older versions of
> Catalyst::Plugin::Authentication::* laying around (especially
> Catalyst::Plugin::Authentication::Store::DBIx::Class or
> Catalyst::Plugin::Authentication::Credential::Password) - that may be
> causing some confusion internally.

The only version of C::P::A::C::P i have is the compatibility shim with
no real working lines. I dont have C::P::A::S::DBIx::Class at all.

Ive been trying to debug this, adding further debugging code, and still
cant figure out whats going on. I reach the "authenticate" line, and
DBIC_TRACE reports that the right DB query is being fired off, which if
i run it in the mysql command-line program does return the right info.
But "authenticate" doesnt authenticate it. There must be some reason why
its not finding the user, but i cant figure out what it is.

Any further debugging ideas? Ive been over this several times now, i just
cant see what im missing.

Thank you.



     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Debugging Auth code

by Dr. Jennifer Nussbaum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


--- On Sat, 7/5/08, Dr. Jennifer Nussbaum <bg271828@...> wrote:

> From: Dr. Jennifer Nussbaum <bg271828@...>
> Subject: Re: [Catalyst] Debugging Auth code
> To: "J. Shirley" <jshirley@...>
> Cc: "The elegant MVC web framework" <catalyst@...>
> Date: Saturday, July 5, 2008, 1:38 PM
> --- On Sat, 7/5/08, J. Shirley <jshirley@...>
> wrote:
> From: J. Shirley <jshirley@...>
> Subject: Re: [Catalyst] Debugging Auth code
> To: bg271828@...
> Cc: "The elegant MVC web framework"
> <catalyst@...>
> Date: Saturday, July 5, 2008, 10:35 AM
>
> On Sat, Jul 5, 2008 at 9:25 AM, Dr. Jennifer Nussbaum
> <bg271828@...> wrote:
> >
> > My password field is called "password", so i
> left it out of the
> config,
> > because the
> > docs say that this is the default and therefore
> unnecessary.
> >
> > I thought that the id_field was the name of the id; i
> do have an id value,
> > but of course the user just enters a name, not their
> database id.
> >
> > In any case I changed the config to:
> >
> >
> __PACKAGE__->config->{'Plugin::Authentication'}
> = {
> >      default_realm => 'dbic',
> >      realms => {
> >      dbic => {
> >          credential => {
> >          class => 'Password',
> >          password_field => 'password',
> >          password_type => 'clear'
> >          },
> >          store => {
> >          class => 'DBIx::Class',
> >          user_class =>
> 'CiteEditorDB::User',
> >          id_field => 'login'
> >          }
> >      }
> >      }
> >  };
> >
> > (Sorry about the indentation, its not cut-and-pasting
> well.)
> >
> > And i have the same result--"[debug] Unable to
> locate user matching
> user
> > info provided"
> > in my log.
> >
> > Anything else i can try? Thank you!
> >
> > Jen
> >
> > --- On Sat, 7/5/08, J. Shirley
> <jshirley@...> wrote:
> >
> > From: J. Shirley <jshirley@...>
> > Subject: Re: [Catalyst] Debugging Auth code
> > To: bg271828@..., "The elegant MVC web
> framework"
> > <catalyst@...>
> > Date: Saturday, July 5, 2008, 9:05 AM
> >
> > On Sat, Jul 5, 2008 at 7:01 AM, Dr. Jennifer Nussbaum
> > <bg271828@...> wrote:
> >> 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
> >> some
> >> problems that i cant debug, though, even though it
> looks like im doing
> >> things right.
> >>
> >> I got my setup from the docs and Tutorial. In my
> base class i use
> >> Authentication,
> >> Session Session::Store::DBIC, and
> Session::State::Cookie. My config
> is:
> >>
> >>
> __PACKAGE__->config->{'Plugin::Authentication'}
> = {
> >>      default_realm => 'dbic',
> >>      realms => {
> >>      dbic => {
> >>          credential =>
> >  {
> >>          class => 'Password',
> >>          password_type => 'clear'
> >>          },
> >>          store => {
> >>          class => 'DBIx::Class',
> >>          user_class => 'MyDB::User'
> >>          }
> >>      }
> >>      }
> >>  };
> >>
> >> (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:
> >>
> >>  my $username =
> $c->request->params->{username} ||
> "";
> >>   my $password =
> $c->request->params->{password} ||
> "";
> >>
> >>   # If the username and password values were found
> in form
> >>   if ($username && $password) {
> >>       $c->log->debug("we have a
> username and pw");
> >>       $c->log->debug("username is
> >$username<,
> password
> > is
> >  >$password<");
> >>     # Attempt to log the user in
> >>     if ($c->authenticate({ login =>
> $username,
> >>                password => $password })) {
> >> # ...
> >>
> >> (The name of my "username" field in the
> underlying table is
> > "login" for
> >> legacy
> >> reasons. But i thought thta using "login
> => $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!
> >>
> >>
> >
> > Hi Jennifer,
> >
> > Looks like you are missing the
> "password_field" config
> parameter:
> >
> http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication-0.10006/lib/Catalyst/Authentication/Credential/Password.pm#CONFIGURATION
> >
> > Also, you need to have the "id_field" set in
> your store
> > configuration:
> >
> http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION
> >
> > That would be the name of your username field in your
> MyDB::User class.
> >
> >
> > One thing to check is that you don't have any
> older versions of
> > Catalyst::Plugin::Authentication::* laying around
> (especially
> > Catalyst::Plugin::Authentication::Store::DBIx::Class
> or
> >
> Catalyst::Plugin::Authentication::Credential::Password) -
> that may be
> > causing some confusion internally.
>
> The only version of C::P::A::C::P i have is the
> compatibility shim with
> no real working lines. I dont have C::P::A::S::DBIx::Class
> at all.
>
> Ive been trying to debug this, adding further debugging
> code, and still
> cant figure out whats going on. I reach the
> "authenticate" line, and
> DBIC_TRACE reports that the right DB query is being fired
> off, which if
> i run it in the mysql command-line program does return the
> right info.
> But "authenticate" doesnt authenticate it. There
> must be some reason why
> its not finding the user, but i cant figure out what it is.
>
> Any further debugging ideas? Ive been over this several
> times now, i just
> cant see what im missing.
>
> Thank you.

Never mind, i got it!

I delete users by setting deleted, a datetime value, = a current timestamp. Normally deleted is set to NULL, but there are some cases where deleted
is set to the 0 time (for current users).

Normally i check to see if deleted IS NULL or deleted = 0, but DBIC is
apparently quoting this, so that it looks for "deleted = '0'", which is
not the same as "deleted = 0", and if the value is a datetime of
0000-00-00 00:00:00, then it does not equal '0'.

In other words, i was simply not finding my user because DBIC was doing
the wrong thing.

I realize this is a DBIC question, but how can i check for this correctly?
In my Schema class, I have:

__PACKAGE__->resultset_attributes({ where => {deleted => [ undef, 0 ] }, order_by => 'login' });

which someone here showed me a while ago; how do i change this to
generate ..."deleted = 0" instead of "deleted = '0'"?

Thanks!

Jen


     

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: Debugging Auth code

by Dermot-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/7/5 Dr. Jennifer Nussbaum <bg271828@...>:

>> >
>> __PACKAGE__->config->{'Plugin::Authentication'}
>> = {
>> >      default_realm => 'dbic',
>> >      realms => {
>> >      dbic => {
>> >          credential => {
>> >          class => 'Password',
>> >          password_field => 'password',
>> >          password_type => 'clear'
>> >          },
>> >          store => {
>> >          class => 'DBIx::Class',
>> >          user_class =>
>> 'CiteEditorDB::User',
>> >          id_field => 'login'
>> >          }
>> >      }
>> >      }
>> >  };
>> >
...snipped
>> The only version of C::P::A::C::P i have is the
>> compatibility shim with
>> no real working lines. I dont have C::P::A::S::DBIx::Class
>> at all.

I'm not expert so I hate to offer advice but I had a similar problem
with my realms. In my case I didn't have C::P::A::S::DBIx::Class
installed either. How can the realm's store work as they are
configured to use DBIx::Class and it's not installed. You'd think it
would crumble. It didn't. I kept trying to login and getting errors.
So perhaps you should

cpan Catalyst::Authentication::Store::DBIx::Class

It's a bit of a long shot for someone as green as me to offer a
solution but it might be the source of your problem.
Dp.

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/
LightInTheBox - Buy quality products at wholesale price