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

Gavin Henry gavin.henry at gmail.com
Fri Jun 29 20:18:08 GMT 2012


> Does something like this fix the problem?
>
> --- Password.pm 2012-06-29 11:23:51.000000000 +0100
> +++ Password-new.pm     2012-06-29 11:33:40.000000000 +0100
> @@ -34,6 +34,14 @@
>  sub authenticate {
>     my ( $self, $c, $realm, $authinfo ) = @_;
>
> +    my $password_field = $self->_config->{'password_field'};
> +    if ($password_field ne 'password'
> +    and defined $authinfo->{password}) {
> +       $authinfo = {%{$authinfo}};
> +       $authinfo->{$password_field} = $authinfo->{password};
> +       delete $authinfo->{password};
> +    }
> +
>     ## because passwords may be in a hashed format, we have to make
> sure that we remove the
>     ## password_field before we pass it to the user routine, as some
> auth modules use
>     ## all data passed to them to find a matching user...

I've raised:

https://rt.cpan.org/Ticket/Display.html?id=78115

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?

-- 
http://www.suretecsystems.com/services/openldap/
http://www.surevoip.co.uk



More information about the Catalyst mailing list