make cn or uid configurable

master
Marc Wäckerlin 8 years ago
parent b5543a6c62
commit 7637b49aac
  1. 5
      etc/authentication.php

@ -3,8 +3,9 @@ $realm = "MY REALM HERE";
$ldaphost = "my.ldap.host";
$ldaptls = "yes";
$ldapbase = "dc=my,dc=server,dc=com";
$checkuser = "cn";
function basicAuth() {
header('WWW-Authenticate: Basic realm="'.$REALM.'"');
header('WWW-Authenticate: Basic realm="'.$realm.'"');
header('HTTP/1.0 401 Unauthorized');
exit;
}
@ -20,7 +21,7 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
if ($ldaptls!="no" && $ldaptls!=0 && $ldaptlS)
ldap_start_tls($ldapconn)
or error_die($ldapconn, "cannot start LDAP TLS");
$ldapbind = @ldap_bind($ldapconn, 'uid='.$tstusername.','.$ldapbase, $password)
$ldapbind = @ldap_bind($ldapconn, $checkuser.'='.$tstusername.','.$ldapbase, $password)
or basicAuth();
$username = $tstuserbname;
}

Loading…
Cancel
Save