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';
282 $uid = $userObj->checkUserId();
283 $userObj->setId($uid);
284 $userObj->read($uid);
287 $ilias->getSetting(
'shib_update_gender')
288 && ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm'
289 || $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
291 $userObj->setGender($_SERVER[$ilias->getSetting(
'shib_gender')]);
293 if ($ilias->getSetting(
'shib_update_title'))
294 $userObj->setTitle($_SERVER[$ilias->getSetting(
'shib_title')]);
296 $userObj->setFirstname($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]));
297 $userObj->setLastname($this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]));
298 $userObj->setFullname();
299 if ($ilias->getSetting(
'shib_update_institution'))
300 $userObj->setInstitution($_SERVER[$ilias->getSetting(
'shib_institution')]);
301 if ($ilias->getSetting(
'shib_update_department'))
302 $userObj->setDepartment($_SERVER[$ilias->getSetting(
'shib_department')]);
303 if ($ilias->getSetting(
'shib_update_street'))
304 $userObj->setStreet($_SERVER[$ilias->getSetting(
'shib_street')]);
305 if ($ilias->getSetting(
'shib_update_city'))
306 $userObj->setCity($_SERVER[$ilias->getSetting(
'shib_city')]);
307 if ($ilias->getSetting(
'shib_update_zipcode'))
308 $userObj->setZipcode($_SERVER[$ilias->getSetting(
'shib_zipcode')]);
309 if ($ilias->getSetting(
'shib_update_country'))
310 $userObj->setCountry($_SERVER[$ilias->getSetting(
'shib_country')]);
311 if ($ilias->getSetting(
'shib_update_phone_office'))
312 $userObj->setPhoneOffice($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]));
313 if ($ilias->getSetting(
'shib_update_phone_home'))
314 $userObj->setPhoneHome($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_home')]));
315 if ($ilias->getSetting(
'shib_update_phone_mobile'))
316 $userObj->setPhoneMobile($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]));
317 if ($ilias->getSetting(
'shib_update_fax'))
318 $userObj->setFax($_SERVER[$ilias->getSetting(
'shib_fax')]);
319 if ($ilias->getSetting(
'shib_update_matriculation'))
320 $userObj->setMatriculation($_SERVER[$ilias->getSetting(
'shib_matriculation')]);
321 if ($ilias->getSetting(
'shib_update_email'))
322 $userObj->setEmail($this->getFirstString($_SERVER[$ilias->getSetting(
'shib_email')]));
323 if ($ilias->getSetting(
'shib_update_hobby'))
324 $userObj->setHobby($_SERVER[$ilias->getSetting(
'shib_hobby')]);
326 if ($ilias->getSetting(
'shib_update_language'))
327 $userObj->setLanguage($_SERVER[$ilias->getSetting(
'shib_language')]);
331 if ( $ilias->getSetting(
'shib_data_conv')
332 && $ilias->getSetting(
'shib_data_conv') !=
''
333 && is_readable($ilias->getSetting(
'shib_data_conv'))
336 include($ilias->getSetting(
'shib_data_conv'));
343 include_once
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
348 if (
$_GET[
"target"] !=
"")
385 global $ilias,
$ilDB;
387 $shibID = $_SERVER[$ilias->getSetting(
'shib_login')];
388 $lastname = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]);
389 $firstname = $this->
getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]);
391 if (trim($shibID) ==
"")
400 $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));
421 $ln_arr=preg_split(
"/[ '-;]/", $lastname);
422 $login=substr($this->
toAscii($firstname),0,1) .
"." . $this->
toAscii($ln_arr[0]);
423 if (strlen($login) < 6) $login .= $this->
toAscii($ln_arr[1]);
424 $prefix = strtolower($login);
428 if (strlen($prefix) == 0) {
429 $prefix =
'shibboleth';
450 return $prefix.$number;
462 $list = split(
';', $string);
463 $clean_string = rtrim($list[0]);
465 return $clean_string;
477 require_once(
'include/Unicode/UtfNormal.php');
485 $string = preg_replace(
'/([aouAOU])\\xcc\\x88/',
'\\1e', $string);
488 $string = preg_replace(
'/\\xc3\\x86/',
'AE', $string);
489 $string = preg_replace(
'/\\xc3\\xa6/',
'ae', $string);
492 $string = preg_replace(
'/\\xc3\\x9e/',
'TH', $string);
493 $string = preg_replace(
'/\\xc3\\xbe/',
'th', $string);
496 $string = preg_replace(
'/\\xc3\\x90/',
'D', $string);
497 $string = preg_replace(
'/\\xc4\\x91/',
'd', $string);
498 $string = preg_replace(
'/\\xc4\\x90/',
'D', $string);
501 $string = preg_replace(
'/\\xc3\\x9f/',
'ss', $string);
504 $string = preg_replace(
'/[^a-zA-Z\-]/i',
'', $string);