19declare(strict_types=1);
37 $this->
logger = $DIC->logger()->auth();
39 $this->rbac_admin =
$DIC->rbac()->admin();
57 }
catch (Exception
$e) {
58 $this->
getLogger()->error($e->getMessage());
59 $this->
getLogger()->error($e->getTraceAsString());
67 $this->
logger->info(
'Successfully authenticated user via SOAP: ' . $this->
getCredentials()->getUsername());
81 $this->
logger->debug(sprintf(
82 'Login observer called for SOAP authentication request of ext_account "%s" and auth_mode "%s".',
86 $this->
logger->debug(sprintf(
87 'Trying to find ext_account "%s" for auth_mode "%s".',
98 if ($internal_login ===
'' || $internal_login ===
null) {
102 $valid = $this->
client->validateSession(
108 if ($valid[
'valid'] !==
true) {
109 $valid[
'valid'] =
false;
112 if (!$valid[
'valid']) {
122 if (!$this->
settings->get(
'soap_auth_create_users')) {
131 $usr_data[
'firstname'] = $valid[
'firstname'];
132 $usr_data[
'lastname'] = $valid[
'lastname'];
133 $usr_data[
'email'] = $valid[
'email'];
134 $usr_data[
'login'] = $internal_login;
135 $usr_data[
'passwd'] =
'';
139 if ($this->
settings->get(
'soap_auth_allow_local')) {
141 $password = $passwords[0];
142 $usr_data[
'passwd'] = $password;
146 $usr_data[
'auth_mode'] =
'soap';
147 $usr_data[
'ext_account'] = $this->
getCredentials()->getUsername();
148 $usr_data[
'profile_incomplete'] = 1;
150 $user_obj->assignData($usr_data);
151 $user_obj->setTitle($user_obj->getFullname());
152 $user_obj->setDescription($user_obj->getEmail());
153 $user_obj->setLanguage($this->
language->getDefaultLanguage());
156 $user_obj->setTimeLimitUnlimited(
true);
157 $user_obj->setTimeLimitFrom(time());
158 $user_obj->setTimeLimitUntil(time());
159 $user_obj->setOwner(0);
161 $user_obj->setActive(
true);
162 $user_obj->saveAsNew();
163 $user_obj->updateOwner();
164 $user_obj->writePrefs();
166 $this->rbac_admin->assignUser(
167 (
int) $this->
settings->get(
'soap_auth_user_default_role',
'4'),
171 if ($this->
settings->get(
'soap_auth_account_mail',
'0')) {
173 $registration_settings->setPasswordGenerationStatus(
true);
176 $registration_settings,
181 ->withDirectRegistrationMode()
182 ->send($user_obj, $password,
false);
Class ilAccountRegistrationMail.
SessionValidationClient $client
handleSoapAuth(ilAuthStatus $status)
doAuthentication(ilAuthStatus $status)
@inheritDoc
__construct(ilAuthCredentials $credentials)
handleAuthenticationFail(ilAuthStatus $status, string $a_reason)
ilAuthCredentials $credentials
setTranslatedReason(string $a_reason)
Set translated reason.
setReason(string $a_reason)
Set reason.
setAuthenticatedUserId(int $a_id)
setStatus(int $a_status)
Set auth status.
const int STATUS_AUTHENTICATED
getAuthenticatedUserId()
Get authenticated user id.
static _generateLogin(string $a_login)
generate free login by starting with a default string and adding postfix numbers
Component logger with individual log levels by component id.
static _lookupId(string|array $a_user_str)
static _checkExternalAuthAccount(string $a_auth, string $a_account, bool $tryFallback=true)
check whether external account and authentication method matches with a user
Class ilRbacAdmin Core functions for role based access control.
Class ilObjAuthSettingsGUI.
static generatePasswords(int $a_number)
Generate a number of passwords.
static set(string $a_var, $a_val)
Set a value.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc