call authentication hook if available

authentication hooks are classes with a method authenticate() which
creates a user object if authentication was successfull
This commit is contained in:
Uwe Steinmann 2013-07-23 19:03:02 +02:00
parent 77e976cb7a
commit e87e60c89f

View File

@ -70,29 +70,37 @@ if ((!isset($pwd) || strlen($pwd)==0) && ($login != $guestUser->getLogin())) {
exit;
}
//
// LDAP Sign In
//
$user = false;
/* new code by doudoux - TO BE TESTED */
if (isset($settings->_ldapBaseDN)) {
$ldapSearchAttribut = "uid=";
$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN;
if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['authentication'] as $authObj) {
if(method_exists($authObj, 'authenticate')) {
$user = $authObj->authenticate($dms, $settings, $login, $pwd);
$userid = $user->getID();
}
}
}
if (isset($settings->_ldapType))
{
if ($settings->_ldapType==1)
{
if (is_bool($user)) {
//
// LDAP Sign In
//
/* new code by doudoux - TO BE TESTED */
if (isset($settings->_ldapBaseDN)) {
$ldapSearchAttribut = "uid=";
$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN;
}
if (isset($settings->_ldapType)) {
if ($settings->_ldapType==1) {
$ldapSearchAttribut = "sAMAccountName=";
$tmpDN = $login.'@'.$settings->_ldapAccountDomainName;
}
}
/* end of new code */
}
/* end of new code */
$user = false;
if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) {
$ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort);
}
@ -170,6 +178,7 @@ if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
}
ldap_close($ds);
}
}
}
if (is_bool($user)) {