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,6 +70,18 @@ if ((!isset($pwd) || strlen($pwd)==0) && ($login != $guestUser->getLogin())) {
exit; exit;
} }
$user = false;
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 (is_bool($user)) {
// //
// LDAP Sign In // LDAP Sign In
// //
@ -80,18 +92,14 @@ if (isset($settings->_ldapBaseDN)) {
$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN; $tmpDN = "uid=".$login.",".$settings->_ldapBaseDN;
} }
if (isset($settings->_ldapType)) if (isset($settings->_ldapType)) {
{ if ($settings->_ldapType==1) {
if ($settings->_ldapType==1)
{
$ldapSearchAttribut = "sAMAccountName="; $ldapSearchAttribut = "sAMAccountName=";
$tmpDN = $login.'@'.$settings->_ldapAccountDomainName; $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)) { if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) {
$ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort); $ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort);
@ -171,6 +179,7 @@ if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) {
ldap_close($ds); ldap_close($ds);
} }
} }
}
if (is_bool($user)) { if (is_bool($user)) {
// //