ILIAS  release_8 Revision v8.24
ilCronStartUp Class Reference
+ Collaboration diagram for ilCronStartUp:

Public Member Functions

 __construct (string $a_client_id, string $a_login, string $a_password, ?ilAuthSession $authSession=null)
 
 authenticate ()
 Start authentication. More...
 
 logout ()
 

Private Attributes

string $client
 
string $username
 
string $password
 
ilAuthSession $authSession
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilCronStartUp::__construct ( string  $a_client_id,
string  $a_login,
string  $a_password,
?ilAuthSession  $authSession = null 
)

@noRector

@noRector

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

33 {
34 $this->client = $a_client_id;
35 $this->username = $a_login;
36 $this->password = $a_password;
37
39 require_once './Services/Context/classes/class.ilContext.php';
41
42 // @see mantis 20371: To get rid of this, the authentication service has to provide a mechanism to pass the client_id
43 $_GET['client_id'] = $this->client;
45 require_once './include/inc.header.php';
46
47 if (null === $authSession) {
48 global $DIC;
49 $authSession = $DIC['ilAuthSession'];
50 }
51 $this->authSession = $authSession;
52 }
const CONTEXT_CRON
static init(string $a_type)
Init context by type.
ilAuthSession $authSession
global $DIC
Definition: feed.php:28
$_GET['client_id']
Definition: saml1-acs.php:21

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.

Exceptions
ilCronExceptionif authentication failed.

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

59 : bool
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
89 default:
90 throw new ilCronException($status->getTranslatedReason());
91 }
92
93 return true;
94 }
Factory for auth frontend classes.
static getInstance()
Get status instance.
const STATUS_AUTHENTICATION_FAILED
static getLogger(string $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 ( )

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

96 : void
97 {
99 $this->authSession->logout();
100 }
const SESSION_CLOSE_USER
static setClosingContext(int $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

ilAuthSession ilCronStartUp::$authSession
private

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

Referenced by __construct().

◆ $client

string ilCronStartUp::$client
private

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

Referenced by __construct().

◆ $password

string ilCronStartUp::$password
private

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

◆ $username

string ilCronStartUp::$username
private

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


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