Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

LDAP authentication with Net::LDAP

by bodmin (Acolyte)
on Feb 10, 2004 at 12:43 UTC ( #327894=perlquestion: print w/replies, xml ) Need Help??

bodmin has asked for the wisdom of the Perl Monks concerning the following question:

I am able to connect to an ldap directory service, and view data within the directory using Net::LDAP. Fields of particular interest are the username and password. I have access to the username, however there does not appear to be a password field.

I would like to validate a users username and password against an entry in the ldap directory, how do I go about this?.

Any suggestions greatly appreciated.

Replies are listed 'Best First'.
Re: LDAP authentication with Net::LDAP
by inman (Curate) on Feb 10, 2004 at 13:13 UTC
    You need to bind to the directory so that you can test the password. The password is not stored. Only the hash is stored. The hash can only be viewed if your user DN has the correct priviledge.

    The code example below connects to an LDAP(S) directory using an application DN, looks up the full user DN based on their uid and then binds using the user DN and their password to check if it is OK.

      Many thanks, that was of great help.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://327894]
Approved by inman
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-05-18 19:23 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.