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