2require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
3require_once(
'./Services/WebAccessChecker/classes/class.ilWACPath.php');
4require_once(
'./Services/WebAccessChecker/classes/class.ilWACSecurePath.php');
5require_once(
'./Services/WebAccessChecker/classes/class.ilWACLog.php');
6require_once(
'./Services/Init/classes/class.ilInitialisation.php');
7require_once(
'./Services/FileDelivery/classes/class.ilFileDelivery.php');
8require_once(
'./Services/WebAccessChecker/classes/class.ilWACCookie.php');
9require_once(
'./Services/WebAccessChecker/classes/class.ilWACHeader.php');
101 if ($ilWACSignedPath->isSignedPath()) {
103 if ($ilWACSignedPath->isSignedPathValid()) {
113 if ($ilWACSignedPath->isFolderSigned()) {
115 if ($ilWACSignedPath->isFolderTokenValid()) {
117 $ilWACSignedPath->revalidatingFolderToken();
121 $this->
sendHeader(
'checked using secure folder');
131 $checkingInstance = ilWACSecurePath::getCheckingInstance($this->
getPathObject());
135 $canBeDelivered = $checkingInstance->canBeDelivered($this->
getPathObject());
136 if ($canBeDelivered) {
139 if ($ilWACSignedPath->isFolderSigned() && $this->isRevalidateFolderTokens()) {
140 $ilWACSignedPath->revalidatingFolderToken();
156 ilWACLog::getInstance()->write(
'none of the checking mechanisms could have been applied. access depending on sec folder');
175 $this->
getHeader()->sendHeader(
'X-ILIAS-WebAccessChecker: ' . $message);
188 $this->cookie->set(
'ilClientId', $this->
getPathObject()->getClient(), 0,
'/');
195 }
catch (Exception $e) {
200 if (($e instanceof Exception && $e->getMessage() ==
'Authentication failed.')
202 $this->initAnonymousSession();
214 $is_anonymous = ((int)
$DIC->user()->getId() === (int)ANONYMOUS_USER_ID);
215 $is_null_user = (
$DIC->user()->getId() === 0);
216 $pub_section_activated = (bool)
$DIC[
'ilSetting']->
get(
'pub_section');
217 $isset = isset(
$DIC[
'ilSetting']);
219 if (!$isset || !$instanceof || (!$pub_section_activated && ($is_anonymous || ($is_null_user && $not_on_login_page)))) {
229 $user_id_is_zero = ((int)
$DIC->user()->getId() === 0);
231 if (!$is_user || ($user_id_is_zero && $not_on_login_page)) {
417 $this->applied_checking_methods[] = $method;
437 protected function initAnonymousSession() {
439 include_once
'./Services/Context/classes/class.ilContext.php';
441 require_once(
"Services/Init/classes/class.ilInitialisation.php");
446 $ilAuthSession =
$DIC[
'ilAuthSession'];
447 $ilAuthSession->init();
448 $ilAuthSession->regenerateId();
449 $a_id = (int)ANONYMOUS_USER_ID;
450 $ilAuthSession->setUserId($a_id);
451 $ilAuthSession->setAuthenticated(
false, $a_id);
452 $DIC->user()->setId($a_id);
460 $referrer = !is_null(
$_SERVER[
'HTTP_REFERER']) ?
$_SERVER[
'HTTP_REFERER'] :
'';
461 $not_on_login_page = (strpos($referrer,
'login.php') ===
false
462 && strpos($referrer,
'&baseClass=ilStartUpGUI') ===
false);
464 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
Class ilWebAccessChecker.
const CM_CHECKINGINSTANCE
setDisposition($disposition)
static $use_seperate_logfile
$applied_checking_methods
__construct($path, ilWACCookieInterface $ilWACCookieInterface=null, ilWACHeaderInterface $ilWACHeaderInterface=null)
ilWebAccessChecker constructor.
static setUseSeperateLogfile($use_seperate_logfile)
setSendStatusCode($send_status_code)
$revalidate_folder_tokens
setRevalidateFolderTokens($revalidate_folder_tokens)
isRequestNotFromLoginPage()
setPathObject($path_object)
isRevalidateFolderTokens()
addAppliedCheckingMethod($method)
setAppliedCheckingMethods($applied_checking_methods)
setInitialized($initialized)
static isUseSeperateLogfile()
setOverrideMimetype($override_mimetype)
getAppliedCheckingMethods()
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class ilWACCheckingClass.
Class ilWACCookieInterface.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']