[Catalyst] Using Progressive realms when username and password fields are all different

Tomas Doran bobtfish at bobtfish.net
Sat Jun 30 11:09:23 GMT 2012


On 29 Jun 2012, at 21:18, Gavin Henry wrote:
> The main problem is that and the fact that username_field is missing.
> 
> I'd like to do ->authenticate( { username => $blah, password => $blah2 })
> 
> if username_field and/or password_field is in the config, map those to
> above values, if not
> just use the default. Otherwise there's no way you can use a
> Progressive realm with
> non-consistent user/pass field names in your DB. I could add a
> view....but it's not my
> DB.
> 
> Silly or sane?

What you want / need is to be able to re-map the auth-info in some way before (or at the time of) the call to $realm->find_user

I'd suggest that C::Authentication::Realm be patched to support a 'authinfo_mangle' config key, which would look something like this:

{
    add => {
        some_key => 'some_value',
    },
    remove => [qw/ some_other_key /],
    rename => {
        from_field_name => 'to_field_name',
    }
}

This would allow you to add/remove/rename arbitrary fields that were passed into $c->authenticate({}); - this would solve the issue in a generic way, right?

Cheers
t0m







More information about the Catalyst mailing list