28 include_once(
"Auth/Auth.php");
94 function ShibAuth($authParams, $updateUserData =
false)
96 if ($authParams[
"sessionName"] !=
"") {
97 parent::Auth(
"", array(
"sessionName" => $authParams[
"sessionName"]));
103 $this->updateUserData = $updateUserData;
106 if (!empty($authParams[
'sessionName'])) {
108 unset($authParams[
'sessionName']);
135 $this->idle += $time;
153 $this->expire += $time;
155 $this->expire = $time;
168 global $ilias, $rbacadmin;
169 if (!empty($_SERVER[$ilias->getSetting(
'shib_login')]))
173 $this->session[
'shibboleth_session_id'] = $_SERVER[
'Shib-Session-ID'];
187 $newUser[
"firstname"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]);
188 $newUser[
"lastname"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]);
196 $ilias->getSetting(
'shib_update_gender')
197 && ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm'
198 || $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
201 $newUser[
"gender"] = $_SERVER[$ilias->getSetting(
'shib_gender')];
205 $newUser[
"ext_account"] = $_SERVER[$ilias->getSetting(
'shib_login')];
208 $newUser[
"title"] = $_SERVER[$ilias->getSetting(
'shib_title')];
209 $newUser[
"institution"] = $_SERVER[$ilias->getSetting(
'shib_institution')];
210 $newUser[
"department"] = $_SERVER[$ilias->getSetting(
'shib_department')];
211 $newUser[
"street"] = $_SERVER[$ilias->getSetting(
'shib_street')];
212 $newUser[
"city"] = $_SERVER[$ilias->getSetting(
'shib_city')];
213 $newUser[
"zipcode"] = $_SERVER[$ilias->getSetting(
'shib_zipcode')];
214 $newUser[
"country"] = $_SERVER[$ilias->getSetting(
'shib_country')];
215 $newUser[
"phone_office"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]);
216 $newUser[
"phone_home"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_home')]);
217 $newUser[
"phone_mobile"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]);
218 $newUser[
"fax"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_fax')]);
219 $newUser[
"matriculation"] = $_SERVER[$ilias->getSetting(
'shib_matriculation')];
220 $newUser[
"email"] = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_email')]);
221 $newUser[
"hobby"] = $_SERVER[$ilias->getSetting(
'shib_hobby')];
222 $newUser[
"auth_mode"] =
"shibboleth";
226 $userObj->assignData($newUser);
227 $userObj->setTitle($userObj->getFullname());
228 $userObj->setDescription($userObj->getEmail());
229 $userObj->setLanguage($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_language')]));
232 $userObj->setTimeLimitOwner(7);
233 $userObj->setTimeLimitUnlimited(1);
234 $userObj->setTimeLimitFrom(time());
235 $userObj->setTimeLimitUntil(time());
240 if ( $ilias->getSetting(
'shib_data_conv')
241 && $ilias->getSetting(
'shib_data_conv') !=
''
242 && is_readable($ilias->getSetting(
'shib_data_conv'))
245 include($ilias->getSetting(
'shib_data_conv'));
250 $userObj->setActive(1, 6);
252 $userObj->updateOwner();
255 $userObj->saveAsNew();
261 $userObj->writePrefs();
264 #$rbacadmin->assignUser($ilias->getSetting('shib_user_default_role'), $userObj->getId(),true);
266 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
278 $uid = $userObj->checkUserId();
279 $userObj->setId($uid);
280 $userObj->read($uid);
283 $ilias->getSetting(
'shib_update_gender')
284 && ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm'
285 || $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
287 $userObj->setGender($_SERVER[$ilias->getSetting(
'shib_gender')]);
289 if ($ilias->getSetting(
'shib_update_title'))
290 $userObj->setTitle($_SERVER[$ilias->getSetting(
'shib_title')]);
292 $userObj->setFirstname($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]));
293 $userObj->setLastname($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]));
294 $userObj->setFullname();
295 if ($ilias->getSetting(
'shib_update_institution'))
296 $userObj->setInstitution($_SERVER[$ilias->getSetting(
'shib_institution')]);
297 if ($ilias->getSetting(
'shib_update_department'))
298 $userObj->setDepartment($_SERVER[$ilias->getSetting(
'shib_department')]);
299 if ($ilias->getSetting(
'shib_update_street'))
300 $userObj->setStreet($_SERVER[$ilias->getSetting(
'shib_street')]);
301 if ($ilias->getSetting(
'shib_update_city'))
302 $userObj->setCity($_SERVER[$ilias->getSetting(
'shib_city')]);
303 if ($ilias->getSetting(
'shib_update_zipcode'))
304 $userObj->setZipcode($_SERVER[$ilias->getSetting(
'shib_zipcode')]);
305 if ($ilias->getSetting(
'shib_update_country'))
306 $userObj->setCountry($_SERVER[$ilias->getSetting(
'shib_country')]);
307 if ($ilias->getSetting(
'shib_update_phone_office'))
308 $userObj->setPhoneOffice($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]));
309 if ($ilias->getSetting(
'shib_update_phone_home'))
310 $userObj->setPhoneHome($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_home')]));
311 if ($ilias->getSetting(
'shib_update_phone_mobile'))
312 $userObj->setPhoneMobile($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]));
313 if ($ilias->getSetting(
'shib_update_fax'))
314 $userObj->setFax($_SERVER[$ilias->getSetting(
'shib_fax')]);
315 if ($ilias->getSetting(
'shib_update_matriculation'))
316 $userObj->setMatriculation($_SERVER[$ilias->getSetting(
'shib_matriculation')]);
317 if ($ilias->getSetting(
'shib_update_email'))
318 $userObj->setEmail($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_email')]));
319 if ($ilias->getSetting(
'shib_update_hobby'))
320 $userObj->setHobby($_SERVER[$ilias->getSetting(
'shib_hobby')]);
322 if ($ilias->getSetting(
'shib_update_language'))
323 $userObj->setLanguage($_SERVER[$ilias->getSetting(
'shib_language')]);
327 if ( $ilias->getSetting(
'shib_data_conv')
328 && $ilias->getSetting(
'shib_data_conv') !=
''
329 && is_readable($ilias->getSetting(
'shib_data_conv'))
332 include($ilias->getSetting(
'shib_data_conv'));
339 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
344 if (
$_GET[
"target"] !=
"")
381 global $ilias,
$ilDB;
383 $shibID = $_SERVER[$ilias->getSetting(
'shib_login')];
384 $lastname = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]);
385 $firstname = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]);
387 if (trim($shibID) ==
"")
396 $ilias->db->query(
"UPDATE usr_data SET auth_mode='shibboleth', passwd=".$ilDB->quote(md5(end(
ilUtil::generatePasswords(1)))).
", ext_account=".$ilDB->quote($shibID).
" WHERE passwd=".$ilDB->quote($shibID));
417 $ln_arr=preg_split(
"/[ '-;]/", $lastname);
420 $prefix = strtolower(
$login);
424 if (strlen($prefix) == 0) {
425 $prefix =
'shibboleth';
446 return $prefix.$number;
458 $list = split(
';', $string);
459 $clean_string = rtrim($list[0]);
461 return $clean_string;
473 require_once(
'include/Unicode/UtfNormal.php');
481 $string = preg_replace(
'/([aouAOU])\\xcc\\x88/',
'\\1e', $string);
484 $string = preg_replace(
'/\\xc3\\x86/',
'AE', $string);
485 $string = preg_replace(
'/\\xc3\\xa6/',
'ae', $string);
488 $string = preg_replace(
'/\\xc3\\x9e/',
'TH', $string);
489 $string = preg_replace(
'/\\xc3\\xbe/',
'th', $string);
492 $string = preg_replace(
'/\\xc3\\x90/',
'D', $string);
493 $string = preg_replace(
'/\\xc4\\x91/',
'd', $string);
494 $string = preg_replace(
'/\\xc4\\x90/',
'D', $string);
497 $string = preg_replace(
'/\\xc3\\x9f/',
'ss', $string);
500 $string = preg_replace(
'/[^a-zA-Z\-]/i',
'', $string);