Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2019-12-05 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (151 votes). Check out past polls.

    Notices?