19 declare(strict_types=1);
29 protected string $uri =
'';
41 $this->
logger = $DIC->logger()->auth();
43 $this->rbacAdmin = $DIC->rbac()->admin();
50 $this->server_host = (string) $this->
settings->get(
'soap_auth_server',
'');
51 $this->server_port = (string) $this->
settings->get(
'soap_auth_port',
'');
52 $this->server_uri = (string) $this->
settings->get(
'soap_auth_uri',
'');
53 $this->server_nms = (string) $this->
settings->get(
'soap_auth_namespace',
'');
54 $this->server_https = (bool) $this->
settings->get(
'soap_auth_use_https',
'0');
55 $this->use_dot_net = (bool) $this->
settings->get(
'use_dotnet',
'0');
57 $this->uri = $this->server_https ?
'https://' :
'http://';
60 if ($this->server_port > 0) {
63 if ($this->server_uri) {
67 require_once __DIR__ .
'/../../soap/lib/nusoap.php';
80 $this->
getLogger()->error($e->getMessage());
81 $this->
getLogger()->error($e->getTraceAsString());
86 $this->
logger->info(
'Successfully authenticated user via SOAP: ' . $this->
getCredentials()->getUsername());
100 $this->
logger->debug(sprintf(
101 'Login observer called for SOAP authentication request of ext_account "%s" and auth_mode "%s".',
105 $this->
logger->debug(sprintf(
106 'Trying to find ext_account "%s" for auth_mode "%s".',
117 if (
'' === $internalLogin ||
null === $internalLogin) {
123 if ($this->use_dot_net) {
124 $soapAction = $this->server_nms .
'/isValidSession';
133 $nspref .
'new_user' => $isNewUser
140 $valid = [
'valid' =>
false];
143 if (
$valid[
'valid'] !==
true) {
157 if (!$this->
settings->get(
'soap_auth_create_users')) {
167 $usrData[
'firstname'] =
$valid[
'firstname'];
168 $usrData[
'lastname'] =
$valid[
'lastname'];
169 $usrData[
'email'] =
$valid[
'email'];
170 $usrData[
'login'] = $internalLogin;
171 $usrData[
'passwd'] =
'';
175 if ($this->
settings->get(
'soap_auth_allow_local')) {
177 $password = $passwords[0];
178 $usrData[
'passwd'] = $password;
182 $usrData[
'auth_mode'] =
'soap';
184 $usrData[
'profile_incomplete'] = 1;
186 $userObj->assignData($usrData);
187 $userObj->setTitle($userObj->getFullname());
188 $userObj->setDescription($userObj->getEmail());
189 $userObj->setLanguage($this->
language->getDefaultLanguage());
192 $userObj->setTimeLimitUnlimited(
true);
193 $userObj->setTimeLimitFrom(time());
194 $userObj->setTimeLimitUntil(time());
195 $userObj->setOwner(0);
197 $userObj->setActive(
true);
198 $userObj->updateOwner();
199 $userObj->saveAsNew();
200 $userObj->writePrefs();
202 $this->rbacAdmin->assignUser(
203 (
int) $this->
settings->get(
'soap_auth_user_default_role',
'4'),
207 if ($this->
settings->get(
'soap_auth_account_mail',
'0')) {
209 $registrationSettings->setPasswordGenerationStatus(
true);
212 $registrationSettings,
217 ->withDirectRegistrationMode()
218 ->send($userObj, $password,
false);
static _generateLogin(string $a_login)
generate free login by starting with a default string and adding postfix numbers
handleSoapAuth(ilAuthStatus $status)
const int STATUS_AUTHENTICATED
static _lookupId($a_user_str)
__construct(ilAuthCredentials $credentials)
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilAccountRegistrationMail.
setStatus(int $a_status)
Set auth status.
ilAuthCredentials $credentials
[nu]soapclient higher level class for easy usage.
const int STATUS_AUTHENTICATION_FAILED
doAuthentication(ilAuthStatus $status)
static generatePasswords(int $a_number)
Generate a number of passwords.
Class ilObjAuthSettingsGUI.
client()
description: > This example shows how a Progress Bar can be rendered and used on the client...
__construct(Container $dic, ilPlugin $plugin)
setTranslatedReason(string $a_reason)
Set translated reason.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
language()
description: > Example for rendring a language glyph.
Class ilRbacAdmin Core functions for role based access control.
static set(string $a_var, $a_val)
Set a value.