Jump to content

Recommended Posts

Hey fellas , 

I was clueless about LDAP AND AD when i was told to create a login page for my web-app and check authentication with AD server . After searching through , i came to know what this LDAP is all about .
i need to get started with it , so i have a email feild and password . All worstations at my workplace have access to that server , as we use it to log on to the system . I need to use the same mechnism in my
login page . 

please Help me , how to get started with it , what all things will be necessary .
This article will be a great help to not only me but to all new PHP developers because somewhere down the line everyone is going to need this . 

P.S. I have the host name and port of the server where all login details are present i need some php class and tweaks in it to access it on hitting the login button .

Thanks .

Link to comment
https://forums.phpfreaks.com/topic/284044-php-authentication-using-ldap/
Share on other sites

  • 2 weeks later...
  • 1 month later...

Basic steps will be to open a connection to the LDAP server, this is done with ldap_connect(), this does not require authentication. Next you will bind to the LDAP directory, this step is when you will check the information your user provided. Use the ldap_bind() function, this will return true if the credentials provided by your user are valid and false if they are not. Please note that on the username at lease when I worked with this (Windows Active Directory) did require the name of the domain in front of the username (i.e domainName\userName). If you want to go further and make sure the user is a member of a group that is allowed to access the application you can search for the user object using ldap_search() and ldap_get_entries() and check the memberof attribute for the group. If all of the tests pass do what you would do during any other authentication method, set session and or cookie variables maybe update a database or log. Make sure the if the LDAP bind was successful you call the ldap_unbind() function after you have collected your user information from the directory.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.