ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

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

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  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
const CONTEXT_CRON
static init($a_type)
Init context by type.
+ 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.

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

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  }
Standard cron exception.
const STATUS_AUTHENTICATION_FAILED
Factory for auth frontend classes.
static getInstance()
Get status instance.
static getLogger($a_component_id)
Get component logger.
+ 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.

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

99  {
101  $this->authSession->logout();
102  }
const SESSION_CLOSE_USER
static setClosingContext($a_context)
set closing context (for statistics)
+ 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: