24 require_once(
'Auth/Auth.php');
25 require_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php');
26 require_once(
'include/Unicode/UtfNormal.php');
27 require_once(
'./Services/AuthShibboleth/classes/class.ilShibbolethPluginWrapper.php');
93 public function __construct($authParams, $updateUserData =
false) {
94 if ($authParams[
'sessionName'] !=
'') {
95 parent::Auth(
'', array(
'sessionName' => $authParams[
'sessionName'] ));
99 $this->updateUserData = $updateUserData;
100 if (! empty($authParams[
'sessionName'])) {
102 unset($authParams[
'sessionName']);
128 public function setIdle($time, $add =
false) {
130 $this->idle += $time;
149 $this->expire += $time;
151 $this->expire = $time;
164 if (! empty($_SERVER[$ilias->getSetting(
'shib_login')])) {
166 $this->session[
'shibboleth_session_id'] = $_SERVER[
'Shib-Session-ID'];
181 if ($ilias->getSetting(
'shib_update_gender') AND ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm' OR
182 $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
184 $newUser[
'gender'] = $_SERVER[$ilias->getSetting(
'shib_gender')];
187 $newUser[
'ext_account'] = $_SERVER[$ilias->getSetting(
'shib_login')];
189 $newUser[
'title'] = $_SERVER[$ilias->getSetting(
'shib_title')];
190 $newUser[
'institution'] = $_SERVER[$ilias->getSetting(
'shib_institution')];
191 $newUser[
'department'] = $_SERVER[$ilias->getSetting(
'shib_department')];
192 $newUser[
'street'] = $_SERVER[$ilias->getSetting(
'shib_street')];
193 $newUser[
'city'] = $_SERVER[$ilias->getSetting(
'shib_city')];
194 $newUser[
'zipcode'] = $_SERVER[$ilias->getSetting(
'shib_zipcode')];
195 $newUser[
'country'] = $_SERVER[$ilias->getSetting(
'shib_country')];
196 $newUser[
'phone_office'] =
self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]);
198 $newUser[
'phone_mobile'] =
self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]);
200 $newUser[
'matriculation'] = $_SERVER[$ilias->getSetting(
'shib_matriculation')];
202 $newUser[
'hobby'] = $_SERVER[$ilias->getSetting(
'shib_hobby')];
203 $newUser[
'auth_mode'] =
'shibboleth';
205 $userObj->assignData($newUser);
206 $userObj->setTitle($userObj->getFullname());
207 $userObj->setDescription($userObj->getEmail());
208 $userObj->setLanguage(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_language')]));
210 $userObj->setTimeLimitOwner(7);
211 $userObj->setTimeLimitUnlimited(1);
212 $userObj->setTimeLimitFrom(time());
213 $userObj->setTimeLimitUntil(time());
217 if ($ilias->getSetting(
'shib_data_conv') AND
218 $ilias->getSetting(
'shib_data_conv') !=
'' AND is_readable($ilias->getSetting(
'shib_data_conv'))
220 include($ilias->getSetting(
'shib_data_conv'));
225 $userObj->setActive(1);
226 $userObj->updateOwner();
228 $userObj->saveAsNew();
232 $userObj->setPref(
'hits_per_page', $ilSetting->get(
'hits_per_page', 30));
233 $userObj->setPref(
'show_users_online', $ilSetting->get(
'show_users_online',
'y'));
235 $userObj->writePrefs();
238 #$rbacadmin->assignUser($ilias->getSetting('shib_user_default_role'), $userObj->getId(),true);
242 $this->
setAuth($userObj->getLogin(), $userObj);
245 $uid = $userObj->checkUserId();
246 $userObj->setId($uid);
247 $userObj->read($uid);
248 if ($ilias->getSetting(
'shib_update_gender') AND ($_SERVER[$ilias->getSetting(
'shib_gender')] ==
'm' OR
249 $_SERVER[$ilias->getSetting(
'shib_gender')] ==
'f')
251 $userObj->setGender($_SERVER[$ilias->getSetting(
'shib_gender')]);
253 if ($ilias->getSetting(
'shib_update_title')) {
254 $userObj->setTitle($_SERVER[$ilias->getSetting(
'shib_title')]);
256 $userObj->setFirstname(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_firstname')]));
257 $userObj->setLastname(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_lastname')]));
258 $userObj->setFullname();
259 $userObj->setTitle($userObj->getFullname());
260 $userObj->setDescription($userObj->getEmail());
261 if ($ilias->getSetting(
'shib_update_institution')) {
262 $userObj->setInstitution($_SERVER[$ilias->getSetting(
'shib_institution')]);
264 if ($ilias->getSetting(
'shib_update_department')) {
265 $userObj->setDepartment($_SERVER[$ilias->getSetting(
'shib_department')]);
267 if ($ilias->getSetting(
'shib_update_street')) {
268 $userObj->setStreet($_SERVER[$ilias->getSetting(
'shib_street')]);
270 if ($ilias->getSetting(
'shib_update_city')) {
271 $userObj->setCity($_SERVER[$ilias->getSetting(
'shib_city')]);
273 if ($ilias->getSetting(
'shib_update_zipcode')) {
274 $userObj->setZipcode($_SERVER[$ilias->getSetting(
'shib_zipcode')]);
276 if ($ilias->getSetting(
'shib_update_country')) {
277 $userObj->setCountry($_SERVER[$ilias->getSetting(
'shib_country')]);
279 if ($ilias->getSetting(
'shib_update_phone_office')) {
280 $userObj->setPhoneOffice(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_office')]));
282 if ($ilias->getSetting(
'shib_update_phone_home')) {
283 $userObj->setPhoneHome(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_home')]));
285 if ($ilias->getSetting(
'shib_update_phone_mobile')) {
286 $userObj->setPhoneMobile(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_phone_mobile')]));
288 if ($ilias->getSetting(
'shib_update_fax')) {
289 $userObj->setFax($_SERVER[$ilias->getSetting(
'shib_fax')]);
291 if ($ilias->getSetting(
'shib_update_matriculation')) {
292 $userObj->setMatriculation($_SERVER[$ilias->getSetting(
'shib_matriculation')]);
294 if ($ilias->getSetting(
'shib_update_email')) {
295 $userObj->setEmail(self::getFirstString($_SERVER[$ilias->getSetting(
'shib_email')]));
297 if ($ilias->getSetting(
'shib_update_hobby')) {
298 $userObj->setHobby($_SERVER[$ilias->getSetting(
'shib_hobby')]);
300 if ($ilias->getSetting(
'shib_update_language')) {
301 $userObj->setLanguage($_SERVER[$ilias->getSetting(
'shib_language')]);
305 if ($ilias->getSetting(
'shib_data_conv') AND
306 $ilias->getSetting(
'shib_data_conv') !=
'' AND is_readable($ilias->getSetting(
'shib_data_conv'))
308 include($ilias->getSetting(
'shib_data_conv'));
318 if (
$_GET[
'target'] !=
'') {
369 global $ilias, $ilDB;
370 $shibID = $_SERVER[$ilias->getSetting(
'shib_login')];
373 if (trim($shibID) ==
'') {
380 $ilias->db->query(
"UPDATE usr_data SET auth_mode='shibboleth', passwd="
382 .
' WHERE passwd=' . $ilDB->quote($shibID));
402 $ln_arr = preg_split(
"/[ ' -;]/", $lastname);
403 $login = substr($this->
toAscii($firstname), 0, 1) .
'.' . $this->
toAscii($ln_arr[0]);
404 if (strlen($login) < 6) {
405 $login .= $this->
toAscii($ln_arr[1]);
407 $prefix = strtolower($login);
410 if (strlen($prefix) == 0) {
411 $prefix =
'shibboleth';
426 return $prefix . $number;
442 $list = explode(
';', $string);
443 $clean_string = rtrim($list[0]);
445 return $clean_string;
468 $string = preg_replace(
'/([aouAOU])\\xcc\\x88/',
'\\1e', $string);
470 $string = preg_replace(
'/\\xc3\\x86/',
'AE', $string);
471 $string = preg_replace(
'/\\xc3\\xa6/',
'ae', $string);
473 $string = preg_replace(
'/\\xc3\\x9e/',
'TH', $string);
474 $string = preg_replace(
'/\\xc3\\xbe/',
'th', $string);
476 $string = preg_replace(
'/\\xc3\\x90/',
'D', $string);
477 $string = preg_replace(
'/\\xc4\\x91/',
'd', $string);
478 $string = preg_replace(
'/\\xc4\\x90/',
'D', $string);
480 $string = preg_replace(
'/\\xc3\\x9f/',
'ss', $string);
482 $string = preg_replace(
'/[^a-zA-Z\-]/i',
'', $string);