ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCronStartUp Class Reference

Handles cron (cli) request. More...

+ Collaboration diagram for ilCronStartUp:

Public Member Functions

 __construct ( $a_client_id, $a_login, $a_password, ilAuthSession $authSession=null)
 
 authenticate ()
 Start authentication. More...
 
 logout ()
 Closes the current auth session. More...
 

Private Attributes

 $client = ''
 
 $username = ''
 
 $password = ''
 
 $authSession
 

Detailed Description

Handles cron (cli) request.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilCronStartUp::__construct (   $a_client_id,
  $a_login,
  $a_password,
ilAuthSession  $authSession = null 
)
Parameters
$a_client_id
$a_login
$a_password
ilAuthSession | null$authSession

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

31 {
32 $this->client = $a_client_id;
33 $this->username = $a_login;
34 $this->password = $a_password;
35
36 include_once './Services/Context/classes/class.ilContext.php';
38
39 // define client
40 // @see mantis 20371
41 $_GET['client_id'] = $this->client;
42
43 include_once './include/inc.header.php';
44
45 if (null === $authSession) {
46 global $DIC;
47 $authSession = $DIC['ilAuthSession'];
48 }
49 $this->authSession = $authSession;
50 }
$_GET["client_id"]
const CONTEXT_CRON
static init($a_type)
Init context by type.
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

Member Function Documentation

◆ authenticate()

ilCronStartUp::authenticate ( )

Start authentication.

Returns
bool
Exceptions
ilCronExceptionif authentication failed.

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

60 {
61 $credentials = new ilAuthFrontendCredentials();
62 $credentials->setUsername($this->username);
63 $credentials->setPassword($this->password);
64
65 $provider_factory = new ilAuthProviderFactory();
66 $providers = $provider_factory->getProviders($credentials);
67
68 $status = ilAuthStatus::getInstance();
69
70 $frontend_factory = new ilAuthFrontendFactory();
71 $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_CLI);
72
73 $frontend = $frontend_factory->getFrontend(
74 $this->authSession,
75 $status,
76 $credentials,
77 $providers
78 );
79
80 $frontend->authenticate();
81
82 switch ($status->getStatus()) {
84 ilLoggerFactory::getLogger('auth')->debug('Authentication successful; Redirecting to starting page.');
85 return true;
86
87
88 default:
90 throw new ilCronException($status->getTranslatedReason());
91 }
92 return true;
93 }
Factory for auth frontend classes.
static getInstance()
Get status instance.
const STATUS_AUTHENTICATION_FAILED
Standard cron exception.
static getLogger($a_component_id)
Get component logger.

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

+ Here is the call graph for this function:

◆ logout()

ilCronStartUp::logout ( )

Closes the current auth session.

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

99 {
101 $this->authSession->logout();
102 }
const SESSION_CLOSE_USER
static setClosingContext($a_context)
set closing context (for statistics)

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

+ Here is the call graph for this function:

Field Documentation

◆ $authSession

ilCronStartUp::$authSession
private

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

Referenced by __construct().

◆ $client

ilCronStartUp::$client = ''
private

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

Referenced by __construct().

◆ $password

ilCronStartUp::$password = ''
private

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

◆ $username

ilCronStartUp::$username = ''
private

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


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