19 declare(strict_types=1);
31 private readonly
string $client,
32 private readonly
string $username,
42 if ($authSession ===
null) {
44 $authSession = $DIC[
'ilAuthSession'];
46 $this->auth_session = $authSession;
51 $credentials = new \ilAuthFrontendCredentials();
52 $credentials->setUsername($this->username);
56 $frontend_factory = new \ilAuthFrontendFactory();
59 $provider_factory = new \ilAuthProviderCliFactory();
61 $frontend = $frontend_factory->getFrontend(
65 $provider_factory->getProviders($credentials)
68 $frontend->authenticate();
70 switch ($status->getStatus()) {
71 case \ilAuthStatus::STATUS_AUTHENTICATED:
72 $this->is_authenticated =
true;
76 case \ilAuthStatus::STATUS_AUTHENTICATION_FAILED:
84 if ($this->is_authenticated) {
86 $this->auth_session->logout();
static getLogger(string $a_component_id)
Get component logger.
__construct(private readonly string $client, private readonly string $username, ?\ilAuthSession $authSession=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static initILIAS()
ilias initialisation
readonly ilAuthSession $auth_session
static getInstance()
Get status instance.
static setClosingContext(int $a_context)
set closing context (for statistics)
static init(string $a_type)
Init context by type.