[Catalyst-dev] user_field in Catalyst::Plugin::Authentication::Store::LDAP

Carl Johnstone catalyst at fadetoblack.me.uk
Fri Nov 30 11:49:02 GMT 2007


Hi,

Been trying to get LDAP Auth working. In our setup, users use their email 
address to login, however because users can change their email address we 
also have an id for relationships with other content.

So once a user has actually logged in, it's the uidNumber that's important 
to us.

So reading the documentation I figured that my search filter would be 
"(mail=%s)" and my user_field would be "uidNumber". I then would just need 
to call

$c->login( $c->req->param('email'), $c->req->param('password'));

However it wasn't working. Tracking the problem down, and in my case this 
chunk of code is checking each result to see if the id passed into login 
matched the user_field. In my case it check that the email address matches 
uidNumber, so was always failing:

  RESULT: while (my $entry = $usersearch->pop_entry) {
        foreach my $field (@user_fields) {
            foreach my $value ($entry->get_value($field)) {
                if ($value eq $id) {
                    $userentry = $entry;
                    last RESULT;
                }
            }
        }
    }


However the existence of that chunk of code doesn't make sense to me, you 
already get the chance to filter the results when doing the query on the 
server. All that would seem to be doing is doing the exact same thing 
_again_ on the client side.

Am I completely barking up the wrong tree here, or is there a case where the 
results would need to be re-filtered on the client side?

Carl




More information about the Catalyst-dev mailing list