[Catalyst] forcing authentication without credentials

Rodney Broom rbroom+catalyst at rbroom.com
Thu Jul 27 22:44:37 CEST 2006


From: "Nathan Kurz" <nate at verse.com>

> The problem I'm having is forcing a login
> for a newly created user that has neither an email address (my
> user_field) nor a password.

Hmm, I can't get it to work, either. Reading the code has only confused me.

Credential/Password.pm has:

    $c->set_authenticated($user);
    $c->log->debug("Successfully authenticated user '$user'.")
      if $c->debug;

The log entry shows $user to be the 'login' field passed, in my case an email.

The only set_authenticated() method I see in the Catalyst/ tree is in Authentication.pm, which says:

    if (    $c->isa("Catalyst::Plugin::Session")
        and $c->config->{authentication}{use_session}
        and $user->supports("session") )
    {
        $c->save_user_in_session($user);
    }

If the $user getting passed is a string (email address), then $user->supports(...) won't work, but clearly it does something. When I call set_authenticated() with a string, I get a perl error about needing a package or object. When I pass a Model::User object, I get errors about undefined subroutine for the object.

There has to be a way to do this. That, or there needs to be. It seems completely reasonable that somebody would want to authenticate based on their own logic once in a while.


---
Rodney Broom




More information about the Catalyst mailing list