ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Cron\CLI\StartUp Class Reference
+ Collaboration diagram for ILIAS\Cron\CLI\StartUp:

Public Member Functions

 __construct (private readonly string $username, ?\ilAuthSession $authSession=null)
 
 authenticate ()
 
 logout ()
 

Private Attributes

readonly ilAuthSession $auth_session
 
bool $is_authenticated = false
 

Detailed Description

Definition at line 25 of file StartUp.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Cron\CLI\StartUp::__construct ( private readonly string  $username,
?\ilAuthSession  $authSession = null 
)

@noRector

Definition at line 30 of file StartUp.php.

33 {
36
37 require_once __DIR__ . '/../../../../../artifacts/bootstrap_default.php';
38 entry_point('ILIAS Legacy Initialisation Adapter');
39
40 if ($authSession === null) {
41 global $DIC;
42 $authSession = $DIC['ilAuthSession'];
43 }
44 $this->auth_session = $authSession;
45 }
const CONTEXT_CRON
Definition: ilContext.php:31
static init(string $a_type)
Init context by type.
Definition: ilContext.php:52
entry_point(string $name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: result1.php:21
global $DIC
Definition: shib_login.php:26

References $DIC, ilContext\CONTEXT_CRON, entry_point(), and ilContext\init().

+ Here is the call graph for this function:

Member Function Documentation

◆ authenticate()

ILIAS\Cron\CLI\StartUp::authenticate ( )

Definition at line 47 of file StartUp.php.

47 : bool
48 {
49 $credentials = new \ilAuthFrontendCredentials();
50 $credentials->setUsername($this->username);
51
53
54 $frontend_factory = new \ilAuthFrontendFactory();
55 $frontend_factory->setContext(\ilAuthFrontendFactory::CONTEXT_CLI);
56
57 $provider_factory = new \ilAuthProviderCliFactory();
58
59 $frontend = $frontend_factory->getFrontend(
60 $this->auth_session,
61 $status,
62 $credentials,
63 $provider_factory->getProviders($credentials)
64 );
65
66 $frontend->authenticate();
67
68 switch ($status->getStatus()) {
69 case \ilAuthStatus::STATUS_AUTHENTICATED:
70 $this->is_authenticated = true;
71 \ilLoggerFactory::getLogger('auth')->debug('Authentication successful; Redirecting to starting page.');
72
73 // https://mantis.ilias.de/view.php?id=47354
74 \ilInitialisation::initLanguage(true);
75
76 return true;
77
78 case \ilAuthStatus::STATUS_AUTHENTICATION_FAILED:
79 default:
80 throw new CronException($status->getTranslatedReason());
81 }
82 }
static getInstance()
Get status instance.
static getLogger(string $a_component_id)
Get component logger.

References ilAuthFrontendFactory\CONTEXT_CLI, ilAuthStatus\getInstance(), and ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

◆ logout()

ILIAS\Cron\CLI\StartUp::logout ( )

Definition at line 84 of file StartUp.php.

84 : void
85 {
86 if ($this->is_authenticated) {
88 $this->auth_session->logout();
89 }
90 }
static setClosingContext(int $a_context)
set closing context (for statistics)
const int SESSION_CLOSE_USER

References ilSession\SESSION_CLOSE_USER, and ilSession\setClosingContext().

+ Here is the call graph for this function:

Field Documentation

◆ $auth_session

readonly ilAuthSession ILIAS\Cron\CLI\StartUp::$auth_session
private

Definition at line 27 of file StartUp.php.

◆ $is_authenticated

bool ILIAS\Cron\CLI\StartUp::$is_authenticated = false
private

Definition at line 28 of file StartUp.php.


The documentation for this class was generated from the following file: