, Jam Warehouse (Pty) Ltd, South Africa
* @package tests.authentication
*/
//if (checkSession()) {
require_once("$default->fileSystemRoot/lib/authentication/DBAuthenticator.inc");
echo "Testing DB searching";
// user attributes to search for
$aAttributes = array ("username", "name", "email", "mobile", "email_notification", "sms_notification");
$oDbAuth = new DBAuthenticator();
$sSearch = "user";
echo "
";
require_once("$default->fileSystemRoot/lib/authentication/LDAPAuthenticator.inc");
echo "Testing LDAP searching";
// user attributes to search for
$aAttributes = array ("dn", "uid", "givenname", "sn", "mail", "mobile");
$oLdapAuth = new LDAPAuthenticator();
$sSearch = "mi";
echo "- searching for $sSearch with attributes=
" . arrayToSTring($aAttributes) . "
";
$aResults = $oLdapAuth->searchUsers($sSearch, $aAttributes);
echo "first result=" . arrayToString($aResults[0]) . "
";
echo "" . arrayToString($aResults) . "
";
echo "Testing LDAP authentication";
// user credentials to authenticate
$sUserName = "michael"; $sPassword = "pass123";
echo "- Authenticating ($sUserName, $sPassword) : " . ($oLdapAuth->checkPassword($sUserName, $sPassword) ? "true" : "false") . "
";
$sUserName = "rob"; $sPassword = "rob123";
echo "- Authenticating ($sUserName, $sPassword) : " . ($oLdapAuth->checkPassword($sUserName, $sPassword) ? "true" : "false") . "
";
$sUserName = "mukhtar"; $sPassword = "mukhtar123";
echo "- Authenticating ($sUserName, $sPassword) : " . ($oLdapAuth->checkPassword($sUserName, $sPassword) ? "true" : "false") . "
";
//}
?>