Hi there!
In the documentation I found an example for user login via LDAP:
--------8<--------8<--------8<--------8<--------8<--------8<--------- $wgHooks['UserLogin'][] = array('ldapLogin', $ldapServer);
$ldap['server']="ldaps://ldap.company.com/"; $ldap['port'] = 636; $ldap['base'] = ",ou=Staff,dc=company,dc=com";
function ldapLogin($username, $password) { global $ldap; $auth_user="uid=".$username.$ldap['base']; if($connect=@ldap_connect($ldap['server'],$ldap['port'])){ if($bind=@ldap_bind($connect, $auth_user, $password)){ @ldap_close($connect); return(true); }//if bound to ldap else { echo "Error on ldap_bind"; } }//if connected to ldap else { echo "Error on ldap_connect"; } @ldap_close($connect); return(false); } --------8<--------8<--------8<--------8<--------8<--------8<---------
First of all, the example doesn't make sense to me because it calls the function ldapLogin with one parameter, which is the LDAP server name, but the function itself demands two parameters - login and password. Secondly, I don't find the Hook UserLogin in the list of available hooks.
What is this?
Cheers, Inki
Hi
Maybe you want to look at the ldap extension on meta (http://meta.wikimedia.org/wiki/LDAP_Authentication). It works, has good documentation and is capable of checking for group membership.
The function below needs to be called with username and password, the other information is stored in the $ldap array, so the example is simply wrong.
HTH chris
mediawiki-l-bounces@Wikimedia.org schrieb am 13.10.2006 10:37:11:
Hi there!
In the documentation I found an example for user login via LDAP:
--------8<--------8<--------8<--------8<--------8<--------8<--------- $wgHooks['UserLogin'][] = array('ldapLogin', $ldapServer);
$ldap['server']="ldaps://ldap.company.com/"; $ldap['port'] = 636; $ldap['base'] = ",ou=Staff,dc=company,dc=com";
function ldapLogin($username, $password) { global $ldap; $auth_user="uid=".$username.$ldap['base']; if($connect=@ldap_connect($ldap['server'],$ldap['port'])){ if($bind=@ldap_bind($connect, $auth_user, $password)){ @ldap_close($connect); return(true); }//if bound to ldap else { echo "Error on ldap_bind"; } }//if connected to ldap else { echo "Error on ldap_connect"; } @ldap_close($connect); return(false); } --------8<--------8<--------8<--------8<--------8<--------8<---------
First of all, the example doesn't make sense to me because it calls the function ldapLogin with one parameter, which is the LDAP server name, but the function itself demands two parameters - login and password. Secondly, I don't find the Hook UserLogin in the list of available hooks.
What is this?
Cheers, Inki _______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org