ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilCronStartUp Class Reference
+ Collaboration diagram for ilCronStartUp:

Public Member Functions

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

Private Attributes

readonly ilAuthSession $authSession
 
bool $authenticated = false
 

Detailed Description

Definition at line 21 of file class.ilCronStartUp.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronStartUp::__construct ( private readonly string  $client,
private readonly string  $username,
?ilAuthSession  $authSession = null 
)

Definition at line 26 of file class.ilCronStartUp.php.

References $_GET, $authSession, $client, $DIC, ilContext\CONTEXT_CRON, and ilContext\init().

30  {
33 
34  // TODO @see mantis 20371: To get rid of this, the authentication service has to provide a mechanism to pass the client_id
35  $_GET['client_id'] = $this->client;
36  require_once './include/inc.header.php';
37 
38  if (null === $authSession) {
39  global $DIC;
40  $authSession = $DIC['ilAuthSession'];
41  }
42  $this->authSession = $authSession;
43  }
$_GET["client_id"]
Definition: webdav.php:30
const CONTEXT_CRON
readonly ilAuthSession $authSession
global $DIC
Definition: feed.php:28
$client
static init(string $a_type)
Init context by type.
+ Here is the call graph for this function:

Member Function Documentation

◆ authenticate()

ilCronStartUp::authenticate ( )
Exceptions
ilCronExceptionif authentication failed.

Definition at line 49 of file class.ilCronStartUp.php.

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

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->authSession,
63  $status,
64  $credentials,
65  $provider_factory->getProviders($credentials)
66  );
67 
68  $frontend->authenticate();
69 
70  switch ($status->getStatus()) {
72  $this->authenticated = true;
73  ilLoggerFactory::getLogger('auth')->debug('Authentication successful; Redirecting to starting page.');
74  return true;
75 
77  default:
78  throw new ilCronException($status->getTranslatedReason());
79  }
80  }
static getLogger(string $a_component_id)
Get component logger.
const STATUS_AUTHENTICATION_FAILED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
Get status instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ logout()

ilCronStartUp::logout ( )

Definition at line 82 of file class.ilCronStartUp.php.

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

82  : void
83  {
84  if ($this->authenticated) {
86  $this->authSession->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

◆ $authenticated

bool ilCronStartUp::$authenticated = false
private

Definition at line 24 of file class.ilCronStartUp.php.

◆ $authSession

readonly ilAuthSession ilCronStartUp::$authSession
private

Definition at line 23 of file class.ilCronStartUp.php.

Referenced by __construct().


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