24 include_once(
'Auth/Container/LDAP.php');
87 function fetchData($username, $password, $isChallengeResponse=
false)
101 return $isSuccessful;
112 $this->optional_check =
true;
138 $this->log->write(__METHOD__.
': checking group restrictions...');
141 $groups = $this->server->getGroupNames();
145 $this->log->write(__METHOD__.
': No group restrictions found.');
150 $this->log->write(__METHOD__.
': Group membership is optional.');
154 foreach($groups as $group)
156 $this->options[
'group'] = $group;
158 if(parent::checkGroup($a_name))
174 public function _debug($a_message =
'',$a_line = 0)
176 if(is_object($this->log))
178 $this->log->write(
'LDAP PEAR: '.$a_message);
191 $this->options[
'userfilter'] = $this->server->getGroupUserFilter();
219 $ilLog->write(__METHOD__.
': logged in as '.$a_username.
220 ', remote:'.$_SERVER[
'REMOTE_ADDR'].
':'.$_SERVER[
'REMOTE_PORT'].
221 ', server:'.$_SERVER[
'SERVER_ADDR'].
':'.$_SERVER[
'SERVER_PORT']
224 $ilBench->start(
'Auth',
'LDAPLoginObserver');
225 $user_data = array_change_key_case($this->_auth_obj->getAuthData(),CASE_LOWER);
230 $users[$a_username] = $user_data;
233 if($this->server->enabledSyncOnLogin())
235 if(!$user_data[
'ilInternalAccount'] and $this->server->isAccountMigrationEnabled() and !$this->_auth_obj->force_creation)
237 $this->_auth_obj->logout();
239 $_SESSION[
'tmp_external_account'] = $a_username;
240 $_SESSION[
'tmp_pass'] = $_POST[
'password'];
242 include_once(
'./Services/LDAP/classes/class.ilLDAPRoleAssignments.php');
244 $role_inf = $role_ass->assignedRoles($a_username,$user_data);
246 foreach($role_inf as $info)
250 $ilBench->stop(
'Auth',
'LDAPLoginObserver');
251 ilUtil::redirect(
'ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration');
255 $ilBench->start(
'Auth',
'LDAPUserSynchronization');
258 #$GLOBALS['ilLog']->write(__METHOD__.': Starting update');
260 $this->ldap_attr_to_user->setUserData($users);
261 $this->ldap_attr_to_user->refresh();
269 $ilBench->stop(
'Auth',
'LDAPUserSynchronization');
272 if(!$user_data[
'ilInternalAccount'])
276 $this->_auth_obj->logout();
277 $ilBench->stop(
'Auth',
'LDAPLoginObserver');
281 $this->_auth_obj->setAuth($user_data[
'ilInternalAccount']);
282 $ilBench->stop(
'Auth',
'LDAPLoginObserver');
294 include_once(
'Services/LDAP/classes/class.ilLDAPAttributeToUser.php');
306 $ilLog->write(__METHOD__.
': login failed'.
307 ', remote:'.$_SERVER[
'REMOTE_ADDR'].
':'.$_SERVER[
'REMOTE_PORT'].
308 ', server:'.$_SERVER[
'SERVER_ADDR'].
':'.$_SERVER[
'SERVER_PORT']
313 $this->_auth_obj->logout();
315 $this->_auth_obj->start();
326 $a_username = isset($a_user_data[strtolower($this->server->getUserAttribute())]) ?
327 $a_user_data[strtolower($this->server->getUserAttribute())] :
331 if(!is_array($a_username))
335 foreach($a_username as $name)
344 return $a_username[0];
359 include_once
'./Services/LDAP/classes/class.ilLDAPAttributeMapping.php';