19declare(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();
readonly ilAuthSession $auth_session
__construct(private readonly string $client, private readonly string $username, ?\ilAuthSession $authSession=null)
static getInstance()
Get status instance.
static init(string $a_type)
Init context by type.
static initILIAS()
ilias initialisation
static getLogger(string $a_component_id)
Get component logger.
static setClosingContext(int $a_context)
set closing context (for statistics)
const int SESSION_CLOSE_USER