9require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
10require_once(
'./Services/WebAccessChecker/classes/class.ilWACPath.php');
11require_once(
'./Services/WebAccessChecker/classes/class.ilWACSecurePath.php');
12require_once(
'./Services/Init/classes/class.ilInitialisation.php');
13require_once(
'./Services/FileDelivery/classes/class.ilFileDelivery.php');
85 $this->
http = $httpState;
102 if ($ilWACSignedPath->isSignedPath()) {
104 if ($ilWACSignedPath->isSignedPathValid()) {
113 if ($ilWACSignedPath->isFolderSigned()) {
115 if ($ilWACSignedPath->isFolderTokenValid()) {
117 $ilWACSignedPath->revalidatingFolderToken();
120 $this->
sendHeader(
'checked using secure folder');
131 $checkingInstance = ilWACSecurePath::getCheckingInstance($this->
getPathObject());
133 $canBeDelivered = $checkingInstance->canBeDelivered($this->
getPathObject());
134 if ($canBeDelivered) {
136 if ($ilWACSignedPath->isFolderSigned() && $this->isRevalidateFolderTokens()) {
137 $ilWACSignedPath->revalidatingFolderToken();
187 $cookie = $this->cookieFactory->create(
'ilClientId', $this->
getPathObject()->getClient())
193 ->renderIntoResponseHeader($this->
http->response());
202 }
catch (Exception $e) {
207 if (($e instanceof Exception && $e->getMessage() ==
'Authentication failed.')
209 $this->initAnonymousSession();
226 $is_anonymous = ((int)
$DIC->user()->getId() === (int) ANONYMOUS_USER_ID);
227 $is_null_user = (
$DIC->user()->getId() === 0);
228 $pub_section_activated = (bool)
$DIC[
'ilSetting']->
get(
'pub_section');
229 $isset = isset(
$DIC[
'ilSetting']);
231 if (!$isset || !$instanceof || (!$pub_section_activated && ($is_anonymous || ($is_null_user && $not_on_login_page)))) {
242 $user_id_is_zero = ((int)
$DIC->user()->getId() === 0);
244 if (!$is_user || ($user_id_is_zero && $not_on_login_page)) {
442 assert(is_int($method));
443 $this->applied_checking_methods[] = $method;
447 protected function initAnonymousSession()
450 include_once
'./Services/Context/classes/class.ilContext.php';
452 require_once(
"Services/Init/classes/class.ilInitialisation.php");
457 $ilAuthSession =
$DIC[
'ilAuthSession'];
458 $ilAuthSession->init();
459 $ilAuthSession->regenerateId();
460 $a_id = (int) ANONYMOUS_USER_ID;
461 $ilAuthSession->setUserId($a_id);
462 $ilAuthSession->setAuthenticated(
false, $a_id);
463 $DIC->user()->setId($a_id);
472 $referrer = !is_null(
$_SERVER[
'HTTP_REFERER']) ?
$_SERVER[
'HTTP_REFERER'] :
'';
473 $not_on_login_page = (strpos($referrer,
'login.php') ===
false
474 && strpos($referrer,
'&baseClass=ilStartUpGUI') ===
false);
476 return $not_on_login_page;
An exception for terminatinating execution or to throw for unit testing.
static init($a_type)
Init context by type.
static initILIAS()
ilias initialisation
const ACCESS_DENIED_NO_LOGIN
const ACCESS_DENIED_NO_PUB
static hasCheckingInstanceRegistered(ilWACPath $ilWACPath)
Searches a checking instance for the given wac path.
Class ilWebAccessChecker.
const CM_CHECKINGINSTANCE
setDisposition($disposition)
__construct(GlobalHttpState $httpState, CookieFactory $cookieFactory)
ilWebAccessChecker constructor.
static $use_seperate_logfile
$applied_checking_methods
static setUseSeperateLogfile($use_seperate_logfile)
setSendStatusCode($send_status_code)
$revalidate_folder_tokens
setRevalidateFolderTokens($revalidate_folder_tokens)
setAppliedCheckingMethods(array $applied_checking_methods)
isRequestNotFromLoginPage()
isRevalidateFolderTokens()
addAppliedCheckingMethod($method)
setInitialized($initialized)
setPathObject(ilWACPath $path_object)
static isUseSeperateLogfile()
setOverrideMimetype($override_mimetype)
getAppliedCheckingMethods()
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Interface GlobalHttpState.
request()
Returns the current psr-7 server request.
Value object representing a URI.
catch(Exception $e) $message
static http()
Fetches the global http state from ILIAS.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']