I have an ssh access to a LDAP server.
After accessing through ssh I can access to phpldapadmin. I have an admin DN and a password.
What needs to be done is I have to authenticate users using ldap whenever they try to login to a website.
Website is using jaggery for the server side code. But php is okay too.
I haven't worked with ldap and ssh. So if somebody can help on this I'll really appreciate it.
You have to download the adLDAP.php here: http://adldap.sourceforge.net/download.php
Then the autentication is quiet simple:
$adldap = new adLDAP(array('base_dn'=>'DC=domainexample,DC=suffixexample', 'account_suffix'=>'@domainexample.suffix'));
$authUser = $adldap->authenticate('user', 'password');
if ($authUser == true) {
echo "User authenticated successfully<br>";
}
else {
echo "User authentication unsuccessful<br>";
}
You have only to be careful with the DC attribution: it depends on the LDAP network.
PHP has an extension to work with LDAP. You don't need to install third-party libraries.
Work with ldap and session is what you need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.