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;
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);
252 $userObj->updateOwner();
255 $userObj->saveAsNew();
261 $userObj->setPref(
'hits_per_page',$ilSetting->get(
'hits_per_page',30));
262 $userObj->setPref(
'show_users_online',$ilSetting->get(
'show_users_online',
'y'));
265 $userObj->writePrefs();
268 #$rbacadmin->assignUser($ilias->getSetting('shib_user_default_role'), $userObj->getId(),true);
270 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
274 $this->
setAuth($userObj->getLogin());
280 $uid = $userObj->checkUserId();
281 $userObj->setId($uid);
282 $userObj->read($uid);
285 $ilias->getSetting(
'shib_update_gender')
286 && ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm'
287 || $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
289 $userObj->setGender($_SERVER[$ilias->getSetting(
'shib_gender')]);
291 if ($ilias->getSetting(
'shib_update_title'))
292 $userObj->setTitle($_SERVER[$ilias->getSetting(
'shib_title')]);
294 $userObj->setFirstname($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]));
295 $userObj->setLastname($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]));
296 $userObj->setFullname();
297 if ($ilias->getSetting(
'shib_update_institution'))
298 $userObj->setInstitution($_SERVER[$ilias->getSetting(
'shib_institution')]);
299 if ($ilias->getSetting(
'shib_update_department'))
300 $userObj->setDepartment($_SERVER[$ilias->getSetting(
'shib_department')]);
301 if ($ilias->getSetting(
'shib_update_street'))
302 $userObj->setStreet($_SERVER[$ilias->getSetting(
'shib_street')]);
303 if ($ilias->getSetting(
'shib_update_city'))
304 $userObj->setCity($_SERVER[$ilias->getSetting(
'shib_city')]);
305 if ($ilias->getSetting(
'shib_update_zipcode'))
306 $userObj->setZipcode($_SERVER[$ilias->getSetting(
'shib_zipcode')]);
307 if ($ilias->getSetting(
'shib_update_country'))
308 $userObj->setCountry($_SERVER[$ilias->getSetting(
'shib_country')]);
309 if ($ilias->getSetting(
'shib_update_phone_office'))
310 $userObj->setPhoneOffice($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]));
311 if ($ilias->getSetting(
'shib_update_phone_home'))
312 $userObj->setPhoneHome($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_home')]));
313 if ($ilias->getSetting(
'shib_update_phone_mobile'))
314 $userObj->setPhoneMobile($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]));
315 if ($ilias->getSetting(
'shib_update_fax'))
316 $userObj->setFax($_SERVER[$ilias->getSetting(
'shib_fax')]);
317 if ($ilias->getSetting(
'shib_update_matriculation'))
318 $userObj->setMatriculation($_SERVER[$ilias->getSetting(
'shib_matriculation')]);
319 if ($ilias->getSetting(
'shib_update_email'))
320 $userObj->setEmail($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_email')]));
321 if ($ilias->getSetting(
'shib_update_hobby'))
322 $userObj->setHobby($_SERVER[$ilias->getSetting(
'shib_hobby')]);
324 if ($ilias->getSetting(
'shib_update_language'))
325 $userObj->setLanguage($_SERVER[$ilias->getSetting(
'shib_language')]);
329 if ( $ilias->getSetting(
'shib_data_conv')
330 && $ilias->getSetting(
'shib_data_conv') !=
''
331 && is_readable($ilias->getSetting(
'shib_data_conv'))
334 include($ilias->getSetting(
'shib_data_conv'));
341 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
346 if (
$_GET[
"target"] !=
"")
383 global $ilias,
$ilDB;
385 $shibID = $_SERVER[$ilias->getSetting(
'shib_login')];
386 $lastname = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]);
387 $firstname = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]);
389 if (trim($shibID) ==
"")
398 $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));
419 $ln_arr=preg_split(
"/[ '-;]/", $lastname);
420 $login=substr($this->
toAscii($firstname),0,1) .
"." . $this->
toAscii($ln_arr[0]);
421 if (strlen($login) < 6) $login .= $this->
toAscii($ln_arr[1]);
422 $prefix = strtolower($login);
426 if (strlen($prefix) == 0) {
427 $prefix =
'shibboleth';
448 return $prefix.$number;
460 $list = split(
';', $string);
461 $clean_string = rtrim($list[0]);
463 return $clean_string;
475 require_once(
'include/Unicode/UtfNormal.php');
483 $string = preg_replace(
'/([aouAOU])\\xcc\\x88/',
'\\1e', $string);
486 $string = preg_replace(
'/\\xc3\\x86/',
'AE', $string);
487 $string = preg_replace(
'/\\xc3\\xa6/',
'ae', $string);
490 $string = preg_replace(
'/\\xc3\\x9e/',
'TH', $string);
491 $string = preg_replace(
'/\\xc3\\xbe/',
'th', $string);
494 $string = preg_replace(
'/\\xc3\\x90/',
'D', $string);
495 $string = preg_replace(
'/\\xc4\\x91/',
'd', $string);
496 $string = preg_replace(
'/\\xc4\\x90/',
'D', $string);
499 $string = preg_replace(
'/\\xc3\\x9f/',
'ss', $string);
502 $string = preg_replace(
'/[^a-zA-Z\-]/i',
'', $string);