24 include_once
'Auth/Container/LDAP.php';
25 if (version_compare(PHP_VERSION,
'5.3.0',
'>=') or 1)
27 include_once
'./webservice/soap/lib2/nusoap.php';
31 include_once
'./webservice/soap/lib/nusoap.php';
45 protected $server_port = null;
46 protected $server_uri = null;
47 protected $server_https = null;
48 protected $server_nms = null;
49 protected $use_dot_net = null;
51 protected $uri = null;
54 protected $response = null;
59 public function __construct()
64 parent::__construct();
72 public function initClient()
76 $this->server_host = $ilSetting->get(
'soap_auth_server');
77 $this->server_port = $ilSetting->get(
'soap_auth_port');
78 $this->server_uri = $ilSetting->get(
'soap_auth_uri');
79 $this->server_https = $ilSetting->get(
'soap_auth_use_https');
80 $this->server_nms = $ilSetting->get(
'soap_auth_namespace');
81 $this->use_dot_net = $ilSetting->get(
'use_dotnet');
83 $this->uri = $this->server_https ?
'https://' :
'http://';
86 if($this->server_port > 0)
88 $this->uri .= (
':'.$this->server_port);
92 $this->uri .= (
'/'.$this->server_uri);
104 public function fetchData($a_username,$a_password,$isChallengeResponse =
false)
106 $GLOBALS[
'ilLog']->write(__METHOD__.
': Soap auth fetch data');
111 if ($local_user ==
"")
122 if ($this->use_dotnet)
124 $soapAction = $this->server_nms.
"/isValidSession";
127 $valid = $this->client->call(
'isValidSession',
128 array($nspref.
'ext_uid' => $a_username,
129 $nspref.
'soap_pw' => $a_password,
139 if (trim(
$valid[
"valid"]) ==
"false")
145 $valid[
"local_user"] = $local_user;
147 return $valid[
'valid'] ==
true;
160 $GLOBALS[
'ilLog']->write(__METHOD__.
': SOAP login observer called');
183 $local_user = $this->response[
"local_user"];
184 if ($local_user !=
"")
187 $a_auth->setAuth($local_user);
190 if(!$ilSetting->get(
"soap_auth_create_users"))
198 if ($this->response[
"email"] !=
"")
207 if (
$_POST[
"LoginMappedUser"] !=
"")
209 if (count($email_user) > 0)
219 $a_auth->status =
'';
220 $a_auth->setAuth($local_user);
235 if (count($email_user) > 0 &&
$_POST[
"CreateUser"] ==
"")
237 $_GET[
"email"] = $this->response[
"email"];
247 $newUser[
"firstname"] = $this->response[
"firstname"];
248 $newUser[
"lastname"] = $this->response[
"lastname"];
249 $newUser[
"email"] = $this->response[
"email"];
251 $newUser[
"login"] = $local_user;
254 $newUser[
"passwd"] =
"";
261 if ($ilSetting->get(
"soap_auth_allow_local") &&
262 $ilSetting->get(
"soap_auth_account_mail"))
266 $newUser[
"passwd"] = md5($pw);
271 $newUser[
"auth_mode"] =
"soap";
272 $newUser[
"ext_account"] = $a_username;
273 $newUser[
"profile_incomplete"] = 1;
276 $userObj->assignData($newUser);
277 $userObj->setTitle($userObj->getFullname());
278 $userObj->setDescription($userObj->getEmail());
281 $userObj->setLanguage($lng->lang_default);
284 $userObj->setTimeLimitOwner(7);
285 $userObj->setTimeLimitUnlimited(1);
286 $userObj->setTimeLimitFrom(time());
287 $userObj->setTimeLimitUntil(time());
290 $userObj->setOwner(6);
292 $userObj->setActive(1, 6);
294 $userObj->updateOwner();
297 $userObj->saveAsNew(
false);
300 $userObj->writePrefs();
303 $rbacadmin->assignUser($ilSetting->get(
'soap_auth_user_default_role'), $userObj->getId(),
true);
306 if ($ilSetting->get(
"soap_auth_account_mail"))
308 include_once(
'./Services/User/classes/class.ilObjUserFolder.php');
310 if (trim($amail[
"body"]) !=
"" && trim($amail[
"subject"]) !=
"")
312 include_once(
"Services/Mail/classes/class.ilAccountMail.php");
317 $acc_mail->setUserPassword($pw);
319 $acc_mail->setUser($userObj);
325 $a_auth->setAuth($local_user);