25 include_once(
"Auth/Auth.php");
26 include_once(
"./webservice/soap/lib/nusoap.php");
44 if ($a_params[
"sessionName"] !=
"")
46 parent::Auth(
"", array(
"sessionName" => $a_params[
"sessionName"]));
53 $this->server_hostname = $a_params[
"server_hostname"];
54 $this->server_port = (int) $a_params[
"server_port"];
55 $this->server_uri = $a_params[
"server_uri"];
56 $this->
namespace = $a_params["namespace"];
57 $this->use_dotnet = $a_params[
"use_dotnet"];
58 if ($a_params[
"https"])
69 $uri.= $this->server_hostname;
71 if ($this->server_port > 0)
73 $uri.=
":".$this->server_port;
76 if ($this->server_uri !=
"")
78 $uri.=
"/".$this->server_uri;
88 die(
"SOAP Authentication Initialisation Error: ".$err);
99 $settings = $ilSetting->getAll();
101 $server_hostname = $settings[
"soap_auth_server"];
102 $server_port = (int) $settings[
"soap_auth_port"];
103 $server_uri = $settings[
"soap_auth_uri"];
104 $namespace = $settings[
"soap_auth_namespace"];
105 $use_dotnet = $settings[
"soap_auth_use_dotnet"];
106 if ($settings[
"soap_auth_use_https"])
115 $uri.= $server_hostname;
117 if ($server_port > 0)
119 $uri.=
":".$server_port;
122 if ($server_uri !=
"")
124 $uri.=
"/".$server_uri;
128 if ($err = $soap_client->getError())
130 return "SOAP Authentication Initialisation Error: ".$err;
141 $valid = $soap_client->call(
'isValidSession',
142 array($nspref.
'ext_uid' => $a_ext_uid,
143 $nspref.
'soap_pw' => $a_soap_pw,
144 $nspref.
'new_user' => $a_new_user),
150 '<br><pre>' . htmlspecialchars(str_replace(
"\" ",
"\"\n ", str_replace(
">",
">\n", $soap_client->request)), ENT_QUOTES) .
'</pre><br>'.
151 "<br>== Response ==".
152 "<br>Valid: -".$valid[
"valid"].
"-".
153 '<br><pre>' . htmlspecialchars(str_replace(
"\" ",
"\"\n ", str_replace(
">",
">\n", $soap_client->response)), ENT_QUOTES) .
'</pre>';
166 if ($local_user ==
"")
177 if ($this->use_dotnet)
179 $soapAction = $this->
namespace.
"/isValidSession";
184 array($nspref.
'ext_uid' => $a_ext_uid,
185 $nspref.
'soap_pw' => $a_soap_pw,
196 if (trim(
$valid[
"valid"]) ==
"false")
202 $valid[
"local_user"] = $local_user;
227 if (empty(
$_GET[
"ext_uid"]) || empty(
$_GET[
"soap_pw"]))
233 $validation_data = $this->validateSoapUser(
$_GET[
"ext_uid"],
$_GET[
"soap_pw"]);
235 if (!$validation_data[
"valid"])
241 $local_user = $validation_data[
"local_user"];
243 if ($local_user !=
"")
246 $this->setAuth($local_user);
250 if (!$ilSetting->get(
"soap_auth_create_users"))
258 if ($validation_data[
"email"] !=
"")
266 if ($_POST[
"LoginMappedUser"] !=
"")
268 if (count($email_user) > 0)
276 $_GET[
"cmd"] = $_POST[
"cmd"] =
$_GET[
"auth_stat"]=
"";
279 $this->setAuth($local_user);
293 if (count($email_user) > 0 && $_POST[
"CreateUser"] ==
"")
295 $_GET[
"email"] = $validation_data[
"email"];
306 $newUser[
"firstname"] = $validation_data[
"firstname"];
307 $newUser[
"lastname"] = $validation_data[
"lastname"];
308 $newUser[
"email"] = $validation_data[
"email"];
310 $newUser[
"login"] = $local_user;
313 $newUser[
"passwd"] =
"";
320 if ($ilSetting->get(
"soap_auth_allow_local") &&
321 $ilSetting->get(
"soap_auth_account_mail"))
325 $newUser[
"passwd"] = md5($pw);
330 $newUser[
"auth_mode"] =
"soap";
331 $newUser[
"ext_account"] =
$_GET[
"ext_uid"];
332 $newUser[
"profile_incomplete"] = 1;
335 $userObj->assignData($newUser);
336 $userObj->setTitle($userObj->getFullname());
337 $userObj->setDescription($userObj->getEmail());
340 $userObj->setLanguage($lng->lang_default);
343 $userObj->setTimeLimitOwner(7);
344 $userObj->setTimeLimitUnlimited(1);
345 $userObj->setTimeLimitFrom(time());
346 $userObj->setTimeLimitUntil(time());
349 $userObj->setOwner(6);
351 $userObj->setActive(1, 6);
353 $userObj->updateOwner();
356 $userObj->saveAsNew(
false);
359 $userObj->writePrefs();
362 $rbacadmin->assignUser($ilSetting->get(
'soap_auth_user_default_role'), $userObj->getId(),
true);
365 if ($ilSetting->get(
"soap_auth_account_mail"))
367 include_once(
'./Services/User/classes/class.ilObjUserFolder.php');
369 if (trim($amail[
"body"]) !=
"" && trim($amail[
"subject"]) !=
"")
371 include_once(
"Services/Mail/classes/class.ilAccountMail.php");
376 $acc_mail->setUserPassword($pw);
378 $acc_mail->setUser($userObj);
385 $this->setAuth($local_user);