18 declare(strict_types=1);
32 protected string $uri =
'';
44 $this->
logger = $DIC->logger()->auth();
46 $this->rbacAdmin = $DIC->rbac()->admin();
53 $this->server_host = (string) $this->
settings->get(
'soap_auth_server',
'');
54 $this->server_port = (string) $this->
settings->get(
'soap_auth_port',
'');
55 $this->server_uri = (string) $this->
settings->get(
'soap_auth_uri',
'');
56 $this->server_nms = (string) $this->
settings->get(
'soap_auth_namespace',
'');
57 $this->server_https = (bool) $this->
settings->get(
'soap_auth_use_https',
'0');
58 $this->use_dot_net = (bool) $this->
settings->get(
'use_dotnet',
'0');
60 $this->uri = $this->server_https ?
'https://' :
'http://';
63 if ($this->server_port > 0) {
66 if ($this->server_uri) {
70 require_once
'./webservice/soap/lib/nusoap.php';
83 $this->
getLogger()->error($e->getMessage());
84 $this->
getLogger()->error($e->getTraceAsString());
89 $this->
logger->info(
'Successfully authenticated user via SOAP: ' . $this->
getCredentials()->getUsername());
103 $this->
logger->debug(sprintf(
104 'Login observer called for SOAP authentication request of ext_account "%s" and auth_mode "%s".',
108 $this->
logger->debug(sprintf(
109 'Trying to find ext_account "%s" for auth_mode "%s".',
120 if (
'' === $internalLogin || null === $internalLogin) {
126 if ($this->use_dot_net) {
127 $soapAction = $this->server_nms .
'/isValidSession';
131 $valid = $this->client->call(
136 $nspref .
'new_user' => $isNewUser
143 $valid = [
'valid' =>
false];
146 if (
$valid[
'valid'] !==
true) {
160 if (!$this->
settings->get(
'soap_auth_create_users')) {
170 $usrData[
'firstname'] =
$valid[
'firstname'];
171 $usrData[
'lastname'] =
$valid[
'lastname'];
172 $usrData[
'email'] =
$valid[
'email'];
173 $usrData[
'login'] = $internalLogin;
174 $usrData[
'passwd'] =
'';
178 if ($this->
settings->get(
'soap_auth_allow_local')) {
180 $password = $passwords[0];
181 $usrData[
'passwd'] = $password;
185 $usrData[
'auth_mode'] =
'soap';
187 $usrData[
'profile_incomplete'] = 1;
189 $userObj->assignData($usrData);
190 $userObj->setTitle($userObj->getFullname());
191 $userObj->setDescription($userObj->getEmail());
192 $userObj->setLanguage($this->
language->getDefaultLanguage());
195 $userObj->setTimeLimitUnlimited(
true);
196 $userObj->setTimeLimitFrom(time());
197 $userObj->setTimeLimitUntil(time());
198 $userObj->setOwner(0);
200 $userObj->setActive(
true);
201 $userObj->updateOwner();
202 $userObj->saveAsNew();
203 $userObj->writePrefs();
205 $this->rbacAdmin->assignUser(
206 (
int) $this->
settings->get(
'soap_auth_user_default_role',
'4'),
210 if ($this->
settings->get(
'soap_auth_account_mail',
'0')) {
212 $registrationSettings->setPasswordGenerationStatus(
true);
215 $registrationSettings,
220 ->withDirectRegistrationMode()
221 ->send($userObj, $password,
false);
static _generateLogin(string $a_login)
generate free login by starting with a default string and adding postfix numbers
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const STATUS_AUTHENTICATION_FAILED
handleSoapAuth(ilAuthStatus $status)
static _lookupId($a_user_str)
__construct(ilAuthCredentials $credentials)
Class ilAuthProviderSoap.
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
getAuthenticatedUserId()
Get authenticated user id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilAccountRegistrationMail.
setStatus(int $a_status)
Set auth status.
ilAuthCredentials $credentials
[nu]soapclient higher level class for easy usage.
doAuthentication(ilAuthStatus $status)
static generatePasswords(int $a_number)
Generate a number of passwords.
const STATUS_AUTHENTICATED
Class ilObjAuthSettingsGUI.
setTranslatedReason(string $a_reason)
Set translated reason.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
Class ilRbacAdmin Core functions for role based access control.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static set(string $a_var, $a_val)
Set a value.