24 require_once(
'Auth/Auth.php');
25 require_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
26 require_once(
'include/Unicode/UtfNormal.php');
91 public function __construct($authParams, $updateUserData =
false) {
92 if ($authParams[
'sessionName'] !=
'') {
93 parent::Auth(
'', array(
'sessionName' => $authParams[
'sessionName'] ));
97 $this->updateUserData = $updateUserData;
98 if (! empty($authParams[
'sessionName'])) {
100 unset($authParams[
'sessionName']);
126 public function setIdle($time, $add =
false) {
128 $this->idle += $time;
147 $this->expire += $time;
149 $this->expire = $time;
162 if (! empty($_SERVER[$ilias->getSetting(
'shib_login')])) {
164 $this->session[
'shibboleth_session_id'] = $_SERVER[
'Shib-Session-ID'];
178 if ($ilias->getSetting(
'shib_update_gender')
179 AND ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm'
180 OR $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
182 $newUser[
'gender'] = $_SERVER[$ilias->getSetting(
'shib_gender')];
185 $newUser[
'ext_account'] = $_SERVER[$ilias->getSetting(
'shib_login')];
187 $newUser[
'title'] = $_SERVER[$ilias->getSetting(
'shib_title')];
188 $newUser[
'institution'] = $_SERVER[$ilias->getSetting(
'shib_institution')];
189 $newUser[
'department'] = $_SERVER[$ilias->getSetting(
'shib_department')];
190 $newUser[
'street'] = $_SERVER[$ilias->getSetting(
'shib_street')];
191 $newUser[
'city'] = $_SERVER[$ilias->getSetting(
'shib_city')];
192 $newUser[
'zipcode'] = $_SERVER[$ilias->getSetting(
'shib_zipcode')];
193 $newUser[
'country'] = $_SERVER[$ilias->getSetting(
'shib_country')];
194 $newUser[
'phone_office'] =
self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]);
196 $newUser[
'phone_mobile'] =
self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]);
198 $newUser[
'matriculation'] = $_SERVER[$ilias->getSetting(
'shib_matriculation')];
200 $newUser[
'hobby'] = $_SERVER[$ilias->getSetting(
'shib_hobby')];
201 $newUser[
'auth_mode'] =
'shibboleth';
203 $userObj->assignData($newUser);
204 $userObj->setTitle($userObj->getFullname());
205 $userObj->setDescription($userObj->getEmail());
206 $userObj->setLanguage(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_language')]));
208 $userObj->setTimeLimitOwner(7);
209 $userObj->setTimeLimitUnlimited(1);
210 $userObj->setTimeLimitFrom(time());
211 $userObj->setTimeLimitUntil(time());
215 if ($ilias->getSetting(
'shib_data_conv')
216 AND $ilias->getSetting(
'shib_data_conv') !=
''
217 AND is_readable($ilias->getSetting(
'shib_data_conv'))
219 include($ilias->getSetting(
'shib_data_conv'));
223 $userObj->setActive(1);
224 $userObj->updateOwner();
226 $userObj->saveAsNew();
230 $userObj->setPref(
'hits_per_page', $ilSetting->get(
'hits_per_page', 30));
231 $userObj->setPref(
'show_users_online', $ilSetting->get(
'show_users_online',
'y'));
233 $userObj->writePrefs();
235 #$rbacadmin->assignUser($ilias->getSetting('shib_user_default_role'), $userObj->getId(),true);
239 $this->
setAuth($userObj->getLogin());
242 $uid = $userObj->checkUserId();
243 $userObj->setId($uid);
244 $userObj->read($uid);
245 if ($ilias->getSetting(
'shib_update_gender')
246 AND ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm'
247 OR $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
249 $userObj->setGender($_SERVER[$ilias->getSetting(
'shib_gender')]);
251 if ($ilias->getSetting(
'shib_update_title')) {
252 $userObj->setTitle($_SERVER[$ilias->getSetting(
'shib_title')]);
254 $userObj->setFirstname(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]));
255 $userObj->setLastname(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]));
256 $userObj->setFullname();
257 if ($ilias->getSetting(
'shib_update_institution')) {
258 $userObj->setInstitution($_SERVER[$ilias->getSetting(
'shib_institution')]);
260 if ($ilias->getSetting(
'shib_update_department')) {
261 $userObj->setDepartment($_SERVER[$ilias->getSetting(
'shib_department')]);
263 if ($ilias->getSetting(
'shib_update_street')) {
264 $userObj->setStreet($_SERVER[$ilias->getSetting(
'shib_street')]);
266 if ($ilias->getSetting(
'shib_update_city')) {
267 $userObj->setCity($_SERVER[$ilias->getSetting(
'shib_city')]);
269 if ($ilias->getSetting(
'shib_update_zipcode')) {
270 $userObj->setZipcode($_SERVER[$ilias->getSetting(
'shib_zipcode')]);
272 if ($ilias->getSetting(
'shib_update_country')) {
273 $userObj->setCountry($_SERVER[$ilias->getSetting(
'shib_country')]);
275 if ($ilias->getSetting(
'shib_update_phone_office')) {
276 $userObj->setPhoneOffice(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]));
278 if ($ilias->getSetting(
'shib_update_phone_home')) {
279 $userObj->setPhoneHome(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_home')]));
281 if ($ilias->getSetting(
'shib_update_phone_mobile')) {
282 $userObj->setPhoneMobile(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]));
284 if ($ilias->getSetting(
'shib_update_fax')) {
285 $userObj->setFax($_SERVER[$ilias->getSetting(
'shib_fax')]);
287 if ($ilias->getSetting(
'shib_update_matriculation')) {
288 $userObj->setMatriculation($_SERVER[$ilias->getSetting(
'shib_matriculation')]);
290 if ($ilias->getSetting(
'shib_update_email')) {
291 $userObj->setEmail(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_email')]));
293 if ($ilias->getSetting(
'shib_update_hobby')) {
294 $userObj->setHobby($_SERVER[$ilias->getSetting(
'shib_hobby')]);
296 if ($ilias->getSetting(
'shib_update_language')) {
297 $userObj->setLanguage($_SERVER[$ilias->getSetting(
'shib_language')]);
301 if ($ilias->getSetting(
'shib_data_conv')
302 AND $ilias->getSetting(
'shib_data_conv') !=
''
303 AND is_readable($ilias->getSetting(
'shib_data_conv'))
305 include($ilias->getSetting(
'shib_data_conv'));
313 if (
$_GET[
'target'] !=
'') {
346 global $ilias, $ilDB;
347 $shibID = $_SERVER[$ilias->getSetting(
'shib_login')];
350 if (trim($shibID) ==
'') {
357 $ilias->db->query(
"UPDATE usr_data SET auth_mode='shibboleth', passwd="
359 .
' WHERE passwd=' . $ilDB->quote($shibID));
379 $ln_arr = preg_split(
"/[ ' -;]/", $lastname);
380 $login = substr($this->
toAscii($firstname), 0, 1) .
'.' . $this->
toAscii($ln_arr[0]);
381 if (strlen($login) < 6) {
382 $login .= $this->
toAscii($ln_arr[1]);
384 $prefix = strtolower($login);
387 if (strlen($prefix) == 0) {
388 $prefix =
'shibboleth';
403 return $prefix . $number;
419 $list = explode(
';', $string);
420 $clean_string = rtrim($list[0]);
422 return $clean_string;
445 $string = preg_replace(
'/([aouAOU])\\xcc\\x88/',
'\\1e', $string);
447 $string = preg_replace(
'/\\xc3\\x86/',
'AE', $string);
448 $string = preg_replace(
'/\\xc3\\xa6/',
'ae', $string);
450 $string = preg_replace(
'/\\xc3\\x9e/',
'TH', $string);
451 $string = preg_replace(
'/\\xc3\\xbe/',
'th', $string);
453 $string = preg_replace(
'/\\xc3\\x90/',
'D', $string);
454 $string = preg_replace(
'/\\xc4\\x91/',
'd', $string);
455 $string = preg_replace(
'/\\xc4\\x90/',
'D', $string);
457 $string = preg_replace(
'/\\xc3\\x9f/',
'ss', $string);
459 $string = preg_replace(
'/[^a-zA-Z\-]/i',
'', $string);