ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Cron\CLI\StartUp Class Reference
+ Collaboration diagram for ILIAS\Cron\CLI\StartUp:

Public Member Functions

 __construct (private readonly string $client, 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  $client,
private readonly string  $username,
?\ilAuthSession  $authSession = null 
)

Definition at line 30 of file StartUp.php.

References $_GET, $client, $DIC, ilContext\CONTEXT_CRON, ilContext\init(), ilInitialisation\initILIAS(), and null.

34  {
37 
38  // TODO @see mantis 20371: To get rid of this, the authentication service has to provide a mechanism to pass the client_id
39  $_GET['client_id'] = $this->client;
41 
42  if ($authSession === null) {
43  global $DIC;
44  $authSession = $DIC['ilAuthSession'];
45  }
46  $this->auth_session = $authSession;
47  }
$_GET["client_id"]
Definition: webdav.php:30
const CONTEXT_CRON
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$client
static initILIAS()
ilias initialisation
global $DIC
Definition: shib_login.php:22
static init(string $a_type)
Init context by type.
+ Here is the call graph for this function:

Member Function Documentation

◆ authenticate()

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

Definition at line 49 of file StartUp.php.

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

49  : bool
50  {
51  $credentials = new \ilAuthFrontendCredentials();
52  $credentials->setUsername($this->username);
53 
54  $status = \ilAuthStatus::getInstance();
55 
56  $frontend_factory = new \ilAuthFrontendFactory();
57  $frontend_factory->setContext(\ilAuthFrontendFactory::CONTEXT_CLI);
58 
59  $provider_factory = new \ilAuthProviderCliFactory();
60 
61  $frontend = $frontend_factory->getFrontend(
62  $this->auth_session,
63  $status,
64  $credentials,
65  $provider_factory->getProviders($credentials)
66  );
67 
68  $frontend->authenticate();
69 
70  switch ($status->getStatus()) {
71  case \ilAuthStatus::STATUS_AUTHENTICATED:
72  $this->is_authenticated = true;
73  \ilLoggerFactory::getLogger('auth')->debug('Authentication successful; Redirecting to starting page.');
74  return true;
75 
76  case \ilAuthStatus::STATUS_AUTHENTICATION_FAILED:
77  default:
78  throw new CronException($status->getTranslatedReason());
79  }
80  }
static getLogger(string $a_component_id)
Get component logger.
static getInstance()
Get status instance.
+ Here is the call graph for this function:

◆ logout()

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

Definition at line 82 of file StartUp.php.

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

82  : void
83  {
84  if ($this->is_authenticated) {
86  $this->auth_session->logout();
87  }
88  }
const SESSION_CLOSE_USER
static setClosingContext(int $a_context)
set closing context (for statistics)
+ 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: